[libvirt] [PATCH] python: Fix bindings for virDomainSnapshotGetDomain
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=895882
virDomainSnapshotGetDomain returns snapshot->domain without incrementing
domain's reference counter. The autogenerated python wrapper around this
API did not honor this fact and created a new virDomain object from the
snapshot's domain. When this object is deleted, it calls virDomainFree.
This caused python client to crash when the domain object is accessed
after it has been freed.
---
python/generator.py | 1 +
python/libvirt-override.c | 24 ++++++++++++++++++++++++
src/libvirt.c | 6 +++++-
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/python/generator.py b/python/generator.py
index f853d77..7e76c2a 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -379,6 +379,7 @@ skip_impl = (
'virConnectListDefinedInterfaces',
'virConnectListNWFilters',
'virDomainSnapshotListNames',
+ 'virDomainSnapshotGetDomain',
'virDomainSnapshotListChildrenNames',
'virConnGetLastError',
'virGetLastError',
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 8154024..92dc939 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2212,6 +2212,29 @@ cleanup:
}
static PyObject *
+libvirt_virDomainSnapshotGetDomain(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr dom;
+ virDomainSnapshotPtr snapshot;
+ PyObject *pyobj_snapshot;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:virDomainSnapshotGetDomain",
+ &pyobj_snapshot))
+ return NULL;
+ snapshot = PyvirDomainSnapshot_Get(pyobj_snapshot);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ dom = virDomainSnapshotGetDomain(snapshot);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (dom)
+ virDomainRef(dom);
+
+ return libvirt_virDomainPtrWrap(dom);
+}
+
+static PyObject *
libvirt_virDomainListAllSnapshots(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
@@ -6674,6 +6697,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virConnectBaselineCPU", libvirt_virConnectBaselineCPU, METH_VARARGS, NULL},
{(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL},
{(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
+ {(char *) "virDomainSnapshotGetDomain", libvirt_virDomainSnapshotGetDomain, METH_VARARGS, NULL},
{(char *) "virDomainListAllSnapshots", libvirt_virDomainListAllSnapshots, METH_VARARGS, NULL},
{(char *) "virDomainSnapshotListChildrenNames", libvirt_virDomainSnapshotListChildrenNames, METH_VARARGS, NULL},
{(char *) "virDomainSnapshotListAllChildren", libvirt_virDomainSnapshotListAllChildren, METH_VARARGS, NULL},
diff --git a/src/libvirt.c b/src/libvirt.c
index d5d561c..5f36934 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -17850,7 +17850,11 @@ virDomainSnapshotGetName(virDomainSnapshotPtr snapshot)
* virDomainSnapshotGetDomain:
* @snapshot: a snapshot object
*
- * Get the domain that a snapshot was created for
+ * Get the domain that a snapshot was created for. The caller must not call
+ * virDomainFree() on the returned domain unless it calls virDomainRef() first
+ * as this function does not increment domain's reference counter. The returned
+ * object will be automatically freed with the end of life of the snapshot
+ * object.
*
* Returns the domain or NULL.
*/
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH] build: allow virObject to have no parent
by Eric Blake
When building with static analysis enabled, we turn on attribute
nonnull checking. However, this caused the build to fail with:
../../src/util/virobject.c: In function 'virObjectOnceInit':
../../src/util/virobject.c:55:40: error: null argument where non-null required (argument 1) [-Werror=nonnull]
Creation of the virObject class is the one instance where the
parent class is allowed to be NULL, so making things conditional
will let us keep static analysis checking for all other callers,
without breaking the build on the one exception.
* src/util/virobject.c: Define witness.
* src/util/virobject.h (virClassNew): Use it to force most callers
to pass non-null parameter.
---
I couldn't bring myself to push this under the build breaker rule,
so I'll wait for a review.
src/util/virobject.c | 3 ++-
src/util/virobject.h | 9 +++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 7f08a11..3102e5e 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -1,7 +1,7 @@
/*
* virobject.c: libvirt reference counted object
*
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2012-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
#include <config.h>
+#define VIR_OBJECT_C
#include "virobject.h"
#include "virthread.h"
#include "viralloc.h"
diff --git a/src/util/virobject.h b/src/util/virobject.h
index bb72a25..02c409f 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -1,7 +1,7 @@
/*
* virobject.h: libvirt reference counted object
*
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2012-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -51,11 +51,16 @@ struct _virObjectLockable {
virClassPtr virClassForObject(void);
virClassPtr virClassForObjectLockable(void);
+#ifndef VIR_OBJECT_C
+# define VIR_PARENT_REQUIRED ATTRIBUTE_NONNULL(1)
+#else
+# define VIR_PARENT_REQUIRED /* empty */
+#endif
virClassPtr virClassNew(virClassPtr parent,
const char *name,
size_t objectSize,
virObjectDisposeCallback dispose)
- ATTRIBUTE_NONNULL(1);
+ VIR_PARENT_REQUIRED;
const char *virClassName(virClassPtr klass)
ATTRIBUTE_NONNULL(1);
--
1.8.1
11 years, 10 months
[libvirt] [libvirt-glib][PATCH] Don't redefine _FORTIFY_SOURCE macro
by Michal Privoznik
If the _FORTIFY_SOURCE has been already defined, we unconditionally
redefine it, leaving us with warning/error thrown at compilation time.
---
m4/virt-compile-warnings.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 99d214e..d07872a 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -87,7 +87,7 @@ AC_DEFUN([LIBVIRT_GLIB_COMPILE_WARNINGS],[
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting newer glibc. */
- #if defined __OPTIMIZE__ && __OPTIMIZE__
+ #if defined __OPTIMIZE__ && __OPTIMIZE__ && !defined _FORTIFY_SOURCE
# define _FORTIFY_SOURCE 2
#endif
])
--
1.8.0.2
11 years, 10 months
[libvirt] [PATCH] util: Remove ATTRIBUTE_NONNULL from virClassNew()
by John Ferlan
When compiling with Coverity, the STATIC_ANALYSIS was set to true which
triggered the ATTRIBUTE_NONNULL check from src/internal.h. Since virClassNew
now expects to be called with NULL under a special condition, this check
is no longer valid.
---
src/util/virobject.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/util/virobject.h b/src/util/virobject.h
index bb72a25..f58a950 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -54,8 +54,7 @@ virClassPtr virClassForObjectLockable(void);
virClassPtr virClassNew(virClassPtr parent,
const char *name,
size_t objectSize,
- virObjectDisposeCallback dispose)
- ATTRIBUTE_NONNULL(1);
+ virObjectDisposeCallback dispose);
const char *virClassName(virClassPtr klass)
ATTRIBUTE_NONNULL(1);
--
1.7.11.7
11 years, 10 months
[libvirt] [PATCH v2] qemu: Support ram bar size for qxl devices
by Alon Levy
Adds a "ram" attribute globally to the video.model element, that changes
the resulting qemu command line only if video.type == "qxl".
<video>
<model type='qxl' ram='65536' vram='65536' heads='1'/>
</video>
That attribute gets a default value of 64*1024. The schema is unchanged
for other video element types.
The resulting qemu command line change is the addition of
-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 64*1024 kilobytes (the same as the
default qxl vram bar size).
---
changes from v1:
renamed attribute to ram (Eric Blake)
fixes as given by Eric Blake
Did not add any of the suggestions that Gerd made, I think it can be done in a
separate patch and there was no discussion on it yet.
docs/formatdomain.html.in | 5 +-
docs/schemas/domaincommon.rng | 36 +++++++++-----
src/conf/domain_conf.c | 19 +++++++-
src/conf/domain_conf.h | 3 +-
src/qemu/qemu_command.c | 57 +++++++++++++++-------
.../qemuxml2argv-graphics-spice-compression.args | 2 +-
.../qemuxml2argv-graphics-spice-compression.xml | 4 +-
.../qemuxml2argv-graphics-spice-qxl-vga.args | 3 +-
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +-
.../qemuxml2argv-graphics-spice.args | 3 +-
.../qemuxml2argv-graphics-spice.xml | 4 +-
.../qemuxml2argv-video-device-pciaddr-default.args | 6 +--
12 files changed, 102 insertions(+), 44 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bb0b199..370de99 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3565,7 +3565,10 @@ qemu-kvm -net nic,model=? /dev/null
video device in domain xml is the primary one, but the optional
attribute <code>primary</code> (<span class="since">since 1.0.2</span>)
with value 'yes' can be used to mark the primary in cases of mutiple
- video device. The non-primary must be type of "qxl".
+ video device. The non-primary must be type of "qxl". The optional
+ attribute <code>ram</code> is allowed for "qxl" type only and specify
+ the size of the primary bar, while <code>vram</code> specifies the
+ secondary bar size. If "ram" is not supplied a default value is used.
</dd>
<dt><code>model</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 67ae864..6aca97a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2251,22 +2251,34 @@
</define>
<!--
A video adapter description, allowing configuration of device
- model, number of virtual heads, and video ram size
+ model, number of virtual heads, video ram size, and for qxl
+ both ram bar sizes.
-->
<define name="video">
<element name="video">
<optional>
- <element name="model">
- <attribute name="type">
- <choice>
- <value>vga</value>
- <value>cirrus</value>
- <value>vmvga</value>
- <value>xen</value>
- <value>vbox</value>
- <value>qxl</value>
- </choice>
- </attribute>
+ <element name="model">
+ <choice>
+ <attribute name="type">
+ <choice>
+ <value>vga</value>
+ <value>cirrus</value>
+ <value>vmvga</value>
+ <value>xen</value>
+ <value>vbox</value>
+ </choice>
+ </attribute>
+ <group>
+ <attribute name="type">
+ <value>qxl</value>
+ </attribute>
+ <optional>
+ <attribute name="ram">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ </group>
+ </choice>
<optional>
<attribute name="vram">
<ref name="unsignedInt"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 13c14e9..e490093 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 *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 && !ram && !heads &&
xmlStrEqual(cur->name, BAD_CAST "model")) {
type = virXMLPropString(cur, "type");
+ ram = virXMLPropString(cur, "ram");
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
@@ -7431,6 +7433,18 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
}
}
+ if (ram) {
+ if (virStrToLong_ui(ram, NULL, 10, &def->ram) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse video ram '%s'"), ram);
+ goto error;
+ }
+ } else {
+ if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ def->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(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->ram)
+ virBufferAsprintf(buf, " ram='%u'", def->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..af9a4bb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1157,7 +1157,8 @@ struct _virDomainVideoAccelDef {
struct _virDomainVideoDef {
int type;
- unsigned int vram;
+ unsigned int ram; /* kilobytes */
+ unsigned int vram; /* kilobytes */
unsigned int heads;
bool primary;
virDomainVideoAccelDefPtr accel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 981c692..712b54e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3558,11 +3558,20 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video,
if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
if (video->vram > (UINT_MAX / 1024)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_OVERFLOW,
_("value for 'vram' must be less than '%u'"),
UINT_MAX / 1024);
goto error;
}
+ if (video->ram > (UINT_MAX / 1024)) {
+ virReportError(VIR_ERR_OVERFLOW,
+ _("value for 'ram' must be less than '%u'"),
+ UINT_MAX / 1024);
+ goto error;
+ }
+
+ /* QEMU accepts bytes for ram_size. */
+ virBufferAsprintf(&buf, ",ram_size=%u", video->ram * 1024);
/* QEMU accepts bytes for vram_size. */
virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
@@ -6568,24 +6577,36 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
- if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
- if (def->videos[0]->vram &&
- qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
- if (def->videos[0]->vram > (UINT_MAX / 1024)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("value for 'vram' must be less than '%u'"),
- UINT_MAX / 1024);
- goto error;
- }
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
+ (def->videos[0]->vram || def->videos[0]->ram) &&
+ qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
+ const char *dev = (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA)
+ ? "qxl-vga" : "qxl");
+ int ram = def->videos[0]->ram;
+ int vram = def->videos[0]->vram;
+
+ if (vram > (UINT_MAX / 1024)) {
+ virReportError(VIR_ERR_OVERFLOW,
+ _("value for 'vram' must be less than '%u'"),
+ UINT_MAX / 1024);
+ goto error;
+ }
+ if (ram > (UINT_MAX / 1024)) {
+ virReportError(VIR_ERR_OVERFLOW,
+ _("value for 'ram' must be less than '%u'"),
+ UINT_MAX / 1024);
+ goto error;
+ }
+ if (ram) {
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);
+ virCommandAddArgFormat(cmd, "%s.ram_size=%u",
+ dev, ram * 1024);
+ }
+ if (vram) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.vram_size=%u",
+ dev, vram * 1024);
}
}
}
@@ -9247,6 +9268,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
else
vid->type = video;
vid->vram = virDomainVideoDefaultRAM(def, vid->type);
+ vid->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..a8c4ad8 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' ram='65536' vram='18432' heads='1'/>
</video>
<video>
- <model type='qxl' vram='32768' heads='1'/>
+ <model type='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..ef499e6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
@@ -3,5 +3,6 @@ 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..563d371 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' ram='65536' vram='32768' heads='1'/>
</video>
<video>
- <model type='qxl' vram='65536' heads='1'/>
+ <model type='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..d7cfae0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -5,5 +5,6 @@ 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..9a36660 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' ram='65536' vram='18432' heads='1'/>
</video>
<video>
- <model type='qxl' vram='32768' heads='1'/>
+ <model type='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] virsh-domain: Refactor error paths for cmdCPUStats
by Peter Krempa
This patch fixes the following issues in the cpu-stats virsh command:
1) Renames label failed_params to no_memory to match coding style
2) Uses proper typed parameter cleanup in error paths to avoid leaks
3) Adds a ret variable and simplifies error labels
4) Changes error message to a slightly more descriptive one and gets rid
of the newline at the end:
Before:
$ virsh cpu-stats tr
error: Failed to virDomainGetCPUStats()
error: Requested operation is not valid: domain is not running
After:
$ tools/virsh cpu-stats tr
error: Failed to retrieve CPU statistics for domain 'tr'
error: Requested operation is not valid: domain is not running
---
tools/virsh-domain.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f4b6622..026dac1 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6109,9 +6109,10 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
virTypedParameterPtr params = NULL;
- int i, j, pos, max_id, cpu = -1, show_count = -1, nparams;
+ int i, j, pos, max_id, cpu = -1, show_count = -1, nparams = 0;
bool show_total = false, show_per_cpu = false;
unsigned int flags = 0;
+ bool ret = false;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -6151,7 +6152,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
}
if (VIR_ALLOC_N(params, nparams * MIN(show_count, 128)) < 0)
- goto failed_params;
+ goto no_memory;
while (show_count) {
int ncpus = MIN(show_count, 128);
@@ -6199,8 +6200,8 @@ do_show_total:
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams))
- goto failed_params;
+ if (VIR_ALLOC_N(params, nparams) < 0)
+ goto no_memory;
/* passing start_cpu == -1 gives us domain's total status */
if ((nparams = virDomainGetCPUStats(dom, params, nparams, -1, 1, flags)) < 0)
@@ -6222,22 +6223,22 @@ do_show_total:
VIR_FREE(s);
}
}
- virTypedParamsFree(params, nparams);
+
+ ret = true;
cleanup:
+ virTypedParamsFree(params, nparams);
virDomainFree(dom);
- return true;
+ return ret;
-failed_params:
+no_memory:
virReportOOMError();
- virDomainFree(dom);
- return false;
+ goto cleanup;
failed_stats:
- vshError(ctl, _("Failed to virDomainGetCPUStats()\n"));
- VIR_FREE(params);
- virDomainFree(dom);
- return false;
+ vshError(ctl, _("Failed to retrieve CPU statistics for domain '%s'"),
+ virDomainGetName(dom));
+ goto cleanup;
}
/*
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH 0/5] Add additional data to the NUMA topology information
by Peter Krempa
See patch 2/5 for explaination.
Peter Krempa (5):
schema: Make the cpuset type reusable across schema files
schemas: Add schemas for more CPU topology information in the caps XML
conf: Split out NUMA topology formatting to simplify access to data
capabilities: Switch CPU data in NUMA topology to a struct
capabilities: Add additional data to the NUMA topology info
docs/schemas/basictypes.rng | 6 ++++
docs/schemas/capability.rng | 11 ++++++
docs/schemas/domaincommon.rng | 5 ---
src/conf/capabilities.c | 80 ++++++++++++++++++++++++++++---------------
src/conf/capabilities.h | 14 ++++++--
src/nodeinfo.c | 75 +++++++++++++++++++++++++++++++++-------
src/qemu/qemu_process.c | 2 +-
src/test/test_driver.c | 18 ++++++++--
src/xen/xend_internal.c | 27 +++++++++------
9 files changed, 176 insertions(+), 62 deletions(-)
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH 00/14] Resolve more Coverity issues
by John Ferlan
I got answer from someone on the Coverity boards regarding a false positive
related to how VIR_FREE() was operating when passed an address of an address
to some memory, see my note from last week:
https://www.redhat.com/archives/libvir-list/2013-January/msg01353.html
Essentially the issue is the "?:" construct in the VIR_FREE() macro and
Coverity taking the "else" condition as a possible path even though it
technically couldn't happen ((1) ? xxx : yyy). The suggestion made was
to remove the "?:", but since this only happens in the static analysis
case I used the existing STATIC_ANALYSIS build directive. This change
resolved about 100 false positives.
In doing this, Coverity uncovered a few more uninitialized variables prior
to VIR_FREE calls and a couple of instances where VIR_FREE was being called
on already free'd memory plus one instance where a pointer to free'd memory
was being returned (in qemumonitortestutils.c).
John Ferlan (14):
viralloc: Adjust definition of VIR_FREE() for Coverity
conf: Need to initialize variables before VIR_FREE
virnetserver: Need to initialize 'sigdata'
virnetsockettest: Need to initialize 'path'
virnetdev: Need to initialize 'pciConfigAddr'
commandtest: Need to initialize 'errbuf'
virfile: Need to initialize 'looppath'
lxc: Need to initialize 'dst'
virsh: Need to intialize 'str'
storage: Need to initialize 'zerobuf'
interface: Need to initialize 'ifaces_list'
security: Need to initialize 'sens'
virkeepalive: Remove erroneous VIR_FREE(msg)
tests: Need to initialize 'test' properly on error path
src/conf/domain_audit.c | 4 ++--
src/interface/interface_backend_udev.c | 2 +-
src/lxc/lxc_driver.c | 4 ++--
src/rpc/virkeepalive.c | 1 -
src/rpc/virnetserver.c | 2 +-
src/security/security_selinux.c | 2 +-
src/storage/storage_backend.c | 2 +-
src/util/viralloc.h | 11 ++++++++++-
src/util/virfile.c | 2 +-
src/util/virnetdev.c | 2 +-
tests/commandtest.c | 2 +-
tests/qemumonitortestutils.c | 1 +
tests/virnetsockettest.c | 4 ++--
tools/virsh.c | 2 +-
14 files changed, 25 insertions(+), 16 deletions(-)
--
1.7.11.7
11 years, 10 months
[libvirt] [PATCH] fix typos in comments for VIR_DOMAIN_PROCESS_SIGNAL_{PWR, SYS}
by Claudio Bley
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
Pushing under trivial rule.
include/libvirt/libvirt.h.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 8eb4a59..a634b37 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3133,8 +3133,8 @@ typedef enum {
VIR_DOMAIN_PROCESS_SIGNAL_WINCH = 28, /* Not in POSIX (SIGWINCH on Linux) */
VIR_DOMAIN_PROCESS_SIGNAL_POLL = 29, /* SIGPOLL (also known as SIGIO on Linux) */
- VIR_DOMAIN_PROCESS_SIGNAL_PWR = 30, /* Not in POSIX (SIGPWR on Linux */
- VIR_DOMAIN_PROCESS_SIGNAL_SYS = 31, /* SIGSYS (also known as SIGUNUSED on Linux ) */
+ VIR_DOMAIN_PROCESS_SIGNAL_PWR = 30, /* Not in POSIX (SIGPWR on Linux) */
+ VIR_DOMAIN_PROCESS_SIGNAL_SYS = 31, /* SIGSYS (also known as SIGUNUSED on Linux) */
VIR_DOMAIN_PROCESS_SIGNAL_RT0 = 32, /* SIGRTMIN */
VIR_DOMAIN_PROCESS_SIGNAL_RT1 = 33, /* SIGRTMIN + 1 */
VIR_DOMAIN_PROCESS_SIGNAL_RT2 = 34, /* SIGRTMIN + 2 */
--
1.7.9.5
11 years, 10 months