[libvirt] [PATCH] Fix race condition when destroying guests
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When running virDomainDestroy, we need to make sure that no other
background thread cleans up the domain while we're doing our work.
This can happen if we release the domain object while in the
middle of work, because the monitor might detect EOF in this window.
For this reason we have a 'beingDestroyed' flag to stop the monitor
from doing its normal cleanup. Unfortunately this flag was only
being used to protect qemuDomainBeginJob, and not qemuProcessKill
This left open a race condition where either libvirtd could crash,
or alternatively report bogus error messages about the domain already
having been destroyed to the caller
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c28c223..2a6f381 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2121,24 +2121,29 @@ qemuDomainDestroyFlags(virDomainPtr dom,
qemuDomainSetFakeReboot(driver, vm, false);
+
+ /* We need to prevent monitor EOF callback from doing our work (and sending
+ * misleading events) while the vm is unlocked inside BeginJob/ProcessKill API
+ */
+ priv->beingDestroyed = true;
+
/* Although qemuProcessStop does this already, there may
* be an outstanding job active. We want to make sure we
* can kill the process even if a job is active. Killing
* it now means the job will be released
*/
if (flags & VIR_DOMAIN_DESTROY_GRACEFUL) {
- if (qemuProcessKill(driver, vm, 0) < 0)
+ if (qemuProcessKill(driver, vm, 0) < 0) {
+ priv->beingDestroyed = false;
goto cleanup;
+ }
} else {
- if (qemuProcessKill(driver, vm, VIR_QEMU_PROCESS_KILL_FORCE) < 0)
+ if (qemuProcessKill(driver, vm, VIR_QEMU_PROCESS_KILL_FORCE) < 0) {
+ priv->beingDestroyed = false;
goto cleanup;
+ }
}
- /* We need to prevent monitor EOF callback from doing our work (and sending
- * misleading events) while the vm is unlocked inside BeginJob API
- */
- priv->beingDestroyed = true;
-
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_DESTROY) < 0)
goto cleanup;
--
1.8.0.2
11 years, 10 months
[libvirt] RFC: libxl race fixes
by Jim Fehlig
I've been investigating some races in the libxl driver and would like to
get comments on some potential solutions.
The first race is in the fd/timeout event handling code, which maps
libxl's osevent interface to libvirt's event loop interface. This
mapping opens the possibility for libvirt's event loop to invoke
event callbacks after libxl has already deregistered the event,
potentially accessing an event object that has already been freed.
One solution to this race I've found successful is reference counting the
objects associated with the events. When libxl registers an event, an
object encapsulating the event is created and it's reference count is set
to 1. When the event is injected into libvirt's event loop, another
reference is taken on the object. When libxl deregisters the event, it's
reference count is decremented. Once the event is removed from libvirt's
event loop, the final reference is decremented and the object is disposed.
This approach ensures the object is not disposed until it is removed
from libvirt's event loop *and* libxl had explicitly deregistered the event.
The notion of an event being 'disabled' found in libvirt's event loop impl
also had to be added to the libxl event object, to ensure the driver doesn't
call into libxl for a previously deregistered event.
The second race is between destroying a vm (i.e., calling
privateDataFreeFunc, which frees the libxl ctx) and deregistration/cleanup
of all events that have been registered by libxl.
One solution for this race is to convert libxlDomainObjPrivate to a
virObject and increment its reference for each fd and timeout registration.
Only when all fds and timeouts are deregistered and destroyed will the
libxlDomainObjPrivate be destroyed. One downside to this approach is that
an API to "cleanup" the libxl ctx is needed. Without such an API, some
fds are not deregistered until calling libxl_ctx_free. But since the fd
events have references on the libxlDomainObjPrivate, libxl_ctx_free is
never called. (BTW I have a patch adding libxl_ctx_quiesce() to libxl,
which upstream xen folks seem receptive to, including backporting to
Xen 4.2 branch, but I don't think this is ideal.)
An alternate solution that can be used to address both of these races
is to maintain a list of the fd/timeout registrations in the
libxlDomainObjPrivate object, and take a more brute force approach to
managing the registrations
Other solutions that I might be overlooking are certainly appreciated :).
Regards,
Jim
11 years, 10 months
[libvirt] [PATCH] qemu: Support ram bar size for qxl devices
by Alon Levy
Adds a qxl-ram attribute globaly to the video.model element, that changes
the resulting qemu command line only if video.type == "qxl".
That attribute gets a default value of 64*1024 only if model.type is
"qxl". In effect not changing any xml or argv for non qxl devices.
For qxl devices a new property is set:
-global qxl-vga.ram_size=<ram>*1024
or
-global qxl.ram_size=<ram>*1024
For the main and secondary qxl devices respectively.
The default for the qxl ram bar is the same as the default for the qxl
vram bar, 64*1024.
---
I've added a qxl-ram attribute. There is no precedent for adding am attribute
prefixed like this, so I'm open for any other suggestion on how to do it.
docs/schemas/domaincommon.rng | 9 +++-
src/conf/domain_conf.c | 19 ++++++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 58 ++++++++++++++++++----
.../qemuxml2argv-graphics-spice-compression.args | 2 +-
.../qemuxml2argv-graphics-spice-compression.xml | 4 +-
.../qemuxml2argv-graphics-spice-qxl-vga.args | 2 +-
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +-
.../qemuxml2argv-graphics-spice.args | 2 +-
.../qemuxml2argv-graphics-spice.xml | 4 +-
.../qemuxml2argv-video-device-pciaddr-default.args | 6 +--
11 files changed, 86 insertions(+), 25 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 67ae864..50fc834 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2251,7 +2251,9 @@
</define>
<!--
A video adapter description, allowing configuration of device
- model, number of virtual heads, and video ram size
+ model, number of virtual heads, and video ram size.
+ The qxl-ram property is used for qxl types only to specify the
+ primary bar size, letting vram specify the secondary bar size.
-->
<define name="video">
<element name="video">
@@ -2268,6 +2270,11 @@
</choice>
</attribute>
<optional>
+ <attribute name="qxl-ram">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
<attribute name="vram">
<ref name="unsignedInt"/>
</attribute>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 13c14e9..a16f1b5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7391,6 +7391,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
char *type = NULL;
char *heads = NULL;
char *vram = NULL;
+ char *qxl_ram = NULL;
char *primary = NULL;
if (VIR_ALLOC(def) < 0) {
@@ -7401,9 +7402,10 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
- if (!type && !vram && !heads &&
+ if (!type && !vram && !qxl_ram && !heads &&
xmlStrEqual(cur->name, BAD_CAST "model")) {
type = virXMLPropString(cur, "type");
+ qxl_ram = virXMLPropString(cur, "qxl-ram");
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
@@ -7431,6 +7433,18 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
}
}
+ if (qxl_ram) {
+ if (virStrToLong_ui(qxl_ram, NULL, 10, &def->qxl_ram) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse video qxl-ram '%s'"), qxl_ram);
+ goto error;
+ }
+ } else {
+ if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ def->qxl_ram = virDomainVideoDefaultRAM(dom, def->type);
+ }
+ }
+
if (vram) {
if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7455,6 +7469,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
goto error;
VIR_FREE(type);
+ VIR_FREE(qxl_ram);
VIR_FREE(vram);
VIR_FREE(heads);
@@ -13383,6 +13398,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAddLit(buf, " <video>\n");
virBufferAsprintf(buf, " <model type='%s'",
model);
+ if (def->qxl_ram && def->type == VIR_DOMAIN_VIDEO_TYPE_QXL)
+ virBufferAsprintf(buf, " qxl-ram='%u'", def->qxl_ram);
if (def->vram)
virBufferAsprintf(buf, " vram='%u'", def->vram);
if (def->heads)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ce36003..9333d26 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1157,6 +1157,7 @@ struct _virDomainVideoAccelDef {
struct _virDomainVideoDef {
int type;
+ unsigned int qxl_ram;
unsigned int vram;
unsigned int heads;
bool primary;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 981c692..05f656a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3563,6 +3563,15 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video,
UINT_MAX / 1024);
goto error;
}
+ if (video->qxl_ram > (UINT_MAX / 1024)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("value for 'qxl-ram' must be less than '%u'"),
+ UINT_MAX / 1024);
+ goto error;
+ }
+
+ /* QEMU accepts bytes for ram_size. */
+ virBufferAsprintf(&buf, ",ram_size=%u", video->qxl_ram * 1024);
/* QEMU accepts bytes for vram_size. */
virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
@@ -6569,23 +6578,48 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
- if (def->videos[0]->vram &&
+ if ((def->videos[0]->vram || def->videos[0]->qxl_ram) &&
qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
- if (def->videos[0]->vram > (UINT_MAX / 1024)) {
+ int qxl_ram = def->videos[0]->qxl_ram;
+ int vram = def->videos[0]->vram;
+ if (vram > (UINT_MAX / 1024)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("value for 'vram' must be less than '%u'"),
+ _("value for 'vram' must be less than '%u'"),
+ UINT_MAX / 1024);
+ goto error;
+ }
+ if (qxl_ram > (UINT_MAX / 1024)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("value for 'qxl-ram' must be less than '%u'"),
UINT_MAX / 1024);
goto error;
}
- virCommandAddArg(cmd, "-global");
-
- if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA))
- virCommandAddArgFormat(cmd, "qxl-vga.vram_size=%u",
- def->videos[0]->vram * 1024);
- else
- virCommandAddArgFormat(cmd, "qxl.vram_size=%u",
- def->videos[0]->vram * 1024);
+ if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA)) {
+ if (qxl_ram) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd,
+ "qxl-vga.ram_size=%u",
+ qxl_ram * 1024);
+ }
+ if (vram) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd,
+ "qxl-vga.vram_size=%u",
+ vram * 1024);
+ }
+ } else {
+ if (qxl_ram) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "qxl.ram_size=%u",
+ qxl_ram * 1024);
+ }
+ if (vram) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "qxl.vram_size=%u",
+ vram * 1024);
+ }
+ }
}
}
}
@@ -9247,6 +9281,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
else
vid->type = video;
vid->vram = virDomainVideoDefaultRAM(def, vid->type);
+ vid->qxl_ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ?
+ virDomainVideoDefaultRAM(def, vid->type) : 0;
vid->heads = 1;
if (VIR_REALLOC_N(def->videos, def->nvideos+1) < 0) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
index 5c5912b..2f537df 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
@@ -5,5 +5,5 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
x509-dir=/etc/pki/libvirt-spice,\
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter -vga \
-qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
+qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
index 52eb5b9..32e4cc8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -31,10 +31,10 @@
<streaming mode='filter'/>
</graphics>
<video>
- <model type='qxl' vram='18432' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='18432' heads='1'/>
</video>
<video>
- <model type='qxl' vram='32768' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='32768' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
index 3954c03..007dd3f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\
x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs -vga \
-qxl -global qxl-vga.vram_size=33554432 -device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x4 \
+qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
index 49cb8cc..ab40c7b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -28,10 +28,10 @@
<channel name='inputs' mode='insecure'/>
</graphics>
<video>
- <model type='qxl' vram='32768' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='32768' heads='1'/>
</video>
<video>
- <model type='qxl' vram='65536' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='65536' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index 854e723..030e1f2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -5,5 +5,5 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
x509-dir=/etc/pki/libvirt-spice,tls-channel=default,tls-channel=main,plaintext-channel=inputs,\
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter,disable-copy-paste -vga \
-qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
+qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index d4939a4..b540915 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -34,10 +34,10 @@
<clipboard copypaste='no'/>
</graphics>
<video>
- <model type='qxl' vram='18432' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='18432' heads='1'/>
</video>
<video>
- <model type='qxl' vram='32768' heads='1'/>
+ <model type='qxl' qxl-ram='65536' vram='32768' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
index 9ce852f..4abd7c2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
@@ -3,7 +3,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-usb \
-hda /var/lib/libvirt/images/QEMUGuest1 -vnc 127.0.0.1:-5900 \
--device qxl-vga,id=video0,vram_size=67108864,bus=pci.0,addr=0x3 \
--device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x4 \
--device qxl,id=video2,vram_size=67108864,bus=pci.0,addr=0x5 \
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x3 \
+-device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \
+-device qxl,id=video2,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x5 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
--
1.8.0.1
11 years, 10 months
[libvirt] [PATCH] Log flags passed to qemuMigrationPrepare{Tunnel, Direct} APIs
by Michal Privoznik
We are already logging other arguments passed, however, @flags
were missing there.
---
Pushed as these chunks were ACKed and are not really part of my NBD patchset:
https://www.redhat.com/archives/libvir-list/2013-January/msg01306.html
src/qemu/qemu_migration.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 465dbc1..d03e361 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1787,9 +1787,10 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
int ret;
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
- "cookieout=%p, cookieoutlen=%p, st=%p, dname=%s, dom_xml=%s",
+ "cookieout=%p, cookieoutlen=%p, st=%p, dname=%s, dom_xml=%s "
+ "flags=%lx",
driver, dconn, NULLSTR(cookiein), cookieinlen,
- cookieout, cookieoutlen, st, NULLSTR(dname), dom_xml);
+ cookieout, cookieoutlen, st, NULLSTR(dname), dom_xml, flags);
/* QEMU will be started with -incoming stdio (which qemu_command might
* convert to exec:cat or fd:n)
@@ -1823,10 +1824,10 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, uri_in=%s, uri_out=%p, "
- "dname=%s, dom_xml=%s",
+ "dname=%s, dom_xml=%s flags=%lx",
driver, dconn, NULLSTR(cookiein), cookieinlen,
cookieout, cookieoutlen, NULLSTR(uri_in), uri_out,
- NULLSTR(dname), dom_xml);
+ NULLSTR(dname), dom_xml, flags);
/* The URI passed in may be NULL or a string "tcp://somehostname:port".
*
--
1.8.0.2
11 years, 10 months
[libvirt] [PATCH] build: Fix RPM build errors related to libvirt-lxc API
by Viktor Mihajlovski
Added missing entries to makefile and spec.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
docs/Makefile.am | 2 +-
libvirt.spec.in | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index b1fa77a..c95497f 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -120,7 +120,7 @@ EXTRA_DIST= \
hacking1.xsl hacking2.xsl wrapstring.xsl \
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
- $(xml) $(qemu_xml) $(fig) $(png) $(css) \
+ $(xml) $(qemu_xml) $(lxc_xml) $(fig) $(png) $(css) \
$(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
$(internals_html_in) $(internals_html) \
sitemap.html.in \
diff --git a/libvirt.spec.in b/libvirt.spec.in
index dca5053..3486d29 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1983,6 +1983,7 @@ fi
%doc AUTHORS NEWS README COPYING.LIB
%{_libdir}/python*/site-packages/libvirt.py*
%{_libdir}/python*/site-packages/libvirt_qemu.py*
+%{_libdir}/python*/site-packages/libvirt_lxc.py*
%{_libdir}/python*/site-packages/libvirtmod*
%doc python/tests/*.py
%doc python/TODO
--
1.7.9.5
11 years, 10 months
[libvirt] Coverity update
by John Ferlan
Taking Eric's suggestion from:
https://www.redhat.com/archives/libvir-list/2013-January/msg01050.html
There's two changes that have yet to be reviewed:
https://www.redhat.com/archives/libvir-list/2013-January/msg00537.html
https://www.redhat.com/archives/libvir-list/2013-January/msg00541.html
After this recent set of 10 patches there are about 20 patches
remaining. With the 2 above and the 10 from yesterday, the coverity
defect list stands at 236 (down from 297). Of those, about 50 are
related to a sdt.h macro issue, 50 are false positives requiring a
comment change, and another 95 can be fixed/resolved by a very simple
(but yet unnecessary) change to src/esx/esx_vi.c and
src/esx/esx_vi_types.c. Each module as a __TEMPLATE__FREE() macro which
does the following:
item=*ptrptr; \
\
_body \
\
VIR_FREE(*ptrptr); \
Coverity has a hard time with the VIR_FREE(*ptrptr) here and in other
modules, thus it decides we must be leaking. No amount of tagging
completely removes all the warnings (I tried adding them everywhere and
only reduced the count, not eliminated). There is a solution, but I
really don't like it. If the VIR_FREE(*ptrptr) is changed to:
VIR_FREE(item); \
*ptrptr = NULL; \
Coverity is happy. I asked about this on a Coverity community message
board, but no one has an answer. I even generated a small program which
replicated the issue. In a way I think it could be a Coverity bug, but
I'm not sure I want to make that claim yet.
John
11 years, 10 months
[libvirt] [PATCH] qemu: Double mutex unlock in qemuDomainModifyDeviceFlags
by Viktor Mihajlovski
The driver mutex was unlocked in qemuDomainModifyDeviceFlags before
entering qemuDomainObjBeginJobWithDriver where it will be unlocked once
more leaving it in an undefined state. The result was that two
threads were simultaneously looking up the domain hash table during
multiple parallel device attach/detach operations.
Luckily this triggered a virHashIterationError.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8c39864..c28c223 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6443,7 +6443,6 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
- qemuDriverUnlock(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
--
1.7.9.5
11 years, 10 months
Re: [libvirt] Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>
by Carlos O'Donell
On Thu, Jan 17, 2013 at 11:20 PM, Mike Frysinger <vapier(a)gentoo.org> wrote:
> On Wednesday 16 January 2013 22:15:38 David Miller wrote:
>> From: Carlos O'Donell <carlos(a)systemhalted.org>
>> Date: Wed, 16 Jan 2013 21:15:03 -0500
>>
>> > +/* If a glibc-based userspace has already included in.h, then we will
>> > not + * define in6_addr (nor the defines), sockaddr_in6, or ipv6_mreq.
>> > The + * ABI used by the kernel and by glibc match exactly. Neither the
>> > kernel + * nor glibc should break this ABI without coordination.
>> > + */
>> > +#ifndef _NETINET_IN_H
>> > +
>>
>> I think we should shoot for a non-glibc-centric solution.
>>
>> I can't imagine that other libc's won't have the same exact problem
>> with their netinet/in.h conflicting with the kernel's, redefining
>> structures like in6_addr, that we'd want to provide a protection
>> scheme for here as well.
>
> yes, the kernel's use of __GLIBC__ in exported headers has already caused
> problems in the past. fortunately, it's been reduced down to just one case
> now (stat.h). let's not balloon it back up.
> -mike
I also see coda.h has grown a __GLIBC__ usage.
In the next revision of the patch I created a single libc-compat.h header
which encompasses the logic for any libc that wants to coordinate with
the kernel headers.
It's simple enough to move all of the __GLIBC__ uses into libc-compat.h,
then you control userspace libc coordination from one file.
Cheers,
Carlos.
11 years, 10 months
[libvirt] [PATCH 00/12] Introduce public APIs for dealing with virTypedParameters
by Jiri Denemark
Working with virTypedParameters in clients written in C is ugly and
requires all clients to duplicate the same code. This set of APIs makes
this code for manipulating with virTypedParameters integral part of
libvirt so that all clients may benefit from it.
Jiri Denemark (12):
Add virTypedParams* APIs
virsh: Use virTypedParams* APIs in blkdeviotune
virsh: Use virTypedParams* APIs in blkiotune
virsh: Use virTypedParams* APIs in domiftune
virsh: Use virTypedParams* APIs in schedinfo
virsh: Use virTypedParams* APIs in domblkstat
virsh: Use virTypedParams* APIs in memtune
virsh: Use virTypedParams* APIs in numatune
virsh: Use virTypedParams* APIs in node-memory-tune
virsh: Use virTypedParams* APIs in cpu-stats
Introduce virTypedParamsClear public API
python: Avoid freeing uninitialized new_params pointer
daemon/remote.c | 34 +-
include/libvirt/libvirt.h.in | 95 ++++++
python/generator.py | 20 ++
python/libvirt-override.c | 73 ++--
src/libvirt_private.syms | 1 -
src/libvirt_public.syms | 18 +
src/remote/remote_driver.c | 4 +-
src/rpc/gendispatch.pl | 3 +-
src/util/virtypedparam.c | 782 ++++++++++++++++++++++++++++++++++++++++++-
src/util/virtypedparam.h | 2 -
tools/virsh-domain-monitor.c | 5 +-
tools/virsh-domain.c | 542 +++++++++++-------------------
tools/virsh-host.c | 78 ++---
tools/virsh.c | 20 --
14 files changed, 1171 insertions(+), 506 deletions(-)
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH] storage: Fix lvcreate parameter for backingStore.
by Atsushi Kumagai
When virStorageBackendLogicalCreateVol() creates a snapshot for a
logical volume with backingStore element, it fails with the message
below:
2013-01-17 03:10:18.869+0000: 1967: error : virCommandWait:2345 :
internal error Child process (/sbin/lvcreate --name lvm-snapshot -L 51200K
-s=/dev/lvm-pool/lvm-volume) unexpected exit status 3: /sbin/lvcreate:
invalid option -- '=' Error during parsing of command line.
This is because virCommandAddArgPair() uses '=' to connect the two
parameters, it's unsuitable for -s option of the lvcreate.
Signed-off-by: Atsushi Kumagai <kumagai-atsushi(a)mxc.nes.nec.co.jp>
---
src/storage/storage_backend_logical.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 91db3fd..bb709df 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -736,7 +736,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
}
virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(vol->capacity, 1024));
if (vol->backingStore.path)
- virCommandAddArgPair(cmd, "-s", vol->backingStore.path);
+ virCommandAddArgList(cmd, "-s", vol->backingStore.path, NULL);
else
virCommandAddArg(cmd, pool->def->source.name);
--
1.7.1
11 years, 10 months