[libvirt] [PATCH 3/6] fix migration of paused vms upon failure

Chris Lalancette clalance at redhat.com
Fri Oct 2 10:17:12 UTC 2009


Paolo Bonzini wrote:
> This makes a small change on the failed-migration path.  Up to now,
> all VMs that failed non-live migration after the "stop" command
> were restarted.  This must not be done when the VM was paused in
> the first place.

OK, yes, after thinking about this, I agree with this semantic.  However, I
don't really agree with the implementation below.  Here's why:

If your domain is already paused, then you'll be issuing a "qemuMonitorStopCPUs"
command unnecessarily.  That by itself isn't a huge deal; it will essentially be
a no-op.  But you will also generate an event of "VIR_DOMAIN_EVENT_SUSPENDED",
which is wrong; you didn't really suspend the domain, an earlier command did.  I
think the implementation should be something more along the lines of:

paused = 0;
if (!(flags & VIR_MIGRATE_LIVE) && vm->state == VIR_DOMAIN_RUNNING) {
     stop_cpus();
     generate_event();
     paused = 1;
     vm->state = PAUSED;
}

Make sense?

One other thing to possibly investigate is whether the "vm->state ==
VIR_DOMAIN_RUNNING" is sufficient.  Can we (legitimately) be in state
VIR_DOMAIN_NOSTATE or VIR_DOMAIN_BLOCKED, yet still be "running"?  I'm not sure,
but I'd want to make sure before using that as a condition.

-- 
Chris Lalancette




More information about the libvir-list mailing list