Many thanks for your prompt and extensive reply, Richard!

Thanks much,

Maxim.

On Oct 2, 2017 12:22 PM, "Richard W.M. Jones" <rjones@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