Ken Coar
2012-Jan-25 23:34 UTC
[libvirt-users] Preventing 'virsh start' while doing backup?
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? Thanks! -- #ken B-)} Ken Coar, Sanagendamgagwedweinini IT Engineering Tower, Red Hat/RDU "Millennium hand and shrimp!"
Eric Blake
2012-Jan-25 23:41 UTC
[libvirt-users] Preventing 'virsh start' while doing backup?
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 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/20120125/7e6a6b9f/attachment.sig>