On 01/25/2012 04:34 PM, Ken Coar wrote:
Is there any way to interface with virsh to keep it from executing a
startup operation? Sort of like the /etc/nologin (man page nologin(5))
mechanism?
Basically, I want to be able to shut down a VM in order to copy its
disk images, and be reasonably assured that it won't be started
before I'm finished.
Is there any sort of hook or interlock file or other mechanism to
accomplish this?
Libvirt has startup hooks; if the hook fails, the domain won't be
started. So you could write a hook that checks if the domain about to
be started is on your black-list because you are in the middle of some
other operation on the disk image. You do have to restart libvirtd to
recognize a newly added hook, though.
http://libvirt.org/hooks.html
Libvirt also has the ability to interact with the sanlock file lock
manager; if you configure libvirt to use the lock manager, and then you
can independently take out a lease on a disk image, then you can lock
out libvirt from starting any domain with that image.
http://libvirt.org/locking.html
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org