[Libguestfs] [PATCH 0/3] RFC: Allow use of external QEMU process with libguestfs

Daniel P. Berrange berrange at redhat.com
Mon Jul 5 16:25:58 UTC 2010


This attempts to implement the idea proposed in

  https://www.redhat.com/archives/libguestfs/2010-April/msg00087.html

The idea is that an externally managed QEMU (manual, or via libvirt)
can boot the appliance kernel/initrd. libguestfs can then be just told
of the UNIX domain socket associated with the guest daemon.

An example based on guestfish.

 1. Step one, find the appliance kernel/initrd (building the supermin
    appliance image if neccessary)

   ><fs> find-appliance 
   ><fs> get-kernel 
   /tmp/libguestfsqJB1iN/kernel
   ><fs> get-initrd 
   /tmp/libguestfsqJB1iN/initrd

 2. Boot a QEMU instance with this info

    /usr/libexec/qemu-kvm 
      -drive file=/dev/HostVG/f11i386,cache=off,if=virtio 
      -enable-kvm -nodefaults -nographic 
      -serial file:/tmp/guest/boot.log -monitor stdio 
      -m 500 -no-reboot 
      -chardev socket,id=guestfsvmc,path=/tmp/guest/sock,server,nowait 
      -net user,vlan=0,net=169.254.0.0/16,guestfwd=tcp:169.254.2.4:6666-chardev:guestfsvmc
      -net nic,model=virtio,vlan=0 
      -append 'panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_vmchannel=tcp:169.254.2.4:6666  TERM=xterm'
      -kernel /tmp/libguestfsqJB1iN/kernel
      -initrd /tmp/libguestfsqJB1iN/initrd

 3. Tell guestfish to connect to this instance

   ><fs> launch-method attach
   ><fs> sockpath /tmp/guest/sock
   ><fs> launch


The temporary kernel/initrd from 'find-appliance' will be
automatically deleted when the guestfs handle is closed.

Instead of using 'find-appliance' an app can manually invoke
the febootstrap-supermin-helper to build the initrd/kernel
but is a fragile coupling to libguestfs internals. Thus it is
preferable to let libguestfs locate & inform you of the kernl
and initrd




More information about the Libguestfs mailing list