-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch files for rescuing Windows VMs
- Loading branch information
1 parent
4d32bd2
commit 83ab7d6
Showing
4 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
diff --git a/gce_rescue/config.py b/gce_rescue/config.py | ||
index 3f25983..c1319ad 100644 | ||
--- a/gce_rescue/config.py | ||
+++ b/gce_rescue/config.py | ||
@@ -26,14 +26,16 @@ config = { | ||
'debug': False, | ||
'skip-snapshot': False, | ||
'startup-script-file': os.path.join(dirname, 'startup-script.txt'), | ||
+ | ||
+ # Temporary workaround for rescue Windows machine | ||
'source_guests': { | ||
'x86_64':[ | ||
- 'projects/debian-cloud/global/images/family/debian-11', | ||
- 'projects/rocky-linux-cloud/global/images/family/rocky-linux-9' | ||
+ 'projects/windows-cloud/global/images/family/windows-2016', | ||
+ 'projects/windows-cloud/global/images/family/windows-2016' | ||
], | ||
'arm64':[ | ||
- 'projects/debian-cloud/global/images/family/debian-11-arm64', | ||
- 'projects/rocky-linux-cloud/global/images/family/rocky-linux-9-arm64' | ||
+ 'projects/windows-cloud/global/images/family/windows-2016', | ||
+ 'projects/windows-cloud/global/images/family/windows-2016' | ||
] | ||
} | ||
} | ||
diff --git a/gce_rescue/tasks/actions.py b/gce_rescue/tasks/actions.py | ||
index 7d3c453..dfd9f36 100644 | ||
--- a/gce_rescue/tasks/actions.py | ||
+++ b/gce_rescue/tasks/actions.py | ||
@@ -122,6 +122,7 @@ def call_tasks(vm: Instance, action: str) -> None: | ||
""" Loop tasks dict and execute """ | ||
tasks = _list_tasks(vm = vm, action = action) | ||
async_backup_thread = None | ||
+ | ||
if action == 'set_rescue_mode': | ||
if get_config('skip-snapshot'): | ||
_logger.info(f'Skipping snapshot backup.') | ||
@@ -135,6 +136,11 @@ def call_tasks(vm: Instance, action: str) -> None: | ||
|
||
for task in tasks: | ||
execute = task['name'] | ||
+ | ||
+ # Temporary workaround for Windows rescue boot disk | ||
+ if execute == 'restore_metadata_items' or execute == "set_metadata": | ||
+ continue | ||
+ | ||
args = task['args'][0] | ||
|
||
execute(**args) | ||
diff --git a/gce_rescue/tasks/metadata.py b/gce_rescue/tasks/metadata.py | ||
index 8ac1821..f7a639f 100644 | ||
--- a/gce_rescue/tasks/metadata.py | ||
+++ b/gce_rescue/tasks/metadata.py | ||
@@ -70,8 +70,9 @@ def restore_metadata_items(vm, remove_rescue_mode: bool = False) -> Dict: | ||
_logger.info('Restoring original metadata...') | ||
|
||
# gce-rescue/issues/21 - continue after wait period timed out | ||
- if not remove_rescue_mode: | ||
- wait_for_os_boot(vm) | ||
+ # Commented as temporary patch for rescuing Windows images | ||
+ #if not remove_rescue_mode: | ||
+ # wait_for_os_boot(vm) | ||
|
||
operation = vm.compute.instances().setMetadata( | ||
**vm.project_data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters