Add live migrate max downtime selector meta field

Adds a new flag to VM metadata to allow setting the VM live migration
max downtime. This will enable very busy VMs that hang live migration to
have this value changed.
This commit is contained in:
2024-01-10 16:13:31 -05:00
parent 38eeb78423
commit 09269f182c
17 changed files with 283 additions and 30 deletions

View File

@ -687,6 +687,29 @@ class VMInstance(object):
abort_migrate("Target node changed during preparation")
return
if not force_shutdown:
# Set the maxdowntime value from Zookeeper
try:
max_downtime = self.zkhandler.read(
("domain.meta.migrate_max_downtime", self.domuuid)
)
except Exception as e:
self.logger.out(
f"Error fetching migrate max downtime; using default of 300s: {e}",
state="w",
)
self.max_downtime = 300
self.logger.out(
f"Running migrate-setmaxdowntime with downtime value {max_downtime}",
state="i",
prefix="Domain {}".format(self.domuuid),
)
retcode, stdout, stderr = common.run_os_command(
f"virsh migrate-setmaxdowntime --downtime {max_downtime} {self.domuuid}"
)
if retcode:
abort_migrate("Failed to set maxdowntime value on running VM")
return
# A live migrate is attemped 3 times in succession
ticks = 0
while True: