[libvirt-users] virsh migrate results in error: Timed out during operation: cannot acquire state change lock

Eric Blake eblake at redhat.com
Thu Feb 9 20:59:12 UTC 2012

On 02/09/2012 07:00 AM, Nuno Sousa wrote:
> Hi all,
> Hi have one computer hosting several VM, this particular server is in
> need of maintenance and has to be shutdown.
> In order to avoid disrupting the services provided by the VM I intended
> to migrate the VM to another computer.
> Computer 1 and 2 do not share any storage. So it is necessary to migrate
> not only the memory but also any data on the hard-drive.
> Both computers are running debian squeeze.
> Virsh is version 0.8.3.
> I issue this command on server one:
> sudo LIBVIRT_DEBUG=1 virsh migrate --live --copy-storage-all i00cn1011
> qemu+ssh://user@computer2/session > debug.log 2>&1

Based on IRC conversations, I'm assuming you already made sure that
computer2 already sees all the same disk image files, with the same
sizes, as are present on computer1 (the contents need not be identical,
since that is what --copy-storage-all is supposed to fix, but libvirt
currently does not pre-create the files on the destination and leaves
the user to do so instead - patches to fix that are welcome).

> On virt-manager on computer 1, the VM appears for a few moments as
> paused, and then disappears.
> On computer 1 I receive the error: Timed out during operation: cannot
> acquire state change lock

You said virsh 0.8.3 on the source, but I'd also like to make sure what
version of libvirtd is running on the two machines?  There are some
known bugs in older libvirt versions where we had bad locking calls; and
some of these bugs could be triggered by migration, such as if
virt-manager is querying domain status at the same time that migration
shuts down the source because the destination is ready to run.

You may want to upgrade to 0.9.9 (stable release) or 0.9.10-rc2 (release
candidate for next week's release) on both machines, to try and get bugs
that have been fixed in the meantime out of your way.  You can safely
upgrade libvirt even while your VM continues to run.

> Does anyone know what the problem may be and how to solve it?

At any rate, when older libvirtd hits the 'cannot acquire state change
lock' bug, the only solution is to restart libvirtd (again, a safe
operation; your guest will continue to run in the meantime).

I personally haven't played with --copy-storage-all, and know that it
doesn't get tested quite as much as shared storage, so I hope you can
get things working.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120209/6f61b994/attachment.sig>

More information about the libvirt-users mailing list