[Libguestfs] [libguestfs/libguestfs] guestunmount should not return before the image can be used by other vm (#70)

Richard W.M. Jones rjones at redhat.com
Mon Aug 16 08:50:39 UTC 2021


On Wed, Aug 11, 2021 at 01:21:18AM -0700, braindevices wrote:
> If I understood correct, the libguestfs actually start a qemu vm under the
> hood. When I call guestunmount it unmounts the image then shutdown the vm.
> However, if I do this programmably, commonly it will fail due to the vm is
> still using the image:
> 
> guestmount -d guest1 mnt
> # do something with the image
> guestunmount mnt
> virsh start guest1
>
> I have to add sleep between guestunmount and other command. However,
> this time interval is not certain, it can be quite long at some
> time. So I propose to add some option to let the guestunmount only
> return after the qemu vm release the image. Is there any work around
> right now for this?

If the libvirt configuration uses cache=none, you could be hitting
this:

https://github.com/rwmjones/guestfs-tools/blob/9ba463545fa017910a5077434f87ae67e146c9e0/builder/builder.ml#L774

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list