Richard W.M. Jones
2017-Oct-02 09:22 UTC
[Libguestfs] relaunching libguestfs with the same overlay
On Mon, Oct 02, 2017 at 11:50:42AM +0300, Maxim Kozover wrote:> Hi Richard! > Could you tell me, please, if there is a way to relaunch libguestfs with > the same overlay from the last run? The documentation tells the overlay is > removed when the handle to libguestfs is closed.Right, the overlay is created by libguestfs itself and thrown away when the handle is closed: https://github.com/libguestfs/libguestfs/blob/master/lib/drives.c#L68 https://github.com/libguestfs/libguestfs/blob/master/lib/launch-direct.c#L78 However you can simply create your own overlay and use that. Run something like: qemu-img create -b orig_disk -f qcow2 my_overlay and change the guestfs_add_drive_opts call to use ?my_overlay? and don't use the readonly flag.> I'm talking about read-only mode so the real disks are not touched.The above won't touch the original disk, as long as you do _not_ run any commands such as ?qemu-img commit?. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Maxim Kozover
2017-Oct-02 09:27 UTC
[Libguestfs] relaunching libguestfs with the same overlay
Many thanks for your prompt and extensive reply, Richard! Thanks much, Maxim. On Oct 2, 2017 12:22 PM, "Richard W.M. Jones" <rjones at redhat.com> wrote:> On Mon, Oct 02, 2017 at 11:50:42AM +0300, Maxim Kozover wrote: > > Hi Richard! > > Could you tell me, please, if there is a way to relaunch libguestfs with > > the same overlay from the last run? The documentation tells the overlay > is > > removed when the handle to libguestfs is closed. > > Right, the overlay is created by libguestfs itself and thrown away > when the handle is closed: > > https://github.com/libguestfs/libguestfs/blob/master/lib/drives.c#L68 > https://github.com/libguestfs/libguestfs/blob/master/lib/ > launch-direct.c#L78 > > However you can simply create your own overlay and use that. Run > something like: > > qemu-img create -b orig_disk -f qcow2 my_overlay > > and change the guestfs_add_drive_opts call to use ?my_overlay? and > don't use the readonly flag. > > > I'm talking about read-only mode so the real disks are not touched. > > The above won't touch the original disk, as long as you do _not_ run > any commands such as ?qemu-img commit?. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~ > rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-p2v converts physical machines to virtual machines. Boot with a > live CD or over the network (PXE) and turn machines into KVM guests. > http://libguestfs.org/virt-v2v >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171002/27193ed3/attachment.htm>
Apparently Analagous Threads
- Re: a question about multithreading with libguestfs
- Re: a question about multithreading with libguestfs
- [Sanitizers] Platforms that don't support stack unwinding
- NOTE: Relaunching handles (don't do it!)
- Re: Fail in virDomainUpdateDeviceFlags (libvirt-4.0.0 + Qemu-kvm 2.9.0 + Ceph 10.2.10)