[Libvir] [QEMU 0/3] QEMU support for libvirt

Daniel P. Berrange berrange at redhat.com
Sun Aug 27 23:14:51 UTC 2006


The following series of patches add support for QEMU to libvirt. The
patches are:

 - libvirt-drivers-qemu.patch - hook up methods for inactive domains
 - libvirt-virsh-qemu.patch - hook up inactive domain methods to virsh
 - libvirt-backend-qemu.patch - the main QEMU backend

The patches will be explained further in each email which follows.

NB, the first two patches are ready for inclusion, but the last one needs
more error handling, and another audit of the networking code to check 
in particular buffer sizes.

For testing I used Damn Small Linux, and QEMU 0.8.1 from Fedora Core 5
(the one with VNC support)

  wget http://distro.ibiblio.org/pub/linux/distributions/damnsmall/current/dsl-3.0.1.iso

Here is a suitable config file:

<domain type='qemu'>
  <name>dsl</name>
  <uuid>fff64701-45b9-11cb-88e3-afbfe5370493</uuid>
  <memory>131072</memory>
  <vcpu>20</vcpu>
  <devices>
    <disk type='file' device='cdrom'>
      <source file='/home/berrange/dsl-3.0.1.iso'/>
      <target dev='hdc'/>
    </disk>
    <graphics type='vnc' port='5906'/>
  </devices>
</domain>

An example session with virsh:

[berrange at aubergine ~]$ export VIRSH_DEFAULT_CONNECT_URI=qemu:///session
[berrange at aubergine ~]$ virsh list
 Id Name                 State
----------------------------------

[berrange at aubergine ~]$ virsh define $HOME/dsl.xml 
Domain dsl defined from /home/berrange/dsl.xml

[berrange at aubergine ~]$ virsh list --all
 Id Name                 State
----------------------------------
 -1 dsl                  shut off

[berrange at aubergine ~]$ virsh dominfo dsl
Id:             -1
Name:           dsl
UUID:           fff64701-45b9-11cb-88e3-afbfe5370493
OS Type:        linux
State:          shut off
CPU(s):         20
Max memory:     131072 kB
Used memory:    131072 kB

[berrange at aubergine ~]$ virsh start dsl
Domain dsl started

[berrange at aubergine ~]$ virsh list --all
 Id Name                 State
----------------------------------
  1 dsl                  running 

[berrange at aubergine ~]$ virsh dumpxml dsl
<domain type='qemu' id='1'>
  <name>dsl</name>
  <uuid>fff64701-45b9-11cb-88e3-afbfe5370493</uuid>
  <memory>131072</memory>
  <vcpu>20</vcpu>
  <devices>
    <disk type='file' device='cdrom'>
      <source file='/home/berrange/dsl-3.0.1.iso'/>
      <target dev='hdc'/>
      <readonly/>
    </disk>
    <graphics type='vnc' port='5906'/>
  </devices>
</domain>

[berrange at aubergine ~]$ virsh destroy dsl
Domain dsl destroyed

[berrange at aubergine ~]$ virsh list --all
 Id Name                 State
----------------------------------
 -1 dsl                  shut off


I'm also happy to report that it is also possible to use virt-manager
with the QEMU support - just enter qemu:///session as the URI. That
said you can't use the VM creation wizard, but it should be easy to
hook that up. The fact that virt-manager works without modification
is a really great proof of the value of libvirt abstract driver backend
API concept - validating the decision not to make a Xen specific API. 

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list