[libvirt] [PATCH] util: Fix incorrect error in PCI functions.
by Osier Yang
Substitute VIR_ERR_NO_SUPPORT with VIR_ERR_INTERNAL_ERROR. Error
like following is not what user want to see.
error : pciDeviceIsAssignable:1487 : this function is not supported
by the connection driver: Device 0000:07:10.0 is behind a switch
lacking ACS and cannot be assigned
---
src/util/pci.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index 9cc7b20..8baa3d8 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -614,7 +614,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
* are not in use by the host or other guests.
*/
if ((conflict = pciBusContainsActiveDevices(dev, inactiveDevs))) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Active %s devices on bus with %s, not doing bus reset"),
conflict->name, dev->name);
return -1;
@@ -624,7 +624,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
if (pciGetParentDevice(dev, &parent) < 0)
return -1;
if (!parent) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
return -1;
@@ -637,7 +637,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
* are multiple devices/functions
*/
if (pciRead(dev, 0, config_space, PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
goto out;
@@ -657,7 +657,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
usleep(200 * 1000); /* sleep 200ms */
if (pciWrite(dev, 0, config_space, PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
goto out;
@@ -683,7 +683,7 @@ pciTryPowerManagementReset(pciDevice *dev)
/* Save and restore the device's config space. */
if (pciRead(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
dev->name);
return -1;
@@ -703,7 +703,7 @@ pciTryPowerManagementReset(pciDevice *dev)
usleep(10 * 1000); /* sleep 10ms */
if (pciWrite(dev, 0, &config_space[0], PCI_CONF_LEN) < 0) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
return -1;
@@ -770,7 +770,7 @@ pciResetDevice(pciDevice *dev,
if (ret < 0) {
virErrorPtr err = virGetLastError();
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to reset PCI device %s: %s"),
dev->name,
err ? err->message : _("no FLR, PM reset or bus reset available"));
@@ -1324,7 +1324,7 @@ pciGetDevice(unsigned domain,
product = pciReadDeviceID(dev, "device");
if (!vendor || !product) {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read product/vendor ID for %s"),
dev->name);
VIR_FREE(product);
@@ -1588,7 +1588,7 @@ pciDeviceIsBehindSwitchLackingACS(pciDevice *dev)
if (dev->bus == 0)
return 0;
else {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to find parent device for %s"),
dev->name);
return -1;
@@ -1643,7 +1643,7 @@ int pciDeviceIsAssignable(pciDevice *dev,
VIR_DEBUG("%s %s: strict ACS check disabled; device assignment allowed",
dev->id, dev->name);
} else {
- pciReportError(VIR_ERR_NO_SUPPORT,
+ pciReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is behind a switch lacking ACS and "
"cannot be assigned"),
dev->name);
--
1.7.4
13 years, 10 months
[libvirt] [PATCH] build: consistently use CFLAGS
by Eric Blake
According to the automake manual, CPPFLAGS (aka INCLUDES, as spelled
in automake 1.9.6) should only include -I, -D, and -U directives; more
generic directives like -Wall belong in CFLAGS since they affect more
phases of the build process. Therefore, we should be sticking CFLAGS
additions into a CFLAGS container, not a CPPFLAGS container.
* src/Makefile.am (INCLUDES): Move CFLAGS items...
(AM_CFLAGS): ...to their proper location.
* python/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
* tests/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
---
python/Makefile.am | 5 +++--
src/Makefile.am | 15 +++++++--------
tests/Makefile.am | 8 +++++---
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/python/Makefile.am b/python/Makefile.am
index 432ad70..0edb3e4 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -3,12 +3,13 @@
SUBDIRS= . tests
INCLUDES = \
- $(WARN_CFLAGS) \
- $(PYTHON_INCLUDES) \
+ $(PYTHON_INCLUDES) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-I$(top_builddir)/$(subdir)
+AM_CFLAGS = $(WARN_CFLAGS)
+
DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIRT_VERSION)
DOCS = ${srcdir}/TODO
diff --git a/src/Makefile.am b/src/Makefile.am
index 02d53ee..292fa30 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,20 +3,19 @@
# No libraries with the exception of LIBXML should be listed
# here. List them against the individual XXX_la_CFLAGS targets
# that actually use them
-INCLUDES = \
- -I$(top_srcdir)/gnulib/lib \
+INCLUDES = -I$(top_srcdir)/gnulib/lib \
-I../gnulib/lib \
-I../include \
-I@top_srcdir@/src/util \
-I@top_srcdir@/include \
- $(DRIVER_MODULE_CFLAGS) \
+ -DIN_LIBVIRT
+
+AM_CFLAGS = $(DRIVER_MODULE_CFLAGS) \
$(LIBXML_CFLAGS) \
$(WARN_CFLAGS) \
- $(LOCK_CHECKING_CFLAGS) \
- -DIN_LIBVIRT \
- $(WIN32_EXTRA_CFLAGS)
-
-AM_CFLAGS = $(COVERAGE_CFLAGS)
+ $(LOCK_CHECKING_CFLAGS) \
+ $(WIN32_EXTRA_CFLAGS) \
+ $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
EXTRA_DIST = $(conf_DATA)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7ae50a2..2b21d82 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,14 +8,16 @@ INCLUDES = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/util \
- -I$(top_srcdir)/src/conf \
+ -I$(top_srcdir)/src/conf
+
+AM_CFLAGS = \
$(LIBXML_CFLAGS) \
$(GNUTLS_CFLAGS) \
$(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \
$(APPARMOR_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- $(WARN_CFLAGS)
+ $(COVERAGE_CFLAGS) \
+ $(WARN_CFLAGS)
if WITH_DRIVER_MODULES
INCLUDES += \
--
1.7.4.4
13 years, 10 months
[libvirt] [PATCH] graphics: add support for action_if_connected in qemu
by Michal Privoznik
This option accepts 3 values:
-keep, to keep current client connected (Spice+VNC)
-disconnect, to disconnect client (Spice)
-fail, to fail setting password if there is a client connected (Spice)
---
docs/schemas/domain.rng | 16 ++++++++++++++++
src/conf/domain_conf.c | 44 +++++++++++++++++++++++++++++++++++++++++---
src/conf/domain_conf.h | 11 +++++++++++
src/libvirt_private.syms | 2 ++
src/qemu/qemu_hotplug.c | 11 ++++++++---
5 files changed, 78 insertions(+), 6 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index c270815..f0efe60 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1227,6 +1227,13 @@
<data type="dateTime"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="connected">
+ <choice>
+ <value>keep</value>
+ </choice>
+ </attribute>
+ </optional>
</group>
<group>
<attribute name="type">
@@ -1270,6 +1277,15 @@
<data type="dateTime"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="connected">
+ <choice>
+ <value>fail</value>
+ <value>disconnect</value>
+ <value>keep</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
<zeroOrMore>
<element name="channel">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fbef61e..571fcf4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -313,6 +313,13 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
"desktop",
"spice")
+VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST,
+ "default",
+ "fail",
+ "disconnect",
+ "keep")
+
VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName,
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST,
"main",
@@ -3803,9 +3810,12 @@ error:
static int
-virDomainGraphicsAuthDefParseXML(xmlNodePtr node, virDomainGraphicsAuthDefPtr def)
+virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
+ virDomainGraphicsAuthDefPtr def,
+ int type)
{
char *validTo = NULL;
+ char *connected = virXMLPropString(node, "connected");
def->passwd = virXMLPropString(node, "passwd");
@@ -3846,6 +3856,28 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, virDomainGraphicsAuthDefPtr de
def->expires = 1;
}
+ if (connected) {
+ int action = virDomainGraphicsAuthConnectedTypeFromString(connected);
+ if (action < 0) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown connected value %s"),
+ connected);
+ VIR_FREE(connected);
+ return -1;
+ }
+ VIR_FREE(connected);
+
+ /* VNC supports connected='keep' only */
+ if (type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ action != VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("VNC supports connected='keep' only"));
+ return -1;
+ }
+
+ def->connected = action;
+ }
+
return 0;
}
@@ -3915,7 +3947,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
!def->data.vnc.listenAddr[0])
VIR_FREE(def->data.vnc.listenAddr);
- if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth) < 0)
+ if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth,
+ def->type) < 0)
goto error;
} else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
char *fullscreen = virXMLPropString(node, "fullscreen");
@@ -4051,7 +4084,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
!def->data.spice.listenAddr[0])
VIR_FREE(def->data.spice.listenAddr);
- if (virDomainGraphicsAuthDefParseXML(node, &def->data.spice.auth) < 0)
+ if (virDomainGraphicsAuthDefParseXML(node, &def->data.spice.auth,
+ def->type) < 0)
goto error;
cur = node->children;
@@ -7995,6 +8029,10 @@ virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf,
strftime(strbuf, sizeof(strbuf), "%Y-%m-%dT%H:%M:%S", tm);
virBufferAsprintf(buf, " passwdValidTo='%s'", strbuf);
}
+
+ if (def->connected)
+ virBufferEscapeString(buf, " connected='%s'",
+ virDomainGraphicsAuthConnectedTypeToString(def->connected));
}
static int
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8c94d4d..d090b9a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -631,12 +631,22 @@ enum virDomainGraphicsType {
VIR_DOMAIN_GRAPHICS_TYPE_LAST,
};
+enum virDomainGraphicsAuthConnectedType {
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DEFAULT = 0,
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_FAIL,
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DISCONNECT,
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP,
+
+ VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST
+};
+
typedef struct _virDomainGraphicsAuthDef virDomainGraphicsAuthDef;
typedef virDomainGraphicsAuthDef *virDomainGraphicsAuthDefPtr;
struct _virDomainGraphicsAuthDef {
char *passwd;
unsigned int expires: 1; /* Whether there is an expiry time set */
time_t validTo; /* seconds since epoch */
+ int connected; /* action if connected */
};
enum virDomainGraphicsSpiceChannelName {
@@ -1514,6 +1524,7 @@ VIR_ENUM_DECL(virDomainHostdevSubsys)
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
+VIR_ENUM_DECL(virDomainGraphicsAuthConnected)
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 321df2a..bb331a3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -263,6 +263,8 @@ virDomainFindByID;
virDomainFindByName;
virDomainFindByUUID;
virDomainGetRootFilesystem;
+virDomainGraphicsAuthConnectedTypeFromString;
+virDomainGraphicsAuthConnectedTypeToString;
virDomainGraphicsDefFree;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeToString;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3cf7d35..c0c4a15 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1017,10 +1017,12 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
return -1;
}
- /* If a password lifetime was, or is set, then we must always run,
- * even if new password matches old password */
+ /* If a password lifetime was, or is set, or action if connected has
+ * changed, then we must always run, even if new password matches
+ * old password */
if (olddev->data.vnc.auth.expires ||
dev->data.vnc.auth.expires ||
+ olddev->data.vnc.auth.connected != dev->data.vnc.auth.connected ||
STRNEQ_NULLABLE(olddev->data.vnc.auth.passwd, dev->data.vnc.auth.passwd)) {
VIR_DEBUG("Updating password on VNC server %p %p", dev->data.vnc.auth.passwd, driver->vncPassword);
ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC,
@@ -1032,6 +1034,7 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
dev->data.vnc.auth.passwd = NULL;
olddev->data.vnc.auth.validTo = dev->data.vnc.auth.validTo;
olddev->data.vnc.auth.expires = dev->data.vnc.auth.expires;
+ olddev->data.vnc.auth.connected = dev->data.vnc.auth.connected;
} else {
ret = 0;
}
@@ -1060,6 +1063,7 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
* even if new password matches old password */
if (olddev->data.spice.auth.expires ||
dev->data.spice.auth.expires ||
+ olddev->data.spice.auth.connected != dev->data.spice.auth.connected ||
STRNEQ_NULLABLE(olddev->data.spice.auth.passwd, dev->data.spice.auth.passwd)) {
VIR_DEBUG("Updating password on SPICE server %p %p", dev->data.spice.auth.passwd, driver->spicePassword);
ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
@@ -1071,6 +1075,7 @@ qemuDomainChangeGraphics(struct qemud_driver *driver,
dev->data.spice.auth.passwd = NULL;
olddev->data.spice.auth.validTo = dev->data.spice.auth.validTo;
olddev->data.spice.auth.expires = dev->data.spice.auth.expires;
+ olddev->data.spice.auth.connected = dev->data.spice.auth.connected;
} else {
VIR_DEBUG("Not updating since password didn't change");
ret = 0;
@@ -1755,7 +1760,7 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
ret = qemuMonitorSetPassword(priv->mon,
type,
auth->passwd ? auth->passwd : defaultPasswd,
- NULL);
+ auth->connected ? virDomainGraphicsAuthConnectedTypeToString(auth->connected) : NULL);
if (ret == -2) {
if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
--
1.7.5.rc3
13 years, 10 months
[libvirt] [PATCH] maint: use consistent file name for threading notes
by Eric Blake
* daemon/THREADING.txt: Rename...
* daemon/THREADS.txt: ...to match qemu thread notes.
* daemon/Makefile.am (EXTRA_DIST): Reflect rename.
---
First suggested here:
https://www.redhat.com/archives/libvir-list/2011-May/msg01730.html
daemon/Makefile.am | 2 +-
daemon/{THREADING.txt => THREADS.txt} | 0
2 files changed, 1 insertions(+), 1 deletions(-)
rename daemon/{THREADING.txt => THREADS.txt} (100%)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 92d154f..c1b4a9f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -44,7 +44,7 @@ EXTRA_DIST = \
libvirtd.lxc.logrotate.in \
libvirtd.uml.logrotate.in \
test_libvirtd.aug \
- THREADING.txt \
+ THREADS.txt \
libvirtd.pod.in \
libvirtd.8.in \
libvirtd.stp \
diff --git a/daemon/THREADING.txt b/daemon/THREADS.txt
similarity index 100%
rename from daemon/THREADING.txt
rename to daemon/THREADS.txt
--
1.7.4.4
13 years, 10 months
[libvirt] [PATCHv2 0/8] add virGetSchedulerParamterFlags
by Eric Blake
V2 of this original series:
https://www.redhat.com/archives/libvir-list/2011-May/msg01142.html
Changes in this version:
rebase to latest
avoid regression in virTypedParameter consolidation
write new API in terms of virTypedParameter instead of virSchedParameter
Eric Blake (8):
libvirt.h: avoid regression, and document preferred name
maint: prefer newer API names internally
remote: consolidate typed parameter handling
sched: introduce virDomainGetSchedulerParametersFlags
qemu: introduce qemuGetSchedulerParametersFlags
remote: introduce remoteGetSchedulerParametersFlags
virsh: improve schedinfo querying ability
sched: provide new API shims for remaining drivers
daemon/remote.c | 563 +++++++++++++++++-------------------------
include/libvirt/libvirt.h.in | 275 +++++++++++----------
python/generator.py | 1 +
python/libvirt-override.c | 28 +-
src/driver.h | 22 ++-
src/esx/esx_driver.c | 60 +++--
src/libvirt.c | 96 ++++++-
src/libvirt_public.syms | 1 +
src/libxl/libxl_driver.c | 42 +++-
src/lxc/lxc_driver.c | 60 ++++--
src/qemu/qemu_driver.c | 115 +++++++---
src/remote/remote_driver.c | 525 ++++++++++++++++-----------------------
src/remote/remote_protocol.x | 87 +++-----
src/remote_protocol-structs | 63 ++---
src/test/test_driver.c | 41 +++-
src/xen/xen_driver.c | 36 +++-
src/xen/xen_hypervisor.c | 14 +-
src/xen/xen_hypervisor.h | 6 +-
src/xen/xend_internal.c | 12 +-
tools/virsh.c | 102 +++++---
20 files changed, 1102 insertions(+), 1047 deletions(-)
--
1.7.4.4
13 years, 10 months
Re: [libvirt] ssh from host to guest on default network
by Neil Wilson
> Message: 1
> Date: Mon, 30 May 2011 20:28:42 -0700
> From: Kay Williams <Kay(a)thewilliams.net>
> To: "libvir-list(a)redhat.com" <libvir-list(a)redhat.com>
> Subject: [libvirt] ssh from host to guest on default network
> Message-ID:
> <3527434A537F2F42A53BAA31DC03BB6A4A52040D70(a)SERVER1.family.local>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello,
>
> The trouble I am having is with ssh'ing from the host to guest machine.
Probably more for the user list than this one. However...
I've used 'avahi' successfully to get resolution in the clients. It
implements the 'Bonjour' no configuration system. Obviously the client
image has to have the avahi daemons installed and correctly configured.
Once you have that working in the client and the correct settings in
your resolver on the host, then you can ssh into 'xyz.local' and it
resolves nicely.
Rgs
Neil
13 years, 10 months
[libvirt] [PATCH] openvz: Restore original EOF handling in openvzGetProcessInfo
by Matthias Bolte
This function is also affected by getline conversion. But this
didn't result in a regression in general, because the difference
whould only affect the behavior of the function when the line in
/proc/vz/vestat for the given vpsid wasn't found. Under normal
conditions this should not happen.
---
src/openvz/openvz_driver.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index ae951a2..e24b5d8 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1507,6 +1507,7 @@ static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid)
unsigned long long usertime, systime, nicetime;
int readvps = vpsid + 1; /* ensure readvps is initially different */
ssize_t ret;
+ int err = 0;
/* read statistic from /proc/vz/vestat.
sample:
@@ -1522,8 +1523,10 @@ Version: 2.2
/*search line with VEID=vpsid*/
while (1) {
ret = getline(&line, &line_size, fp);
- if (ret <= 0)
+ if (ret < 0) {
+ err = !feof(fp);
break;
+ }
if (sscanf (line, "%d %llu %llu %llu",
&readvps, &usertime, &nicetime, &systime) == 4
@@ -1538,7 +1541,7 @@ Version: 2.2
VIR_FREE(line);
VIR_FORCE_FCLOSE(fp);
- if (ret < 0)
+ if (err)
return -1;
if (readvps != vpsid) /*not found*/
--
1.7.0.4
13 years, 10 months
[libvirt] [PATCH v2] tests: Add more complex domain scheme test data
by Michal Privoznik
---
diff to v1:
-move from tests/domainschemadata/ to tests/qemuxml2argvdata/
-add .args
.../qemuxml2argv-graphics-spice-timeout.args | 14 +++
.../qemuxml2argv-graphics-spice-timeout.xml | 86 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 5 +
tests/qemuxml2xmltest.c | 3 +-
4 files changed, 107 insertions(+), 1 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
new file mode 100644
index 0000000..7c30e43
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
@@ -0,0 +1,14 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu-kvm -S -M pc-0.13 -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
+-m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
+-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
+-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,if=none,media=cdrom,id=drive-ide0-1-0 \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
+-device rtl8139,vlan=0,id=net0,mac=52:54:00:71:70:89,bus=pci.0,addr=0x7 \
+-net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 -serial pty \
+-usb -device usb-tablet,id=input0 \
+-spice port=5900,tls-port=0,x509-dir=/etc/pki/libvirt-spice -vga std \
+-device AC97,id=sound0,bus=pci.0,addr=0x3 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
new file mode 100644
index 0000000..aaa4469
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
@@ -0,0 +1,86 @@
+<domain type='qemu'>
+ <name>f14</name>
+ <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-0.13'>hvm</type>
+ <boot dev='cdrom'/>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu match='exact'>
+ <model>core2duo</model>
+ <vendor>Intel</vendor>
+ <topology sockets='1' cores='2' threads='1'/>
+ <feature policy='require' name='lahf_lm'/>
+ <feature policy='require' name='xtpr'/>
+ <feature policy='require' name='cx16'/>
+ <feature policy='require' name='tm2'/>
+ <feature policy='require' name='est'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='ds_cpl'/>
+ <feature policy='require' name='pbe'/>
+ <feature policy='require' name='tm'/>
+ <feature policy='require' name='ht'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='acpi'/>
+ <feature policy='require' name='ds'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/f14.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <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' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <interface type='ethernet'>
+ <mac address='52:54:00:71:70:89'/>
+ <script path='/etc/qemu-ifup'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </interface>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22'/>
+ <sound model='ac97'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </sound>
+ <video>
+ <model type='vga' vram='9216' heads='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 33cc58f..c9076e1 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -357,6 +357,11 @@ mymain(void)
DO_TEST("graphics-spice-compression", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+ DO_TEST("graphics-spice-timeout", false,
+ QEMU_CAPS_DRIVE,
+ QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
+ QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
+ QEMU_CAPS_DEVICE_QXL_VGA);
DO_TEST("graphics-spice-qxl-vga", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 1574cae..64a833f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -35,7 +35,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
VIR_DOMAIN_XML_INACTIVE)))
goto fail;
- if (!(actual = virDomainDefFormat(def, 0)))
+ if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
goto fail;
@@ -144,6 +144,7 @@ mymain(void)
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("graphics-spice");
DO_TEST("graphics-spice-compression");
+ DO_TEST("graphics-spice-timeout");
DO_TEST("graphics-spice-qxl-vga");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
--
1.7.5.rc3
13 years, 10 months
[libvirt] [PATCH] openvz: Handle getline failures in openvzReadConfigParam properly
by Matthias Bolte
The regression fix in 3aab7f2d6b068f0 altered the error handling.
getline returns -1 on failure to read a line (including EOF). The
original openvzReadConfigParam function using openvz_readline only
treated EOF as not-found. The current getline version treats all
getline failures as not-found.
This patch fixes this and distinguished EOF from other getline
failures.
---
src/openvz/openvz_conf.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 2cccd81..bf6ee2c 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -659,7 +659,12 @@ openvzReadConfigParam(const char *conf_file, const char *param, char **value)
return -1;
VIR_FREE(*value);
- while (getline(&line, &line_size, fp) >= 0) {
+ while (1) {
+ if (getline(&line, &line_size, fp) < 0) {
+ err = !feof(fp);
+ break;
+ }
+
if (! STREQLEN(line, param, strlen(param)))
continue;
--
1.7.0.4
13 years, 10 months
[libvirt] [PATCH] * .gitignore: Exempt a new test binary.
by Eric Blake
---
Pushing under the trivial rule.
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index a15100c..a4d3ea1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@
/tests/cputest
/tests/hashtest
/tests/nwfilterxml2xmltest
+/tests/openvzutilstest
/update.log
Makefile
Makefile.in
--
1.7.4.4
13 years, 10 months