Skip to content

Commit

Permalink
Merge pull request #97 from MissionCriticalCloud/fix/stopstart
Browse files Browse the repository at this point in the history
Fix starting of stopped VMs
  • Loading branch information
ddegoede authored Nov 9, 2023
2 parents 496855a + d0703aa commit 5685acb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cosmicops/objects/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def empty(self, target=None):

# If the host is disabled, try to restart the VM. Will fail if the host is on NVMe.
if self['resourcestate'] == 'Disabled':
if vm.start():
if vm.start(host=target):
continue

self.vms_with_shutdown_policy.append(vm)
Expand Down
4 changes: 4 additions & 0 deletions rolling_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,15 @@ def main(profile, ignore_hosts, only_hosts, skip_os_version, reboot_action, pre_
if proxy_host:
logging.info(f"Host '{host['name']}' is now empty (VMs are on proxy host {proxy_host['name']}). "
f"Will now migrate VMs back to origin {host['name']}...", log_to_slack)
# Disable host, so we can start the VMs with StopStartPolicy
proxy_host.disable()
while True:
(_, _, failed) = proxy_host.empty(target=host)
if failed == 0:
break
proxy_host.restart_vms_with_shutdown_policy()
# Enable the proxy_host again
proxy_host.enable()

logging.info(f"Host '{host['name']}' is done. It should now have the same VMs as before", log_to_slack)

Expand Down

0 comments on commit 5685acb

Please sign in to comment.