[PATCH libguestfs 0/4] Add a libvirt backend to libguestfs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This preliminary patch series adds a libvirt backend to libguestfs.
It's for review only because although it launches the guest OK, there
are some missing features that need to be implemented.

The meat of the patch is in part 4/4.

To save you the trouble of interpreting libxml2 fragments, an example
of the generated XML and the corresponding qemu command line are
attached below.  Note the hack required to work around lack of support
for '-drive [...]snapshot=on'

Some questions:

- I've tried to use the minimum set of XML possible to create the
  guest, leaving libvirt to fill out as much as possible.  How does
  this XML look?

- The <name> is mandatory, and I generate one randomly.  Is this a
  good idea?  I notice that my $HOME/.libvirt directory fills up with
  random files.  Really I'd like libvirt to generate a random name and
  just deal with the logfiles.

- How do we query libvirt to find out if qemu supports virtio-scsi?

- Will <source file> work if the source is a host device?

- Since when has <memory unit> attribute been available?  For example,
  is it available in RHEL 6?

- I'm using type="kvm" and I've only tested this on baremetal, but I
  don't want to force KVM.  If only software emulation is available,
  I'd like to use it.

- Is there an easy way to get -cpu host?  Although I have the libvirt
  capabilities, I'd prefer not to have to parse it if I can avoid
  that, since libxml2 from C is so arcane.

Comments:

- <source mode> attribute is undocumented.

Rich.

----------------------------------------------------------------------

<?xml version="1.0"?>
<domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0";>
  <name>1dhdpe3sb9ub2vxd</name>
  <memory unit="MiB">500</memory>
  <currentMemory unit="MiB">500</currentMemory>
  <vcpu>1</vcpu>
  <clock offset="utc"/>
  <os>
    <type>hvm</type>
    <kernel>/home/rjones/d/libguestfs/.guestfs-500/kernel.3198</kernel>
    <initrd>/home/rjones/d/libguestfs/.guestfs-500/initrd.3198</initrd>
    <cmdline>panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm </cmdline>
  </os>
  <devices>
    <controller type="scsi" index="0" model="virtio-scsi"/>
    <disk type="file" device="disk">
      <source file="/home/rjones/d/libguestfs/test1.img"/>
      <target dev="sda" bus="scsi"/>
      <driver name="qemu" format="raw" cache="none"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>
    <disk type="file" device="disk">
      <source file="/home/rjones/d/libguestfs/.guestfs-500/root.3198"/>
      <target dev="sdb" bus="scsi"/>
      <driver name="qemu" format="raw" cache="unsafe"/>
      <address type="drive" controller="0" bus="0" target="1" unit="0"/>
    </disk>
    <channel type="unix">
      <source mode="bind" path="/home/rjones/d/libguestfs/libguestfsSSg3Kl/guestfsd.sock"/>
      <target type="virtio" name="org.libguestfs.channel.0"/>
    </channel>
  </devices>
  <qemu:commandline>
    <qemu:arg value="-set"/>
    <qemu:arg value="drive.drive-scsi0-0-1-0.snapshot=on"/>
  </qemu:commandline>
</domain>

/usr/bin/qemu-kvm -S -M pc-1.1 -enable-kvm -m 500 -smp 1,sockets=1,cores=1,threads=1 -name 1dhdpe3sb9ub2vxd -uuid efcc8ab8-7193-da14-a72c-acbb82a1b975 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/home/rjones/.libvirt/qemu/lib/1dhdpe3sb9ub2vxd.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -no-acpi -kernel /home/rjones/d/libguestfs/.guestfs-500/kernel.3198 -initrd /home/rjones/d/libguestfs/.guestfs-500/initrd.3198 -append panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm  -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/home/rjones/d/libguestfs/test1.img,if=none,id=drive-scsi0-0-0-0,format=raw,cache=none -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=driv!
 e-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=/home/rjones/d/libguestfs/.guestfs-500/root.3198,if=none,id=drive-scsi0-0-1-0,format=raw,cache=unsafe -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=1,lun=0,drive=drive-scsi0-0-1-0,id=scsi0-0-1-0 -chardev socket,id=charchannel0,path=/home/rjones/d/libguestfs/libguestfsSSg3Kl/guestfsd.sock,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.libguestfs.channel.0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -set drive.drive-scsi0-0-1-0.snapshot=on

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux