[libvirt] [PATCH] docs: Emphasize that devices have to be inside the <devices> element
by Matthias Bolte
Also cleanup indentation of domain XML examples.
---
docs/drvxen.html.in | 12 +-
docs/formatdomain.html.in | 776 +++++++++++++++++++++++++--------------------
2 files changed, 430 insertions(+), 358 deletions(-)
diff --git a/docs/drvxen.html.in b/docs/drvxen.html.in
index a6f0e57..4e35afa 100644
--- a/docs/drvxen.html.in
+++ b/docs/drvxen.html.in
@@ -234,9 +234,9 @@ vif = [ "mac=00:16:3e:60:36:ba,bridge=virbr0,script=vif-bridge,vifname=vif5.0" ]
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
- <pae/>
- <acpi/>
- <apic/>
+ <pae/>
+ <acpi/>
+ <apic/>
</features>
<clock sync="localtime"/>
<devices>
@@ -288,9 +288,9 @@ vif = [ "mac=00:16:3e:60:36:ba,bridge=virbr0,script=vif-bridge,vifname=vif5.0" ]
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
- <pae/>
- <acpi/>
- <apic/>
+ <pae/>
+ <acpi/>
+ <apic/>
</features>
<clock sync="localtime"/>
<devices>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ce49f7d..083a80a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -28,11 +28,11 @@
<h3><a name="elementsMetadata">General metadata</a></h3>
- <pre>
- <domain type='xen' id='3'>
- <name>fv0</name>
- <uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid>
- ...</pre>
+<pre>
+<domain type='xen' id='3'>
+ <name>fv0</name>
+ <uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid>
+ ...</pre>
<dl>
<dt><code>name</code></dt>
@@ -66,14 +66,14 @@
to obtain/find the boot image.
</p>
- <pre>
- ...
- <os>
- <type>hvm</type>
- <loader>/usr/lib/xen/boot/hvmloader</loader>
- <boot dev='hd'/>
- </os>
- ...</pre>
+<pre>
+ ...
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ ...</pre>
<dl>
<dt><code>type</code></dt>
@@ -109,11 +109,11 @@
An example is <code>pygrub</code> with Xen.
</p>
- <pre>
- ...
- <bootloader>/usr/bin/pygrub</bootloader>
- <bootloader_args>--append single</bootloader_args>
- ...</pre>
+<pre>
+ ...
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <bootloader_args>--append single</bootloader_args>
+ ...</pre>
<dl>
<dt><code>bootloader</code></dt>
@@ -139,16 +139,16 @@
is usually available for both para and full virtualized guests.
</p>
- <pre>
- ...
- <os>
- <type>hvm</type>
- <loader>/usr/lib/xen/boot/hvmloader</loader>
- <kernel>/root/f8-i386-vmlinuz</kernel>
- <initrd>/root/f8-i386-initrd</initrd>
- <cmdline>console=ttyS0 ks=http://example.com/f8-i386/os/</cmdline>
- </os>
- ...</pre>
+<pre>
+ ...
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <kernel>/root/f8-i386-vmlinuz</kernel>
+ <initrd>/root/f8-i386-initrd</initrd>
+ <cmdline>console=ttyS0 ks=http://example.com/f8-i386/os/</cmdline>
+ </os>
+ ...</pre>
<dl>
<dt><code>type</code></dt>
@@ -172,15 +172,15 @@
<h3><a name="elementsResources">Basic resources</a></h3>
- <pre>
- ...
- <memory>524288</memory>
- <currentMemory>524288</currentMemory>
- <memoryBacking>
- <hugepages/>
- </memoryBacking>
- <vcpu>1</vcpu>
- ...</pre>
+<pre>
+ ...
+ <memory>524288</memory>
+ <currentMemory>524288</currentMemory>
+ <memoryBacking>
+ <hugepages/>
+ </memoryBacking>
+ <vcpu>1</vcpu>
+ ...</pre>
<dl>
<dt><code>memory</code></dt>
@@ -209,14 +209,14 @@
<span class="since">Since 0.7.5</span>
</p>
- <pre>
- ...
- <cpu match='exact'>
- <model>core2duo</model>
- <topology sockets='1' cores='2' threads='1'/>
- <feature policy='disable' name='lahf_lm'/>
- </cpu>
- ...</pre>
+<pre>
+ ...
+ <cpu match='exact'>
+ <model>core2duo</model>
+ <topology sockets='1' cores='2' threads='1'/>
+ <feature policy='disable' name='lahf_lm'/>
+ </cpu>
+ ...</pre>
<p>
In case no restrictions need to be put on CPU model and its features, a
@@ -224,12 +224,12 @@
<span class="since">Since 0.7.6</span>
</p>
- <pre>
- ...
- <cpu>
- <topology sockets='1' cores='2' threads='1'/>
- </cpu>
- ...</pre>
+<pre>
+ ...
+ <cpu>
+ <topology sockets='1' cores='2' threads='1'/>
+ </cpu>
+ ...</pre>
<dl>
<dt><code>cpu</code></dt>
@@ -305,12 +305,12 @@
re-configured for the first post-install bootup.
</p>
- <pre>
- ...
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- ...</pre>
+<pre>
+ ...
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ ...</pre>
<dl>
<dt><code>on_poweroff</code></dt>
@@ -350,14 +350,14 @@
toggled on/off.
</p>
- <pre>
- ...
- <features>
- <pae/>
- <acpi/>
- <apic/>
- </features>
- ...</pre>
+<pre>
+ ...
+ <features>
+ <pae/>
+ <acpi/>
+ <apic/>
+ </features>
+ ...</pre>
<p>
All features are listed within the <code>features</code>
@@ -386,10 +386,10 @@
it to be in so called 'localtime'.
</p>
- <pre>
- ...
- <clock offset="localtime"/>
- ...</pre>
+<pre>
+ ...
+ <clock offset="localtime"/>
+ ...</pre>
<dl>
<dt><code>clock</code></dt>
@@ -408,11 +408,12 @@
<span class="since">Since 0.1.3</span>
</p>
- <pre>
- ...
- <devices>
- <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ </devices>
+ ...</pre>
<dl>
<dt><code>emulator</code></dt>
@@ -433,18 +434,20 @@
element.
</p>
- <pre>
- ...
- <disk type='file'>
- <driver name="tap" type="aio" cache="default">
- <source file='/var/lib/xen/images/fv0'/>
- <target dev='hda' bus='ide'/>
- <encryption type='...'>
- ...
- </encryption>
- <shareable/>
- </disk>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <disk type='file'>
+ <driver name="tap" type="aio" cache="default">
+ <source file='/var/lib/xen/images/fv0'/>
+ <target dev='hda' bus='ide'/>
+ <encryption type='...'>
+ ...
+ </encryption>
+ <shareable/>
+ </disk>
+ </devices>
+ ...</pre>
<dl>
<dt><code>disk</code></dt>
@@ -500,24 +503,30 @@
0.4.4 for USB and 0.6.0 for PCI (KVM only)</span>:
</p>
- <pre>
- ...
- <hostdev mode='subsystem' type='usb'>
- <source>
- <vendor id='0x1234'/>
- <product id='0xbeef'/>
- </source>
- </hostdev>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <hostdev mode='subsystem' type='usb'>
+ <source>
+ <vendor id='0x1234'/>
+ <product id='0xbeef'/>
+ </source>
+ </hostdev>
+ </devices>
+ ...</pre>
+
<p>or:</p>
- <pre>
- ...
- <hostdev mode='subsystem' type='pci'>
- <source>
- <address bus='0x06' slot='0x02' function='0x0'/>
- </source>
- </hostdev>
- ...</pre>
+
+<pre>
+ ...
+ <devices>
+ <hostdev mode='subsystem' type='pci'>
+ <source>
+ <address bus='0x06' slot='0x02' function='0x0'/>
+ </source>
+ </hostdev>
+ </devices>
+ ...</pre>
<dl>
<dt><code>hostdev</code></dt>
@@ -556,14 +565,16 @@
<h4><a name="elementsNICS">Network interfaces</a></h4>
- <pre>
- ...
- <interface type='bridge'>
- <source bridge='xenbr0'/>
- <mac address='00:16:3e:5d:c7:9e'/>
- <script path='vif-bridge'/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='00:16:3e:5d:c7:9e'/>
+ <script path='vif-bridge'/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSVirtual">Virtual network</a></h5>
@@ -589,18 +600,20 @@
<a href="#elementsNICSTargetOverride">overriding the target element</a>).
</p>
- <pre>
- ...
- <interface type='network'>
- <source network='default'/>
- </interface>
- ...
- <interface type='network'>
- <source network='default'/>
- <target dev='vnet7'/>
- <mac address="11:22:33:44:55:66"/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='network'>
+ <source network='default'/>
+ </interface>
+ ...
+ <interface type='network'>
+ <source network='default'/>
+ <target dev='vnet7'/>
+ <mac address="11:22:33:44:55:66"/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSBridge">Bridge to LAN</a></h5>
@@ -623,18 +636,20 @@
full incoming & outgoing net access just like a physical machine.
</p>
- <pre>
- ...
- <interface type='bridge'>
- <source bridge='br0'/>
- </interface>
-
- <interface type='bridge'>
- <source bridge='br0'/>
- <target dev='vnet7'/>
- <mac address="11:22:33:44:55:66"/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='bridge'>
+ <source bridge='br0'/>
+ </interface>
+ ...
+ <interface type='bridge'>
+ <source bridge='br0'/>
+ <target dev='vnet7'/>
+ <mac address="11:22:33:44:55:66"/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSSlirp">Userspace SLIRP stack</a></h5>
@@ -647,14 +662,16 @@
VMs to have outgoing access.
</p>
- <pre>
- ...
- <interface type='user'/>
- ...
- <interface type='user'>
- <mac address="11:22:33:44:55:66"/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='user'/>
+ ...
+ <interface type='user'>
+ <mac address="11:22:33:44:55:66"/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSEthernet">Generic ethernet connection</a></h5>
@@ -669,15 +686,17 @@
overridden.
</p>
- <pre>
- ...
- <interface type='ethernet'/>
- ...
- <interface type='ethernet'>
- <target dev='vnet7'/>
- <script path='/etc/qemu-ifup-mynet'/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='ethernet'/>
+ ...
+ <interface type='ethernet'>
+ <target dev='vnet7'/>
+ <script path='/etc/qemu-ifup-mynet'/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSMulticast">Multicast tunnel</a></h5>
@@ -693,12 +712,14 @@
multicast address block.
</p>
- <pre>
- ...
- <interface type='mcast'>
- <source address='230.0.0.1' port='5558'/>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='mcast'>
+ <source address='230.0.0.1' port='5558'/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSTCP">TCP tunnel</a></h5>
@@ -711,27 +732,31 @@
network access, one of the VMs should have a 2nd NIC which is connected
to one of the first 4 network types and do the appropriate routing.</p>
- <pre>
- ...
- <interface type='server'>
- <source address='192.168.0.1' port='5558'/>
- </interface>
- ...
- <interface type='client'>
+<pre>
+ ...
+ <devices>
+ <interface type='server'>
<source address='192.168.0.1' port='5558'/>
- </interface>
- ...</pre>
+ </interface>
+ ...
+ <interface type='client'>
+ <source address='192.168.0.1' port='5558'/>
+ </interface>
+ </devices>
+ ...</pre>
<h5><a name="elementsNICSModel">Setting the NIC model</a></h5>
- <pre>
- ...
- <interface type='network'>
- <source network='default'/>
- <target dev='vnet1'/>
- <b><model type='ne2k_pci'/></b>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='network'>
+ <source network='default'/>
+ <target dev='vnet1'/>
+ <b><model type='ne2k_pci'/></b>
+ </interface>
+ </devices>
+ ...</pre>
<p>
For hypervisors which support this, you can set the model of
@@ -757,13 +782,15 @@ qemu-kvm -net nic,model=? /dev/null
<h5><a name="elementsNICSTargetOverride">Overriding the target element</a></h5>
- <pre>
- ...
- <interface type='network'>
- <source network='default'/>
- <b><target dev='vnet1'/></b>
- </interface>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <interface type='network'>
+ <source network='default'/>
+ <b><target dev='vnet1'/></b>
+ </interface>
+ </devices>
+ ...</pre>
<p>
If no target is specified, certain hypervisors will automatically
@@ -783,10 +810,12 @@ qemu-kvm -net nic,model=? /dev/null
to provide a graphics tablet for absolute cursor movement.
</p>
- <pre>
- ...
- <input type='mouse' bus='usb'/>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <input type='mouse' bus='usb'/>
+ </devices>
+ ...</pre>
<dl>
<dt><code>input</code></dt>
@@ -807,13 +836,15 @@ qemu-kvm -net nic,model=? /dev/null
admin.
</p>
- <pre>
- ...
- <graphics type='sdl' display=':0.0'/>
- <graphics type='vnc' port='5904'/>
- <graphics type='rdp' autoport='yes' multiUser='yes' />
- <graphics type='desktop' fullscreen='yes'/>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <graphics type='sdl' display=':0.0'/>
+ <graphics type='vnc' port='5904'/>
+ <graphics type='rdp' autoport='yes' multiUser='yes' />
+ <graphics type='desktop' fullscreen='yes'/>
+ </devices>
+ ...</pre>
<dl>
<dt><code>graphics</code></dt>
@@ -867,14 +898,16 @@ qemu-kvm -net nic,model=? /dev/null
A video device.
</p>
- <pre>
- ...
- <video>
- <model type='vga' vram='8192' heads='1'>
- <acceleration accel3d='yes' accel3d='yes'/>
- </model>
- </video>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <video>
+ <model type='vga' vram='8192' heads='1'>
+ <acceleration accel3d='yes' accel3d='yes'/>
+ </model>
+ </video>
+ </devices>
+ ...</pre>
<dl>
<dt><code>video</code></dt>
@@ -907,26 +940,27 @@ qemu-kvm -net nic,model=? /dev/null
all classed as character devices and so represented using the same syntax.
</p>
- <pre>
- ...
- <parallel type='pty'>
- <source path='/dev/pts/2'/>
- <target port='0'/>
- </parallel>
- <serial type='pty'>
- <source path='/dev/pts/3'/>
- <target port='0'/>
- </serial>
- <console type='pty'>
- <source path='/dev/pts/4'/>
- <target port='0'/>
- </console>
- <channel type='unix'>
- <source mode='bind' path='/tmp/guestfwd'/>
- <target type='guestfwd' address='10.0.2.1' port='4600'/>
- </channel>
- </devices>
- </domain></pre>
+<pre>
+ ...
+ <devices>
+ <parallel type='pty'>
+ <source path='/dev/pts/2'/>
+ <target port='0'/>
+ </parallel>
+ <serial type='pty'>
+ <source path='/dev/pts/3'/>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <source path='/dev/pts/4'/>
+ <target port='0'/>
+ </console>
+ <channel type='unix'>
+ <source mode='bind' path='/tmp/guestfwd'/>
+ <target type='guestfwd' address='10.0.2.1' port='4600'/>
+ </channel>
+ </devices>
+ ...</pre>
<p>
In each of these directives, the top-level element name (parallel, serial,
@@ -949,13 +983,15 @@ qemu-kvm -net nic,model=? /dev/null
<h6><a name="elementCharParallel">Parallel port</a></h6>
- <pre>
- ...
- <parallel type='pty'>
- <source path='/dev/pts/2'/>
- <target port='0'/>
- </parallel>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <parallel type='pty'>
+ <source path='/dev/pts/2'/>
+ <target port='0'/>
+ </parallel>
+ </devices>
+ ...</pre>
<p>
<code>target</code> can have a <code>port</code> attribute, which
@@ -965,13 +1001,15 @@ qemu-kvm -net nic,model=? /dev/null
<h6><a name="elementCharSerial">Serial port</a></h6>
- <pre>
- ...
- <serial type='pty'>
- <source path='/dev/pts/3'/>
- <target port='0'/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type='pty'>
+ <source path='/dev/pts/3'/>
+ <target port='0'/>
+ </serial>
+ </devices>
+ ...</pre>
<p>
<code>target</code> can have a <code>port</code> attribute, which
@@ -987,13 +1025,15 @@ qemu-kvm -net nic,model=? /dev/null
virtualized guests without a paravirtualized console.
</p>
- <pre>
- ...
- <console type='pty'>
- <source path='/dev/pts/4'/>
- <target port='0'/>
- </console>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <console type='pty'>
+ <source path='/dev/pts/4'/>
+ <target port='0'/>
+ </console>
+ </devices>
+ ...</pre>
<p>
If the console is presented as a serial port, the <code>target</code>
@@ -1008,13 +1048,15 @@ qemu-kvm -net nic,model=? /dev/null
guest.
</p>
- <pre>
- ...
- <channel type='unix'>
- <source mode='bind' path='/tmp/guestfwd'/>
- <target type='guestfwd' address='10.0.2.1' port='4600'/>
- </channel>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <channel type='unix'>
+ <source mode='bind' path='/tmp/guestfwd'/>
+ <target type='guestfwd' address='10.0.2.1' port='4600'/>
+ </channel>
+ </devices>
+ ...</pre>
<p>
This can be implemented in a variety of ways. The specific type of
@@ -1045,12 +1087,14 @@ qemu-kvm -net nic,model=? /dev/null
into the virtual machine's logfile
</p>
- <pre>
- ...
- <console type='stdio'>
- <target port='1'>
- </console>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <console type='stdio'>
+ <target port='1'>
+ </console>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharFle">Device logfile</a></h6>
@@ -1060,13 +1104,15 @@ qemu-kvm -net nic,model=? /dev/null
device is written to the file.
</p>
- <pre>
- ...
- <serial type="file">
- <source path="/var/log/vm/vm-serial.log"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="file">
+ <source path="/var/log/vm/vm-serial.log"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharVC">Virtual console</a></h6>
@@ -1076,12 +1122,14 @@ qemu-kvm -net nic,model=? /dev/null
hotkey sequence such as "ctrl+alt+3"
</p>
- <pre>
- ...
- <serial type='vc'>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type='vc'>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharNull">Null device</a></h6>
@@ -1090,12 +1138,14 @@ qemu-kvm -net nic,model=? /dev/null
provided to the input. All data written is discarded.
</p>
- <pre>
- ...
- <serial type='null'>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type='null'>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharPTY">Pseudo TTY</a></h6>
@@ -1105,13 +1155,15 @@ qemu-kvm -net nic,model=? /dev/null
serial port locally.
</p>
- <pre>
- ...
- <serial type="pty">
- <source path="/dev/pts/3"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="pty">
+ <source path="/dev/pts/3"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<p>
NB special case if <console type='pty'>, then the TTY
@@ -1130,13 +1182,15 @@ qemu-kvm -net nic,model=? /dev/null
port.
</p>
- <pre>
- ...
- <serial type="dev">
- <source path="/dev/ttyS0"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="dev">
+ <source path="/dev/ttyS0"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharPipe">Named pipe</a></h6>
@@ -1145,13 +1199,15 @@ qemu-kvm -net nic,model=? /dev/null
more info.
</p>
- <pre>
- ...
- <serial type="pipe">
- <source path="/tmp/mypipe"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="pipe">
+ <source path="/tmp/mypipe"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharTCP">TCP client/server</a></h6>
@@ -1160,46 +1216,52 @@ qemu-kvm -net nic,model=? /dev/null
remote server.
</p>
- <pre>
- ...
- <serial type="tcp">
- <source mode="connect" host="0.0.0.0" service="2445"/>
- <protocol type="raw"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="tcp">
+ <source mode="connect" host="0.0.0.0" service="2445"/>
+ <protocol type="raw"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<p>
Or as a TCP server waiting for a client connection.
</p>
- <pre>
- ...
- <serial type="tcp">
- <source mode="bind" host="127.0.0.1" service="2445"/>
- <protocol type="raw"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="tcp">
+ <source mode="bind" host="127.0.0.1" service="2445"/>
+ <protocol type="raw"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<p>
Alternatively you can use telnet instead of raw TCP.
<p>
- <pre>
- ...
- <serial type="tcp">
- <source mode="connect" host="0.0.0.0" service="2445"/>
- <protocol type="telnet"/>
- <target port="1"/>
- </serial>
- ...
- <serial type="tcp">
- <source mode="bind" host="127.0.0.1" service="2445"/>
- <protocol type="telnet"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="tcp">
+ <source mode="connect" host="0.0.0.0" service="2445"/>
+ <protocol type="telnet"/>
+ <target port="1"/>
+ </serial>
+ ...
+ <serial type="tcp">
+ <source mode="bind" host="127.0.0.1" service="2445"/>
+ <protocol type="telnet"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharUDP">UDP network console</a></h6>
@@ -1208,14 +1270,16 @@ qemu-kvm -net nic,model=? /dev/null
sending and receiving packets. This is a lossy service.
</p>
- <pre>
- ...
- <serial type="udp">
- <source mode="bind" host="0.0.0.0" service="2445"/>
- <source mode="connect" host="0.0.0.0" service="2445"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="udp">
+ <source mode="bind" host="0.0.0.0" service="2445"/>
+ <source mode="connect" host="0.0.0.0" service="2445"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h6><a name="elementsCharUNIX">UNIX domain socket client/server</a></h6>
@@ -1224,13 +1288,15 @@ qemu-kvm -net nic,model=? /dev/null
accepting connections from local clients.
</p>
- <pre>
- ...
- <serial type="unix">
- <source mode="bind" path="/tmp/foo"/>
- <target port="1"/>
- </serial>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <serial type="unix">
+ <source mode="bind" path="/tmp/foo"/>
+ <target port="1"/>
+ </serial>
+ </devices>
+ ...</pre>
<h4><a name="elementsSound">Sound devices</a></h4>
@@ -1240,10 +1306,12 @@ qemu-kvm -net nic,model=? /dev/null
<code>sound</code> element. <span class="since">Since 0.4.3</span>
</p>
- <pre>
- ...
- <sound model='es1370'/>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <sound model='es1370'/>
+ </devices>
+ ...</pre>
<dl>
<dt><code>sound</code></dt>
@@ -1276,15 +1344,19 @@ qemu-kvm -net nic,model=? /dev/null
libvirt.
</p>
- <pre>
- ...
- <watchdog model='i6300esb'/>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <watchdog model='i6300esb'/>
+ </devices>
+ ...</pre>
- <pre>
- ...
- <watchdog model='i6300esb' action='poweroff'/>
- ...</pre>
+<pre>
+ ...
+ <devices>
+ <watchdog model='i6300esb' action='poweroff'/>
+ </devices>
+</domain></pre>
<dl>
<dt><code>model</code></dt>
--
1.6.3.3
14 years, 9 months
[libvirt] [PATCH 0/9] Progress monitoring & cancellation of jobs
by Daniel P. Berrange
This series introduces 2 new APIs to allow long running jobs to
be monitored and cancelled. This applies to virDomainMigrate,
virDomainSave, virDomainRestore and virDomainCoreDump at least.
The implementation is provided for QEMU only, any others that
are able to implementation can do so as desired.
Usefulness of these new APIs requires use of multiple threads on
a single connection, or multiple connections, since the main
API calls are still all fully blocking. Instead a parallel thread
or process can monitor. This can be seen with virsh
In termainl 1
$ virsh save demo demo.img
In terminal 2
$ ./virsh domjobinfo demo
Job type: Unbounded
Time elapsed: 795 ms
Data processed: 22446080 bytes
Data remaining: 219119616 bytes
Data total: 241565696 bytes
Memory processed: 22446080 bytes
Memory remaining: 219119616 bytes
Memory total: 241565696 bytes
$ ./virsh domjobinfo demo
Job type: Unbounded
Time elapsed: 1669 ms
Data processed: 139784192 bytes
Data remaining: 101781504 bytes
Data total: 241565696 bytes
Memory processed: 139784192 bytes
Memory remaining: 101781504 bytes
Memory total: 241565696 bytes
$ ./virsh domjobabort demo
Back in terminal 1
error: Failed to save domain demo to demo.img
error: operation failed: Migration was cancelled by client
14 years, 9 months
[libvirt] [PATCH] sexpr_string: avoid leak on OOM error path
by Jim Meyering
>From cc06142a81dc1891dc75306b986ea331f5fd5368 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 4 Feb 2010 17:55:15 +0100
Subject: [PATCH] sexpr_string: avoid leak on OOM error path
* src/xen/sexpr.c (sexpr_string): Free sexpr buffer upon allocation
failure.
---
src/xen/sexpr.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/xen/sexpr.c b/src/xen/sexpr.c
index 085500d..669f8a2 100644
--- a/src/xen/sexpr.c
+++ b/src/xen/sexpr.c
@@ -107,30 +107,31 @@ sexpr_nil(void)
struct sexpr *
sexpr_string(const char *str, ssize_t len)
{
struct sexpr *ret = sexpr_new();
if (ret == NULL)
return ret;
ret->kind = SEXPR_VALUE;
if (len > 0) {
ret->u.value = strndup(str, len);
} else {
ret->u.value = strdup(str);
}
if (ret->u.value == NULL) {
+ VIR_FREE(ret);
return NULL;
}
return ret;
}
/**
* sexpr_cons:
* @car: the left operand
* @cdr: the right operand
*
* Implement the CONS operation assembling 2 existing S-Expressions.
* Note that in case of error the input data are not freed.
*
* Returns the resulting S-Expression pointer or NULL in case of error.
--
1.7.0.rc1.199.g9253a
14 years, 9 months
[libvirt] Suggested schedule for next release
by Daniel Veillard
Considering the amount of changes accumulating in a month, I suggest
to continue with the end-of-month release cycle, which means basically
that we would push features to head until Friday 19th and push the next
release on the 26. This is a short cycle since Feb is a short month and
we skipped a bit on 0.7.6 release, but I have no doubt we will have
enough substance :-)
There is a number of patches alredy lining up, the new APIs from Jim
Fehlig, Dan Berrange clock sync patches, the macvlan patches, and the
proposed snapshotting APIs (if we actually end up adding snapshotting
I think next release would deserve being named 0.8.0 as this would be
a major enhancement, otherwise 0.7.7), etc...
Happy hacking !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
14 years, 9 months
[libvirt] Fix wrong nodeinfo->mhz when cpufreq is enabled
by Thomas Treutner
Hi,
I've written a little patch to fix wrong nodeinfo->mhz when the Linux
kernel module cpufreq and a typical governor like ondemand are loaded.
nodeinfo->mhz is then too low as libvirt just reads /proc/cpuinfo,
entry "cpu MHz". This patch reads
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
if existing and corrects nodeinfo->mhz if the value found is higher.
Using cpu0 is a crude hack but as discussed on IRC, considering different
governors/maximum frequencies per cpu/core would require changing the
nodeinfo struct, which would break the API.
Some more info: https://bugzilla.redhat.com/show_bug.cgi?id=559762
Please have a careful look at my patch, my last C is quite some time ago.
I tried to stick to linuxNodeInfoCPUPopulate, but f.e., checking for
"&& *p == '\0'" after virStrToLong_ui doesn't work and I'm wondering why
scaling_max_freq may not be terminated with by NUL? I also hope the file
handling is correct, but please have a look.
There is still some todo: Some logging would be helpful, maybe one of you
could point out which function best to use?
This is my first patch, so hopefully it follows in the next mail ;-)
kr,
tom
14 years, 9 months
[libvirt] [PATCH] virt-pki-validate contains unexpanded SYSCONFDIR variable
by Doug Goldstein
virt-pki-validate contains an unexpanded SYSCONFDIR variable which
causes it not to function at all.
---
tools/virt-pki-validate.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index a428a96..3e8c642 100755
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -25,7 +25,7 @@ echo Found $CERTOOL
#
# Check the directory structure
#
-PKI="$(SYSCONFDIR)/pki"
+PKI="@SYSCONFDIR@/pki"
if [ ! -d $PKI ]
then
echo the $PKI directory is missing, it is usually
--
1.6.6.1
14 years, 9 months
[libvirt] [PATCH] esx: Remove unnecessary casts
by Matthias Bolte
---
src/esx/esx_driver.c | 74 +++++++++++++++++++++++++-------------------------
1 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index fc254c6..fc5a50e 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -558,7 +558,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
static int
esxClose(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_EnsureSession(priv->host);
@@ -645,7 +645,7 @@ esxSupportsVMotion(esxPrivate *priv)
static int
esxSupportsFeature(virConnectPtr conn, int feature)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_Boolean supportsVMotion = esxVI_Boolean_Undefined;
switch (feature) {
@@ -678,7 +678,7 @@ esxGetType(virConnectPtr conn ATTRIBUTE_UNUSED)
static int
esxGetVersion(virConnectPtr conn, unsigned long *version)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
char *temp;
unsigned int major, minor, release;
@@ -716,7 +716,7 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
static char *
esxGetHostname(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -805,7 +805,7 @@ static int
esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -958,7 +958,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
static char *
esxGetCapabilities(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
char *xml = virCapabilitiesFormatXML(priv->caps);
if (xml == NULL) {
@@ -974,7 +974,7 @@ esxGetCapabilities(virConnectPtr conn)
static int
esxListDomains(virConnectPtr conn, int *ids, int maxids)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_ObjectContent *virtualMachineList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
@@ -1046,7 +1046,7 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
static int
esxNumberOfDomains(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
if (esxVI_EnsureSession(priv->host) < 0) {
return -1;
@@ -1062,7 +1062,7 @@ esxNumberOfDomains(virConnectPtr conn)
static virDomainPtr
esxDomainLookupByID(virConnectPtr conn, int id)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachineList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
@@ -1145,7 +1145,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
static virDomainPtr
esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -1199,7 +1199,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
static virDomainPtr
esxDomainLookupByName(virConnectPtr conn, const char *name)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachineList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
@@ -1283,7 +1283,7 @@ static int
esxDomainSuspend(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -1338,7 +1338,7 @@ static int
esxDomainResume(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -1393,7 +1393,7 @@ static int
esxDomainShutdown(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -1438,7 +1438,7 @@ static int
esxDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -1483,7 +1483,7 @@ static int
esxDomainDestroy(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_Context *ctx = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
@@ -1559,7 +1559,7 @@ esxDomainGetOSType(virDomainPtr domain ATTRIBUTE_UNUSED)
static unsigned long
esxDomainGetMaxMemory(virDomainPtr domain)
{
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -1616,7 +1616,7 @@ static int
esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
@@ -1669,7 +1669,7 @@ static int
esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_ManagedObjectReference *task = NULL;
@@ -1723,7 +1723,7 @@ static int
esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -1978,7 +1978,7 @@ static int
esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
int maxVcpus;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachineConfigSpec *spec = NULL;
@@ -2050,7 +2050,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
static int
esxDomainGetMaxVcpus(virDomainPtr domain)
{
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -2109,7 +2109,7 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
static char *
esxDomainDumpXML(virDomainPtr domain, int flags)
{
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -2211,7 +2211,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
const char *nativeConfig,
unsigned int flags ATTRIBUTE_UNUSED)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
virDomainDefPtr def = NULL;
char *xml = NULL;
@@ -2240,7 +2240,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
const char *domainXml,
unsigned int flags ATTRIBUTE_UNUSED)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
virDomainDefPtr def = NULL;
char *vmx = NULL;
@@ -2268,7 +2268,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
static int
esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachineList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
@@ -2358,7 +2358,7 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
static int
esxNumberOfDefinedDomains(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
if (esxVI_EnsureSession(priv->host) < 0) {
return -1;
@@ -2375,7 +2375,7 @@ static int
esxDomainCreate(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
@@ -2430,7 +2430,7 @@ esxDomainCreate(virDomainPtr domain)
static virDomainPtr
esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
virDomainDefPtr def = NULL;
char *vmx = NULL;
int i;
@@ -2638,7 +2638,7 @@ static int
esxDomainUndefine(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_Context *ctx = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
@@ -2740,7 +2740,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int *nparams)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -2869,7 +2869,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params, int nparams)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_VirtualMachineConfigSpec *spec = NULL;
esxVI_SharesInfo *sharesInfo = NULL;
@@ -3040,7 +3040,7 @@ esxDomainMigratePerform(virDomainPtr domain,
unsigned long bandwidth ATTRIBUTE_UNUSED)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
xmlURIPtr xmlUri = NULL;
char hostIpAddress[NI_MAXHOST] = "";
esxVI_ObjectContent *virtualMachine = NULL;
@@ -3171,7 +3171,7 @@ static unsigned long long
esxNodeGetFreeMemory(virConnectPtr conn)
{
unsigned long long result = 0;
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
esxVI_ManagedObjectReference *managedObjectReference = NULL;
@@ -3249,7 +3249,7 @@ esxNodeGetFreeMemory(virConnectPtr conn)
static int
esxIsEncrypted(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
if (STRCASEEQ(priv->transport, "https")) {
return 1;
@@ -3263,7 +3263,7 @@ esxIsEncrypted(virConnectPtr conn)
static int
esxIsSecure(virConnectPtr conn)
{
- esxPrivate *priv = (esxPrivate *)conn->privateData;
+ esxPrivate *priv = conn->privateData;
if (STRCASEEQ(priv->transport, "https")) {
return 1;
@@ -3278,7 +3278,7 @@ static int
esxDomainIsActive(virDomainPtr domain)
{
int result = 0;
- esxPrivate *priv = (esxPrivate *)domain->conn->privateData;
+ esxPrivate *priv = domain->conn->privateData;
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
--
1.6.3.3
14 years, 9 months
[libvirt] [PATCH] cgroup.c: avoid unconditional leaks
by Jim Meyering
Here's output from "git format-patch -U19 --stdout -1",
so you see the context:
>From 47ea9beecf93a796e606b4d906424c05e7f6c9bb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 4 Feb 2010 11:14:03 +0100
Subject: [PATCH] cgroup.c: avoid unconditional leaks
* src/util/cgroup.c (virCgroupCpuSetInherit) [HAVE_MNTENT_H]:
Don't leak CPU-set inheritance value strings.
---
src/util/cgroup.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index c80cf50..e6f0270 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -416,38 +416,39 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
VIR_DEBUG("Setting up inheritance %s -> %s", parent->path, group->path);
for (i = 0; i < ARRAY_CARDINALITY(inherit_values) ; i++) {
char *value;
rc = virCgroupGetValueStr(parent,
VIR_CGROUP_CONTROLLER_CPUSET,
inherit_values[i],
&value);
if (rc != 0) {
VIR_ERROR("Failed to get %s %d", inherit_values[i], rc);
break;
}
VIR_DEBUG("Inherit %s = %s", inherit_values[i], value);
rc = virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
inherit_values[i],
value);
+ VIR_FREE(value);
if (rc != 0) {
VIR_ERROR("Failed to set %s %d", inherit_values[i], rc);
break;
}
}
return rc;
}
static int virCgroupMakeGroup(virCgroupPtr parent, virCgroupPtr group, int create)
{
int i;
int rc = 0;
VIR_DEBUG("Make group %s", group->path);
for (i = 0 ; i < VIR_CGROUP_CONTROLLER_LAST ; i++) {
char *path = NULL;
--
1.7.0.rc1.193.ge8618
14 years, 9 months
[libvirt] [PATCH] virDomainChrDefParseXML: don't leak upon invalid input
by Jim Meyering
>From 6d0e0e571bba7792df9dacb898849708d5d3b425 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 4 Feb 2010 12:49:53 +0100
Subject: [PATCH] virDomainChrDefParseXML: don't leak upon invalid input
* src/conf/domain_conf.c (virDomainChrDefParseXML): Don't leak a
virDomainChrDef buffer upon "unknown target type for char device" error.
---
src/conf/domain_conf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 766993c..306776d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1947,6 +1947,7 @@ virDomainChrDefParseXML(virConnectPtr conn,
virDomainReportError(conn, VIR_ERR_XML_ERROR,
_("unknown target type for character device: %s"),
nodeName);
+ VIR_FREE(def);
return NULL;
}
def->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_NULL;
--
1.7.0.rc1.199.g9253a
14 years, 9 months
[libvirt] [PATCH] virExecWithHook: avoid leak on OOM error path
by Jim Meyering
>From ab102cf853e3b46bf10cf0faafa643a352ed8888 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 4 Feb 2010 12:25:34 +0100
Subject: [PATCH] virExecWithHook: avoid leak on OOM error path
* src/util/util.c (virExecWithHook): Free argv_str string before
returning upon failure to allocate space for environment.
---
src/util/util.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c
index 7e0cd50..a01fc45 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -625,18 +625,19 @@ virExecWithHook(virConnectPtr conn,
char *envp_str;
if ((argv_str = virArgvToString(argv)) == NULL) {
virReportOOMError(conn);
return -1;
}
if (envp) {
if ((envp_str = virArgvToString(envp)) == NULL) {
+ VIR_FREE(argv_str);
virReportOOMError(conn);
return -1;
}
VIR_DEBUG("%s %s", envp_str, argv_str);
VIR_FREE(envp_str);
} else {
VIR_DEBUG0(argv_str);
}
VIR_FREE(argv_str);
--
1.7.0.rc1.199.g9253a
14 years, 9 months