~ubuntu-branches/ubuntu/maverick/libvirt/maverick

« back to all changes in this revision

Viewing changes to docs/drvqemu.html.in

Tags: upstream-0.6.4
Import upstream version 0.6.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
  <body>
3
3
    <h1>QEMU/KVM hypervisor driver</h1>
4
4
 
 
5
    <ul id="toc"></ul>
 
6
 
5
7
    <p>
6
8
      The libvirt QEMU driver can manage any QEMU emulator from version 0.8.1
7
9
      or later. It can also manage anything that provides the same QEMU command
8
10
      line syntax and monitor interaction. This includes KVM, and Xenner.
9
11
    </p>
10
12
 
11
 
    <h2>Deployment pre-requisites</h2>
 
13
    <h2><a name="prereq">Deployment pre-requisites</a></h2>
12
14
 
13
15
    <ul>
14
16
      <li>
32
34
      </li>
33
35
    </ul>
34
36
 
35
 
    <h2>Connections to QEMU driver</h2>
 
37
    <h2><a name="uris">Connections to QEMU driver</a></h2>
36
38
 
37
39
    <p>
38
40
    The libvirt QEMU driver is a multi-instance driver, providing a single
52
54
    qemu+ssh://root@example.com/system   (remote access, SSH tunnelled)
53
55
    </pre>
54
56
 
 
57
    <h2><a name="imex">Import and export of libvirt domain XML configs</a></h2>
 
58
 
 
59
    <p>The QEMU driver currently supports a single native
 
60
      config format known as <code>qemu-argv</code>. The data for this format
 
61
      is expected to be a single line first a list of environment variables,
 
62
      then the QEMu binary name, finally followed by the QEMU command line
 
63
      arguments</p>
 
64
 
 
65
    <h3><a name="xmlimport">Converting from QEMU args to domain XML</a></h3>
 
66
 
 
67
    <p>
 
68
      The <code>virsh domxml-from-native</code> provides a way to convert an
 
69
      existing set of QEMU args into a guest description using libvirt Domain XML
 
70
      that can then be used by libvirt.
 
71
    </p>
 
72
 
 
73
    <pre>$ cat &gt; demo.args &lt;&lt;EOF
 
74
LC_ALL=C PATH=/bin HOME=/home/test USER=test \
 
75
LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 \
 
76
-nographic -monitor pty -no-acpi -boot c -hda \
 
77
/dev/HostVG/QEMUGuest1 -net none -serial none \
 
78
-parallel none -usb
 
79
EOF
 
80
$ virsh domxml-from-native qemu-argv demo.args
 
81
&lt;domain type='qemu'&gt;
 
82
  &lt;uuid&gt;00000000-0000-0000-0000-000000000000&lt;/uuid&gt;
 
83
  &lt;memory&gt;219136&lt;/memory&gt;
 
84
  &lt;currentMemory&gt;219136&lt;/currentMemory&gt;
 
85
  &lt;vcpu&gt;1&lt;/vcpu&gt;
 
86
  &lt;os&gt;
 
87
    &lt;type arch='i686' machine='pc'&gt;hvm&lt;/type&gt;
 
88
    &lt;boot dev='hd'/&gt;
 
89
  &lt;/os&gt;
 
90
  &lt;clock offset='utc'/&gt;
 
91
  &lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
 
92
  &lt;on_reboot&gt;restart&lt;/on_reboot&gt;
 
93
  &lt;on_crash&gt;destroy&lt;/on_crash&gt;
 
94
  &lt;devices&gt;
 
95
    &lt;emulator&gt;/usr/bin/qemu&lt;/emulator&gt;
 
96
    &lt;disk type='block' device='disk'&gt;
 
97
      &lt;source dev='/dev/HostVG/QEMUGuest1'/&gt;
 
98
      &lt;target dev='hda' bus='ide'/&gt;
 
99
    &lt;/disk&gt;
 
100
  &lt;/devices&gt;
 
101
&lt;/domain&gt;
 
102
    </pre>
 
103
 
 
104
    <p>NB, don't include the literral \ in the args, put everything on one line</p>
 
105
 
 
106
    <h3><a name="xmlexport">Converting from domain XML to QEMU args</a></h3>
 
107
 
 
108
    <p>
 
109
      The <code>virsh domxml-to-native</code> provides a way to convert a
 
110
      guest description using libvirt Domain XML, into a set of QEMU args
 
111
      that can be run manually.
 
112
    </p>
 
113
 
 
114
    <pre>$ cat &gt; demo.xml &lt;&lt;EOF
 
115
&lt;domain type='qemu'&gt;
 
116
  &lt;name&gt;QEMUGuest1&lt;/name&gt;
 
117
  &lt;uuid&gt;c7a5fdbd-edaf-9455-926a-d65c16db1809&lt;/uuid&gt;
 
118
  &lt;memory&gt;219200&lt;/memory&gt;
 
119
  &lt;currentMemory&gt;219200&lt;/currentMemory&gt;
 
120
  &lt;vcpu&gt;1&lt;/vcpu&gt;
 
121
  &lt;os&gt;
 
122
    &lt;type arch='i686' machine='pc'&gt;hvm&lt;/type&gt;
 
123
    &lt;boot dev='hd'/&gt;
 
124
  &lt;/os&gt;
 
125
  &lt;clock offset='utc'/&gt;
 
126
  &lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
 
127
  &lt;on_reboot&gt;restart&lt;/on_reboot&gt;
 
128
  &lt;on_crash&gt;destroy&lt;/on_crash&gt;
 
129
  &lt;devices&gt;
 
130
    &lt;emulator&gt;/usr/bin/qemu&lt;/emulator&gt;
 
131
    &lt;disk type='block' device='disk'&gt;
 
132
      &lt;source dev='/dev/HostVG/QEMUGuest1'/&gt;
 
133
      &lt;target dev='hda' bus='ide'/&gt;
 
134
    &lt;/disk&gt;
 
135
  &lt;/devices&gt;
 
136
&lt;/domain&gt;
 
137
EOF
 
138
$ virsh domxml-to-native qemu-argv demo.xml
 
139
  LC_ALL=C PATH=/usr/bin:/bin HOME=/home/test \
 
140
  USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
 
141
  -no-kqemu -m 214 -smp 1 -name QEMUGuest1 -nographic \
 
142
  -monitor pty -no-acpi -boot c -drive \
 
143
  file=/dev/HostVG/QEMUGuest1,if=ide,index=0 -net none \
 
144
  -serial none -parallel none -usb
 
145
    </pre>
 
146
 
55
147
    <h2><a name="xmlconfig">Example domain XML config</a></h2>
56
148
 
57
149
    <h3>QEMU emulated guest on x86_64</h3>