52
54
qemu+ssh://root@example.com/system (remote access, SSH tunnelled)
57
<h2><a name="imex">Import and export of libvirt domain XML configs</a></h2>
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
65
<h3><a name="xmlimport">Converting from QEMU args to domain XML</a></h3>
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.
73
<pre>$ cat > demo.args <<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 \
80
$ virsh domxml-from-native qemu-argv demo.args
81
<domain type='qemu'>
82
<uuid>00000000-0000-0000-0000-000000000000</uuid>
83
<memory>219136</memory>
84
<currentMemory>219136</currentMemory>
85
<vcpu>1</vcpu>
87
<type arch='i686' machine='pc'>hvm</type>
88
<boot dev='hd'/>
90
<clock offset='utc'/>
91
<on_poweroff>destroy</on_poweroff>
92
<on_reboot>restart</on_reboot>
93
<on_crash>destroy</on_crash>
95
<emulator>/usr/bin/qemu</emulator>
96
<disk type='block' device='disk'>
97
<source dev='/dev/HostVG/QEMUGuest1'/>
98
<target dev='hda' bus='ide'/>
104
<p>NB, don't include the literral \ in the args, put everything on one line</p>
106
<h3><a name="xmlexport">Converting from domain XML to QEMU args</a></h3>
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.
114
<pre>$ cat > demo.xml <<EOF
115
<domain type='qemu'>
116
<name>QEMUGuest1</name>
117
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
118
<memory>219200</memory>
119
<currentMemory>219200</currentMemory>
120
<vcpu>1</vcpu>
122
<type arch='i686' machine='pc'>hvm</type>
123
<boot dev='hd'/>
125
<clock offset='utc'/>
126
<on_poweroff>destroy</on_poweroff>
127
<on_reboot>restart</on_reboot>
128
<on_crash>destroy</on_crash>
130
<emulator>/usr/bin/qemu</emulator>
131
<disk type='block' device='disk'>
132
<source dev='/dev/HostVG/QEMUGuest1'/>
133
<target dev='hda' bus='ide'/>
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
55
147
<h2><a name="xmlconfig">Example domain XML config</a></h2>
57
149
<h3>QEMU emulated guest on x86_64</h3>