[libvirt] [PATCH] qemu: Add support for locking domain's memory pages
by Jiri Denemark
---
docs/formatdomain.html.in | 26 +++++++++++++---------
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 20 +++++++++--------
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 11 +++++++++
tests/qemuxml2argvdata/qemuxml2argv-mlock-off.args | 4 ++++
tests/qemuxml2argvdata/qemuxml2argv-mlock-off.xml | 15 +++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-mlock-on.args | 4 ++++
tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml | 18 +++++++++++++++
.../qemuxml2argv-mlock-unsupported.args | 4 ++++
.../qemuxml2argv-mlock-unsupported.xml | 15 +++++++++++++
tests/qemuxml2argvtest.c | 5 +++++
14 files changed, 112 insertions(+), 19 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-off.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-off.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-on.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5e89a92..da35d48 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -595,22 +595,28 @@
<memoryBacking>
<hugepages/>
<nosharepages/>
+ <locked/>
</memoryBacking>
...
</domain>
</pre>
+ <p>The optional <code>memoryBacking</code> element may contain several
+ elements that influence how virtual memory pages are backed by host
+ pages.</p>
+
<dl>
- <dt><code>memoryBacking</code></dt>
- <dd>The optional <code>memoryBacking</code> element has two
- optional elements. The element <code>hugepages</code> tells
- the hypervisor that the guest should have its memory allocated
- using hugepages instead of the normal native page size. And the
- optional element <code>nosharepages</code>
- (<span class="since">since 1.0.6</span>) tells the hypervisor
- that share pages (memory merge, KSM) should be disabled on guest
- startup.
- </dd>
+ <dt><code>hugepages</code></dt>
+ <dd>This tells the hypervisor that the guest should have its memory
+ allocated using hugepages instead of the normal native page size.</dd>
+ <dt><code>nosharepages</code></dt>
+ <dd>Instructs hypervisor to disable shared pages (memory merge, KSM) for
+ this domain. <span class="since">Since 1.0.6</span></dd>
+ <dt><code>locked</code></dt>
+ <dd>When set and supported by the hypervisor, memory pages belonging
+ to the domain will be locked in host's memory and the host will not
+ be allowed to swap them out.
+ <span class="since">Since 1.0.6</span></dd>
</dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 361794e..f3d3560 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -501,6 +501,11 @@
<empty/>
</element>
</optional>
+ <optional>
+ <element name="locked">
+ <empty/>
+ </element>
+ </optional>
</interleave>
</element>
</optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f0ca9d5..6d8e580 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10389,6 +10389,9 @@ virDomainDefParseXML(xmlDocPtr xml,
if ((node = virXPathNode("./memoryBacking/nosharepages", ctxt)))
def->mem.nosharepages = true;
+ if (virXPathBoolean("boolean(./memoryBacking/locked)", ctxt))
+ def->mem.locked = true;
+
/* Extract blkio cgroup tunables */
if (virXPathUInt("string(./blkiotune/weight)", ctxt,
&def->blkio.weight) < 0)
@@ -15736,17 +15739,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
def->mem.swap_hard_limit)
virBufferAddLit(buf, " </memtune>\n");
- if (def->mem.hugepage_backed || def->mem.nosharepages)
+ if (def->mem.hugepage_backed || def->mem.nosharepages || def->mem.locked) {
virBufferAddLit(buf, " <memoryBacking>\n");
-
- if (def->mem.hugepage_backed)
- virBufferAddLit(buf, " <hugepages/>\n");
-
- if (def->mem.nosharepages)
- virBufferAddLit(buf, " <nosharepages/>\n");
-
- if (def->mem.hugepage_backed || def->mem.nosharepages)
+ if (def->mem.hugepage_backed)
+ virBufferAddLit(buf, " <hugepages/>\n");
+ if (def->mem.nosharepages)
+ virBufferAddLit(buf, " <nosharepages/>\n");
+ if (def->mem.locked)
+ virBufferAddLit(buf, " <locked/>\n");
virBufferAddLit(buf, " </memoryBacking>\n");
+ }
virBufferAddLit(buf, " <vcpu");
virBufferAsprintf(buf, " placement='%s'",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c176a4c..16eb8b6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1861,6 +1861,7 @@ struct _virDomainDef {
unsigned long long cur_balloon; /* in kibibytes */
bool hugepage_backed;
bool nosharepages;
+ bool locked;
int dump_core; /* enum virDomainMemDump */
unsigned long long hard_limit; /* in kibibytes */
unsigned long long soft_limit; /* in kibibytes */
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 488cbfe..82129a2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -230,6 +230,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"mem-merge",
"vnc-websocket",
"drive-discard",
+ "mlock",
);
struct _virQEMUCaps {
@@ -2246,6 +2247,7 @@ struct virQEMUCapsCommandLineProps {
static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{ "machine", "mem-merge", QEMU_CAPS_MEM_MERGE },
{ "drive", "discard", QEMU_CAPS_DRIVE_DISCARD },
+ { "realtime", "mlock", QEMU_CAPS_MLOCK },
};
static int
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 173ca77..117bf8a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -187,6 +187,7 @@ enum virQEMUCapsFlags {
QEMU_CAPS_MEM_MERGE = 146, /* -machine mem-merge */
QEMU_CAPS_VNC_WEBSOCKET = 147, /* -vnc x:y,websocket */
QEMU_CAPS_DRIVE_DISCARD = 148, /* -drive discard=off(ignore)|on(unmap) */
+ QEMU_CAPS_MLOCK = 149, /* -realtime mlock=on|off */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5b95c07..c268a3a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6541,6 +6541,17 @@ qemuBuildCommandLine(virConnectPtr conn,
cfg->hugepagePath, NULL);
}
+ if (def->mem.locked && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MLOCK)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("memory locking not supported by QEMU binary"));
+ goto error;
+ }
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MLOCK)) {
+ virCommandAddArg(cmd, "-realtime");
+ virCommandAddArgFormat(cmd, "mlock=%s",
+ def->mem.locked ? "on" : "off");
+ }
+
virCommandAddArg(cmd, "-smp");
if (!(smp = qemuBuildSmpArgStr(def, qemuCaps)))
goto error;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.args b/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.args
new file mode 100644
index 0000000..2a5d94c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc -m 214 -realtime mlock=off \
+-smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.xml b/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.xml
new file mode 100644
index 0000000..4125ca5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-off.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.args b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.args
new file mode 100644
index 0000000..bb6de13
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc -m 214 -realtime mlock=on \
+-smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml
new file mode 100644
index 0000000..20a5eaa
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-on.xml
@@ -0,0 +1,18 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <memoryBacking>
+ <locked/>
+ </memoryBacking>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.args b/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.args
new file mode 100644
index 0000000..54dd3b9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu -S -M pc -m 214 \
+-smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.xml b/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.xml
new file mode 100644
index 0000000..4125ca5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-mlock-unsupported.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c751440..d853308 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1007,6 +1007,11 @@ mymain(void)
QEMU_CAPS_DEVICE_SCSI_GENERIC,
QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
+ DO_TEST("mlock-on", QEMU_CAPS_MLOCK);
+ DO_TEST_FAILURE("mlock-on", NONE);
+ DO_TEST("mlock-off", QEMU_CAPS_MLOCK);
+ DO_TEST("mlock-unsupported", NONE);
+
virObjectUnref(driver.config);
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH 0/2 v2] Fix the build failure
by Osier Yang
As exposed by [1], qemuxml2argvtest fails because of it tries to
access non-existing sysfs files when building qemu command for
scsi-generic device.
This creates "tests/sysfsroot", uses it as the fake sysfs root,
any future sysfs test input files should be put into it.
[1] https://www.redhat.com/archives/libvir-list/2013-May/msg00923.html
v1 - v2:
* Use callbacks instead of increasing the arguments
Osier Yang (2):
qemu: Add callback struct for qemuBuildCommandLine
tests: Move fchostdata into sysfsroot
src/qemu/qemu_command.c | 31 ++++++++++++++-----
src/qemu/qemu_command.h | 16 ++++++++--
src/qemu/qemu_driver.c | 3 +-
src/qemu/qemu_hotplug.c | 6 ++--
src/qemu/qemu_process.c | 3 +-
src/util/virscsi.c | 35 ++++++++++++++++++----
src/util/virscsi.h | 3 +-
tests/Makefile.am | 2 +-
tests/fchostdata/fc_host/host4/fabric_name | 1 -
tests/fchostdata/fc_host/host4/max_npiv_vports | 1 -
tests/fchostdata/fc_host/host4/node_name | 1 -
tests/fchostdata/fc_host/host4/npiv_vports_inuse | 1 -
tests/fchostdata/fc_host/host4/port_name | 1 -
tests/fchostdata/fc_host/host4/port_state | 1 -
tests/fchostdata/fc_host/host4/vport_create | 0
tests/fchostdata/fc_host/host4/vport_delete | 0
tests/fchostdata/fc_host/host5/fabric_name | 1 -
tests/fchostdata/fc_host/host5/max_npiv_vports | 1 -
tests/fchostdata/fc_host/host5/node_name | 1 -
tests/fchostdata/fc_host/host5/npiv_vports_inuse | 1 -
tests/fchostdata/fc_host/host5/port_name | 1 -
tests/fchostdata/fc_host/host5/port_state | 1 -
tests/fchostdata/fc_host/host5/vport_create | 0
tests/fchostdata/fc_host/host5/vport_delete | 0
tests/fchosttest.c | 2 +-
tests/qemuxml2argvtest.c | 18 ++++++++++-
tests/qemuxmlnstest.c | 3 +-
.../bus/scsi/devices/0:0:0:0/scsi_generic/sg0/dev | 1 +
.../class/fchostdata/fc_host/host4/fabric_name | 1 +
.../class/fchostdata/fc_host/host4/max_npiv_vports | 1 +
.../class/fchostdata/fc_host/host4/node_name | 1 +
.../fchostdata/fc_host/host4/npiv_vports_inuse | 1 +
.../class/fchostdata/fc_host/host4/port_name | 1 +
.../class/fchostdata/fc_host/host4/port_state | 1 +
.../class/fchostdata/fc_host/host4/vport_create | 0
.../class/fchostdata/fc_host/host4/vport_delete | 0
.../class/fchostdata/fc_host/host5/fabric_name | 1 +
.../class/fchostdata/fc_host/host5/max_npiv_vports | 1 +
.../class/fchostdata/fc_host/host5/node_name | 1 +
.../fchostdata/fc_host/host5/npiv_vports_inuse | 1 +
.../class/fchostdata/fc_host/host5/port_name | 1 +
.../class/fchostdata/fc_host/host5/port_state | 1 +
.../class/fchostdata/fc_host/host5/vport_create | 0
.../class/fchostdata/fc_host/host5/vport_delete | 0
44 files changed, 110 insertions(+), 37 deletions(-)
delete mode 100644 tests/fchostdata/fc_host/host4/fabric_name
delete mode 100644 tests/fchostdata/fc_host/host4/max_npiv_vports
delete mode 100644 tests/fchostdata/fc_host/host4/node_name
delete mode 100644 tests/fchostdata/fc_host/host4/npiv_vports_inuse
delete mode 100644 tests/fchostdata/fc_host/host4/port_name
delete mode 100644 tests/fchostdata/fc_host/host4/port_state
delete mode 100644 tests/fchostdata/fc_host/host4/vport_create
delete mode 100644 tests/fchostdata/fc_host/host4/vport_delete
delete mode 100644 tests/fchostdata/fc_host/host5/fabric_name
delete mode 100644 tests/fchostdata/fc_host/host5/max_npiv_vports
delete mode 100644 tests/fchostdata/fc_host/host5/node_name
delete mode 100644 tests/fchostdata/fc_host/host5/npiv_vports_inuse
delete mode 100644 tests/fchostdata/fc_host/host5/port_name
delete mode 100644 tests/fchostdata/fc_host/host5/port_state
delete mode 100644 tests/fchostdata/fc_host/host5/vport_create
delete mode 100644 tests/fchostdata/fc_host/host5/vport_delete
create mode 100644 tests/sysfsroot/bus/scsi/devices/0:0:0:0/scsi_generic/sg0/dev
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/fabric_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/max_npiv_vports
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/node_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/npiv_vports_inuse
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/port_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/port_state
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/vport_create
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host4/vport_delete
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/fabric_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/max_npiv_vports
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/node_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/npiv_vports_inuse
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/port_name
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/port_state
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/vport_create
create mode 100644 tests/sysfsroot/class/fchostdata/fc_host/host5/vport_delete
--
1.8.1.4
11 years, 6 months
[libvirt] [libvirt PATCH] conf: Fix the bug of disk->copy_on_read formating
by Osier Yang
The reason for it's not exposed for such long time is that there is
no xml2xml test for it. This fixes the bug and adds test.
---
src/conf/domain_conf.c | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml | 15 ++++++++++-----
tests/qemuxml2xmltest.c | 2 ++
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 862b997..be22429 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13640,7 +13640,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
const char *iomode = virDomainDiskIoTypeToString(def->iomode);
const char *ioeventfd = virDomainIoEventFdTypeToString(def->ioeventfd);
const char *event_idx = virDomainVirtioEventIdxTypeToString(def->event_idx);
- const char *copy_on_read = virDomainVirtioEventIdxTypeToString(def->copy_on_read);
+ const char *copy_on_read = virDomainDiskCopyOnReadTypeToString(def->copy_on_read);
const char *sgio = virDomainDiskSGIOTypeToString(def->sgio);
char uuidstr[VIR_UUID_STRING_BUFLEN];
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
index 0834cf2..076095e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
@@ -1,6 +1,8 @@
<domain type='qemu'>
<name>test</name>
+ <uuid>468404ad-d49c-40f2-9e14-02294f9c1be3</uuid>
<memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-0.13'>hvm</type>
@@ -20,27 +22,30 @@
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
- <disk type='file' device='cdrom'>
+ <disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
+ <controller type='usb' index='0'/>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
<interface type='user'>
<mac address='52:54:00:e5:48:58'/>
<model type='virtio'/>
<driver name='vhost' txmode='iothread'/>
</interface>
- <controller type='usb' index='0'/>
- <controller type='virtio-serial' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
- </controller>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
+ <memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 492ac60..d24cec9 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -289,6 +289,8 @@ mymain(void)
DO_TEST("hostdev-scsi-virtio-scsi");
DO_TEST("hostdev-scsi-readonly");
+ DO_TEST("disk-copy_on_read");
+
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] datatypes: fix virGetStoragePool's comment
by Ján Tomko
---
Pushed under the trivial rule.
src/datatypes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index 884eb3e..940d968 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -421,7 +421,7 @@ virInterfaceDispose(void *obj)
* and register it in the table. In any case a corresponding call to
* virObjectUnref() is needed to not leak data.
*
- * Returns a pointer to the network, or NULL in case of failure
+ * Returns a pointer to the storage pool, or NULL in case of failure
*/
virStoragePoolPtr
virGetStoragePool(virConnectPtr conn, const char *name,
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] daemon: fix leak after listing all volumes
by Ján Tomko
CVE-2013-1962
remoteDispatchStoragePoolListAllVolumes wasn't freeing the pool.
The pool also held a reference to the connection, preventing it from
getting freed and closing the netcf interface driver, which held two
sockets open.
---
daemon/remote.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemon/remote.c b/daemon/remote.c
index 1d21478..af89e60 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4202,6 +4202,8 @@ cleanup:
virStorageVolFree(vols[i]);
VIR_FREE(vols);
}
+ if (pool)
+ virStoragePoolFree(pool);
return rv;
}
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] qemu: Fix crash in migration of graphics-less guests.
by Viktor Mihajlovski
Commit 7f15ebc7a2b599ab10dbc15bca6f823591213e67 introduced a bug
happening when guests without a <graphics> element are migrated.
The initialization of listenAddress happens unconditionally
from the cookie even if the cookie->graphics pointer was NULL.
Moved the initialization to where it is safe.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_migration.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e38d99b..e10127d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1723,7 +1723,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
- char *listenAddress = cookie->graphics->listen;
+ char *listenAddress;
if (!cookie)
return 0;
@@ -1737,6 +1737,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
return 0;
+ listenAddress = cookie->graphics->listen;
if (!listenAddress ||
STREQ(listenAddress, "0.0.0.0") ||
STREQ(listenAddress, "::"))
--
1.7.9.5
11 years, 6 months
[libvirt] [PATCH] build: Fix check-driverimpls in VPATH
by Jiri Denemark
DRIVER_SOURCE_FILES mixes files with absolute path (inherited from
REMOTE_DRIVER_GENERATED) with file paths that are relative to srcdir but
check-driverimpls.pl needs full paths.
---
src/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c626ac..9a17f59 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -468,7 +468,8 @@ DRIVER_SOURCE_FILES = \
check-driverimpls:
$(AM_V_GEN)$(PERL) $(srcdir)/check-driverimpls.pl \
- $(DRIVER_SOURCE_FILES)
+ $(filter /%,$(DRIVER_SOURCE_FILES)) \
+ $(addprefix $(srcdir)/,$(filter-out /%,$(DRIVER_SOURCE_FILES)))
EXTRA_DIST += check-driverimpls.pl
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH 0/8] Add qcow2 extensions support
by Ján Tomko
Since QEMU 1.1 qcow2 supports a features bitfield, allowing
to implement additional features without breaking compatibility
with older QEMU versions.
The version header on-disk is bumped to 3, however the format name
is still 'qcow2', not 'qcow3' (which is what I used in v2).
v2: https://www.redhat.com/archives/libvir-list/2013-February/msg00212.html
qcow2 vs. qcow3 discussion:
https://www.redhat.com/archives/libvir-list/2013-March/msg00094.html
Ján Tomko (8):
storage: rework qemu-img command line generation
tests: don't overwrite error in storage xml-to-argv test
util: add support for qcow2v3 image detection
conf: add features to volume target XML
storage: add support for creating qcow2 images with extensions
conf: split out snapshot disk XML formatting
Add qcow2 features support to snapshots
qemu: add qcow2 extension support to inactive external snapshots
docs/formatsnapshot.html.in | 5 +
docs/formatstorage.html.in | 19 +++
docs/schemas/Makefile.am | 1 +
docs/schemas/domainsnapshot.rng | 7 +
docs/schemas/storagefilefeatures.rng | 24 ++++
docs/schemas/storagevol.rng | 7 +
libvirt.spec.in | 1 +
mingw-libvirt.spec.in | 2 +
src/conf/snapshot_conf.c | 127 ++++++++++++++----
src/conf/snapshot_conf.h | 2 +
src/conf/storage_conf.c | 76 ++++++++++-
src/conf/storage_conf.h | 6 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 72 +++++++---
src/storage/storage_backend.c | 143 +++++++++++++-------
src/storage/storage_backend_fs.c | 10 ++
src/util/virstoragefile.c | 164 ++++++++++++++++++-----
src/util/virstoragefile.h | 12 ++
tests/domainsnapshotxml2xmlin/disk_snapshot.xml | 5 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 4 +
tests/storagevolxml2argvdata/qcow2-1.1.argv | 1 +
tests/storagevolxml2argvdata/qcow2-lazy.argv | 1 +
tests/storagevolxml2argvdata/vol-qcow2-1.1.xml | 32 +++++
tests/storagevolxml2argvdata/vol-qcow2-lazy.xml | 35 +++++
tests/storagevolxml2argvtest.c | 6 +-
tests/storagevolxml2xmlin/vol-qcow2-1.1.xml | 32 +++++
tests/storagevolxml2xmlin/vol-qcow2-lazy.xml | 35 +++++
tests/storagevolxml2xmlout/vol-qcow2-1.1.xml | 33 +++++
tests/storagevolxml2xmlout/vol-qcow2-lazy.xml | 35 +++++
tests/storagevolxml2xmltest.c | 2 +
30 files changed, 769 insertions(+), 132 deletions(-)
create mode 100644 docs/schemas/storagefilefeatures.rng
create mode 100644 tests/storagevolxml2argvdata/qcow2-1.1.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-lazy.argv
create mode 100644 tests/storagevolxml2argvdata/vol-qcow2-1.1.xml
create mode 100644 tests/storagevolxml2argvdata/vol-qcow2-lazy.xml
create mode 100644 tests/storagevolxml2xmlin/vol-qcow2-1.1.xml
create mode 100644 tests/storagevolxml2xmlin/vol-qcow2-lazy.xml
create mode 100644 tests/storagevolxml2xmlout/vol-qcow2-1.1.xml
create mode 100644 tests/storagevolxml2xmlout/vol-qcow2-lazy.xml
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] util: Fix build without devmapper
by Jiri Denemark
stdlib.h header file needed for getenv was only transitively included
through libdevmapper.h.
---
Pushed as a trivial build-breaker.
src/util/virutil.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index ab3c82f..7f4ecd6 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -26,6 +26,7 @@
#include <config.h>
+#include <stdlib.h>
#include <dirent.h>
#include <stdio.h>
#include <stdarg.h>
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH 0/3] Fix the build failure
by Osier Yang
As exposed by [1], qemuxml2argvtest fails because of it tries to
access non-existing sysfs files when building qemu command for
scsi-generic device.
This creates "tests/sysfsroot", uses it as the fake sysfs root,
any future sysfs test input files should be put into it.
[1] https://www.redhat.com/archives/libvir-list/2013-May/msg00923.html
Osier Yang (3):
qemu: Allow to specify the sysfs root for qemuBuildCommandLine
tests: Feed the fake sysfs root to qemuBuildCommandLine
tests: Move fchostdata into sysfsroot
src/qemu/qemu_cgroup.c | 3 +-
src/qemu/qemu_command.c | 12 +++--
src/qemu/qemu_command.h | 6 ++-
src/qemu/qemu_driver.c | 3 +-
src/qemu/qemu_hostdev.c | 9 ++--
src/qemu/qemu_hotplug.c | 4 +-
src/qemu/qemu_process.c | 3 +-
src/security/security_dac.c | 6 ++-
src/security/security_selinux.c | 6 ++-
src/util/virscsi.c | 51 ++++++++++++++++++----
src/util/virscsi.h | 6 ++-
tests/Makefile.am | 2 +-
tests/fchostdata/fc_host/host4/fabric_name | 1 -
tests/fchostdata/fc_host/host4/max_npiv_vports | 1 -
tests/fchostdata/fc_host/host4/node_name | 1 -
tests/fchostdata/fc_host/host4/npiv_vports_inuse | 1 -
tests/fchostdata/fc_host/host4/port_name | 1 -
tests/fchostdata/fc_host/host4/port_state | 1 -
tests/fchostdata/fc_host/host4/vport_create | 0
tests/fchostdata/fc_host/host4/vport_delete | 0
tests/fchostdata/fc_host/host5/fabric_name | 1 -
tests/fchostdata/fc_host/host5/max_npiv_vports | 1 -
tests/fchostdata/fc_host/host5/node_name | 1 -
tests/fchostdata/fc_host/host5/npiv_vports_inuse | 1 -
tests/fchostdata/fc_host/host5/port_name | 1 -
tests/fchostdata/fc_host/host5/port_state | 1 -
tests/fchostdata/fc_host/host5/vport_create | 0
tests/fchostdata/fc_host/host5/vport_delete | 0
tests/fchosttest.c | 2 +-
tests/qemuxml2argvtest.c | 5 ++-
tests/qemuxmlnstest.c | 3 +-
.../bus/scsi/devices/0:0:0:0/scsi_generic/sg0/dev | 1 +
tests/sysfsroot/class/fc_host/host4/fabric_name | 1 +
.../sysfsroot/class/fc_host/host4/max_npiv_vports | 1 +
tests/sysfsroot/class/fc_host/host4/node_name | 1 +
.../class/fc_host/host4/npiv_vports_inuse | 1 +
tests/sysfsroot/class/fc_host/host4/port_name | 1 +
tests/sysfsroot/class/fc_host/host4/port_state | 1 +
tests/sysfsroot/class/fc_host/host4/vport_create | 0
tests/sysfsroot/class/fc_host/host4/vport_delete | 0
tests/sysfsroot/class/fc_host/host5/fabric_name | 1 +
.../sysfsroot/class/fc_host/host5/max_npiv_vports | 1 +
tests/sysfsroot/class/fc_host/host5/node_name | 1 +
.../class/fc_host/host5/npiv_vports_inuse | 1 +
tests/sysfsroot/class/fc_host/host5/port_name | 1 +
tests/sysfsroot/class/fc_host/host5/port_state | 1 +
tests/sysfsroot/class/fc_host/host5/vport_create | 0
tests/sysfsroot/class/fc_host/host5/vport_delete | 0
48 files changed, 101 insertions(+), 45 deletions(-)
delete mode 100644 tests/fchostdata/fc_host/host4/fabric_name
delete mode 100644 tests/fchostdata/fc_host/host4/max_npiv_vports
delete mode 100644 tests/fchostdata/fc_host/host4/node_name
delete mode 100644 tests/fchostdata/fc_host/host4/npiv_vports_inuse
delete mode 100644 tests/fchostdata/fc_host/host4/port_name
delete mode 100644 tests/fchostdata/fc_host/host4/port_state
delete mode 100644 tests/fchostdata/fc_host/host4/vport_create
delete mode 100644 tests/fchostdata/fc_host/host4/vport_delete
delete mode 100644 tests/fchostdata/fc_host/host5/fabric_name
delete mode 100644 tests/fchostdata/fc_host/host5/max_npiv_vports
delete mode 100644 tests/fchostdata/fc_host/host5/node_name
delete mode 100644 tests/fchostdata/fc_host/host5/npiv_vports_inuse
delete mode 100644 tests/fchostdata/fc_host/host5/port_name
delete mode 100644 tests/fchostdata/fc_host/host5/port_state
delete mode 100644 tests/fchostdata/fc_host/host5/vport_create
delete mode 100644 tests/fchostdata/fc_host/host5/vport_delete
create mode 100644 tests/sysfsroot/bus/scsi/devices/0:0:0:0/scsi_generic/sg0/dev
create mode 100644 tests/sysfsroot/class/fc_host/host4/fabric_name
create mode 100644 tests/sysfsroot/class/fc_host/host4/max_npiv_vports
create mode 100644 tests/sysfsroot/class/fc_host/host4/node_name
create mode 100644 tests/sysfsroot/class/fc_host/host4/npiv_vports_inuse
create mode 100644 tests/sysfsroot/class/fc_host/host4/port_name
create mode 100644 tests/sysfsroot/class/fc_host/host4/port_state
create mode 100644 tests/sysfsroot/class/fc_host/host4/vport_create
create mode 100644 tests/sysfsroot/class/fc_host/host4/vport_delete
create mode 100644 tests/sysfsroot/class/fc_host/host5/fabric_name
create mode 100644 tests/sysfsroot/class/fc_host/host5/max_npiv_vports
create mode 100644 tests/sysfsroot/class/fc_host/host5/node_name
create mode 100644 tests/sysfsroot/class/fc_host/host5/npiv_vports_inuse
create mode 100644 tests/sysfsroot/class/fc_host/host5/port_name
create mode 100644 tests/sysfsroot/class/fc_host/host5/port_state
create mode 100644 tests/sysfsroot/class/fc_host/host5/vport_create
create mode 100644 tests/sysfsroot/class/fc_host/host5/vport_delete
--
1.8.1.4
11 years, 6 months