[libvirt] libvirt(-java): virDomainMigrateSetMaxDowntime

Thomas Treutner thomas at scripty.at
Tue Jul 13 16:56:53 UTC 2010


I'm facing some troubles with virDomainMigrate & 
virDomainMigrateSetMaxDowntime. The core problem is that KVM's default 
value for the maximum allowed downtime is 30ms (max_downtime in 
migration.c, it's nanoseconds there; 0.12.3) which is too low for my VMs 
when they're busy (~50% CPU util and above). Migrations then take 
literally forever, I had to abort them after 15 minutes or so. I'm using 
GBit Ethernet, so plenty bandwidth should be available. Increasing the 
allowed downtime to 50ms seems to help, but I have not tested situations 
where the VM is completely utilized. Anyways, the default value is too 
low for me, so I tried virDomainMigrateSetMaxDowntime resp. the Java 
wrapper function.

Here I'm facing a problem I can overcome only with a quite crude hack:
org.libvirt.Domain.migrate(..) blocks until the migration is done, which 
is of course reasonable. So I tried calling migrateSetMaxDowntime(..) 
before migrating, causing an error:

"Requested operation is not valid: domain is not being migrated"

This tells me that calling migrateSetMaxDowntime is only allowed during 
migrations. As I'm migrating VMs automatically and without any user 
intervention I'd need to create some glue code that runs in an extra 
thread, waiting "some time" hoping that the migration was kicked off in 
the main thread yet and then calling migrateSetMaxDowntime. I'd like to 
avoid such quirks in the long run, if possible.

So my question: Would it be possible to extend the migrate() method 
resp. virDomainMigrate() function with an optional maxDowntime parameter 
that is passed down as QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME so that 
qemuDomainWaitForMigrationComplete would set the value? Or are there 
easier ways?

Thanks and regards,


More information about the libvir-list mailing list