[libvirt] [PATCH] virconf: clarify type range checks for integers
by Daniel P. Berrange
When virConf 'l' field is a 'signed long long', so whenever
the 'type' field is VIR_CONF_ULONG, we should explicitly cast
'l' to a 'unsigned long long' before doing range checks.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virconf.c | 81 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 32 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 5085768..f82d114 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1208,21 +1208,28 @@ int virConfGetValueSizeT(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < 0 || cval->l > SIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%zu"),
+ conf->filename, setting, SIZE_MAX);
+ return -1;
+ }
+ } else if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > SIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%zu"),
+ conf->filename, setting, SIZE_MAX);
+ return -1;
+ }
+ } else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected an unsigned integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->l > SIZE_MAX || cval->l < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range 0:%zu"),
- conf->filename, setting, SIZE_MAX);
- return -1;
- }
-
- *value = cval->l;
+ *value = (size_t)cval->l;
return 1;
}
@@ -1256,22 +1263,28 @@ int virConfGetValueSSizeT(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > SSIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range %zd:%zd"),
+ conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
+ return -1;
+ }
+ } else if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range %zd:%zd"),
+ conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
+ return -1;
+ }
+ } else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected a signed integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->l > SSIZE_MAX || cval->l < (-SSIZE_MAX - 1)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range %zd:%zd"),
- conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
- return -1;
- }
-
- *value = cval->l;
+ *value = (ssize_t)cval->l;
return 1;
}
@@ -1305,22 +1318,20 @@ int virConfGetValueLLong(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > LLONG_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%lld"),
+ conf->filename, setting, LLONG_MAX);
+ return -1;
+ }
+ } else if (cval->type != VIR_CONF_LONG) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected a signed integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->type == VIR_CONF_ULONG &&
- cval->l > LLONG_MAX) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range 0:%lld"),
- conf->filename, setting, LLONG_MAX);
- return -1;
- }
-
*value = cval->l;
return 1;
@@ -1354,15 +1365,21 @@ int virConfGetValueULLong(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%llu"),
+ conf->filename, setting, ULLONG_MAX);
+ return -1;
+ }
+ } else if (cval->type != VIR_CONF_ULONG) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected an unsigned integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- *value = cval->l;
+ *value = (unsigned long long)cval->l;
return 1;
}
--
2.7.4
8 years, 11 months
[libvirt] build failure on 32-bit
by Eric Blake
I hit an interesting failure on my 32-bit F24 machine:
In file included from ../../src/util/virconf.c:32:0:
../../src/util/virconf.c: In function 'virConfGetValueSSizeT':
../../src/util/virconf.c:1269:26: error: format '%zd' expects argument
of type 'signed size_t', but argument 9 has type 'long int'
[-Werror=format=]
_("%s: value for '%s' parameter must be in range
%zd:%zd"),
In context, it is because we are using SSIZE_MAX as the argument paired
to %zd.
Technically, the standards documents do NOT require ssize_t to have any
relation to size_t, and thus there is NO portable way to pass ssize_t
values to printf() without a cast; but in practice, most systems are
sane enough that 'ssize_t' is the same type as 'signed size_t', as
requested by gcc. This includes 32-bit glibc (where size_t is unsigned
int, and ssize_t is int).
But it turns out it is a glibc bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=13575 - SSIZE_MAX must
have type ssize_t, and glibc is at fault for defining it as a 'long'
value even when ssize_t is an 'int'.
Once gnulib works around it, I'll update libvirt's gnulib submodule to
fix the libvirt build on 32-bit Linux again.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
8 years, 11 months
[libvirt] [PATCH] virConfGetValueSSizeT: Fix build on 32 bits
by Michal Privoznik
This function tries to get a ssize_t value from a config file.
But before returning it, it checks whether the value would fit in
ssize_t and if not an error is printed out among with the range
for the ssize_t type. However, on some platforms SSIZE_MAX may
actually be a signed long type:
util/virconf.c: In function 'virConfGetValueSSizeT':
util/virconf.c:1268:9: error: format '%zd' expects argument of type 'signed size_t', but argument 9 has type 'long int' [-Werror=format=]
virReportError(VIR_ERR_INTERNAL_ERROR,
^
$ grep -r SSIZE_MAX /usr/include/
/usr/include/bits/posix1_lim.h:#ifndef SSIZE_MAX
/usr/include/bits/posix1_lim.h:# define SSIZE_MAX LONG_MAX
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virconf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 5085768..4dc82ec 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1267,7 +1267,8 @@ int virConfGetValueSSizeT(virConfPtr conf,
if (cval->l > SSIZE_MAX || cval->l < (-SSIZE_MAX - 1)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: value for '%s' parameter must be in range %zd:%zd"),
- conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
+ conf->filename, setting,
+ (ssize_t) -SSIZE_MAX - 1, (ssize_t) SSIZE_MAX);
return -1;
}
--
2.8.4
8 years, 11 months
[libvirt] [PATCH] virconf: skip some range checks if SSIZE_MAX >= LLONG_MAX
by Daniel P. Berrange
If size_t is the same size as long long, then we can skip
some of the range checks. This avoids triggering some
bogus compiler warning messages.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virconf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index f82d114..4813419 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1216,12 +1216,14 @@ int virConfGetValueSizeT(virConfPtr conf,
return -1;
}
} else if (cval->type == VIR_CONF_ULONG) {
+#if ULLONG_MAX > SIZE_MAX
if (((unsigned long long)cval->l) > SIZE_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: value for '%s' parameter must be in range 0:%zu"),
conf->filename, setting, SIZE_MAX);
return -1;
}
+#endif
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected an unsigned integer for '%s' parameter"),
@@ -1271,12 +1273,14 @@ int virConfGetValueSSizeT(virConfPtr conf,
return -1;
}
} else if (cval->type == VIR_CONF_LONG) {
+#if SSIZE_MAX < LLONG_MAX
if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: value for '%s' parameter must be in range %zd:%zd"),
conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
return -1;
}
+#endif
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected a signed integer for '%s' parameter"),
--
2.7.4
8 years, 11 months
[libvirt] [PATCH] conf: Revert changes to add new secret type "passphrase"
by John Ferlan
Revert the remainder of commit id 'c84380106'
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
This "replaces" patch 3 of my other series - essentially removing all
traces of the 'passphrase' changes - as requested via code review.
docs/aclpolkit.html.in | 4 ----
docs/schemas/secret.rng | 10 ----------
include/libvirt/libvirt-secret.h | 1 -
src/access/viraccessdriverpolkit.c | 13 -------------
src/conf/secret_conf.c | 22 +---------------------
src/conf/secret_conf.h | 1 -
src/conf/virsecretobj.c | 5 -----
tests/secretxml2xmlin/usage-passphrase.xml | 7 -------
tests/secretxml2xmltest.c | 1 -
9 files changed, 1 insertion(+), 63 deletions(-)
delete mode 100644 tests/secretxml2xmlin/usage-passphrase.xml
diff --git a/docs/aclpolkit.html.in b/docs/aclpolkit.html.in
index 4d0307d..dae0814 100644
--- a/docs/aclpolkit.html.in
+++ b/docs/aclpolkit.html.in
@@ -224,10 +224,6 @@
<td>secret_usage_target</td>
<td>Name of the associated iSCSI target, if any</td>
</tr>
- <tr>
- <td>secret_usage_name</td>
- <td>Name of be associated passphrase secret, if any</td>
- </tr>
</tbody>
</table>
diff --git a/docs/schemas/secret.rng b/docs/schemas/secret.rng
index cac8560..e21e700 100644
--- a/docs/schemas/secret.rng
+++ b/docs/schemas/secret.rng
@@ -36,7 +36,6 @@
<ref name='usagevolume'/>
<ref name='usageceph'/>
<ref name='usageiscsi'/>
- <ref name='usagepassphrase'/>
<!-- More choices later -->
</choice>
</element>
@@ -72,13 +71,4 @@
</element>
</define>
- <define name='usagepassphrase'>
- <attribute name='type'>
- <value>passphrase</value>
- </attribute>
- <element name='name'>
- <ref name='genericName'/>
- </element>
- </define>
-
</grammar>
diff --git a/include/libvirt/libvirt-secret.h b/include/libvirt/libvirt-secret.h
index 55b11e0..02728ba 100644
--- a/include/libvirt/libvirt-secret.h
+++ b/include/libvirt/libvirt-secret.h
@@ -43,7 +43,6 @@ typedef enum {
VIR_SECRET_USAGE_TYPE_VOLUME = 1,
VIR_SECRET_USAGE_TYPE_CEPH = 2,
VIR_SECRET_USAGE_TYPE_ISCSI = 3,
- VIR_SECRET_USAGE_TYPE_PASSPHRASE = 4,
# ifdef VIR_ENUM_SENTINELS
VIR_SECRET_USAGE_TYPE_LAST
diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
index 99b867f..89bc890 100644
--- a/src/access/viraccessdriverpolkit.c
+++ b/src/access/viraccessdriverpolkit.c
@@ -338,19 +338,6 @@ virAccessDriverPolkitCheckSecret(virAccessManagerPtr manager,
virAccessPermSecretTypeToString(perm),
attrs);
} break;
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE: {
- const char *attrs[] = {
- "connect_driver", driverName,
- "secret_uuid", uuidstr,
- "secret_usage_name", secret->usage.name,
- NULL,
- };
-
- return virAccessDriverPolkitCheck(manager,
- "secret",
- virAccessPermSecretTypeToString(perm),
- attrs);
- } break;
}
}
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index a973aa9..d510645 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -29,7 +29,6 @@
#include "viralloc.h"
#include "secret_conf.h"
#include "virsecretobj.h"
-#include "virstring.h"
#include "virerror.h"
#include "virxml.h"
#include "viruuid.h"
@@ -39,7 +38,7 @@
VIR_LOG_INIT("conf.secret_conf");
VIR_ENUM_IMPL(virSecretUsage, VIR_SECRET_USAGE_TYPE_LAST,
- "none", "volume", "ceph", "iscsi", "passphrase")
+ "none", "volume", "ceph", "iscsi")
const char *
virSecretUsageIDForDef(virSecretDefPtr def)
@@ -57,9 +56,6 @@ virSecretUsageIDForDef(virSecretDefPtr def)
case VIR_SECRET_USAGE_TYPE_ISCSI:
return def->usage.target;
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE:
- return def->usage.name;
-
default:
return NULL;
}
@@ -89,10 +85,6 @@ virSecretDefFree(virSecretDefPtr def)
VIR_FREE(def->usage.target);
break;
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE:
- VIR_FREE(def->usage.name);
- break;
-
default:
VIR_ERROR(_("unexpected secret usage type %d"), def->usage_type);
break;
@@ -153,14 +145,6 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
}
break;
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE:
- if (!(def->usage.name = virXPathString("string(./usage/name)", ctxt))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("passphrase usage specified, but name is missing"));
- return -1;
- }
- break;
-
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected secret usage type %d"),
@@ -313,10 +297,6 @@ virSecretDefFormatUsage(virBufferPtr buf,
virBufferEscapeString(buf, "<target>%s</target>\n", def->usage.target);
break;
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE:
- virBufferEscapeString(buf, "<name>%s</name>\n", def->usage.name);
- break;
-
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected secret usage type %d"),
diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h
index c34880f..4584403 100644
--- a/src/conf/secret_conf.h
+++ b/src/conf/secret_conf.h
@@ -40,7 +40,6 @@ struct _virSecretDef {
char *volume; /* May be NULL */
char *ceph;
char *target;
- char *name;
} usage;
};
diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 6714a00..30a5e80 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -237,11 +237,6 @@ virSecretObjSearchName(const void *payload,
if (STREQ(secret->def->usage.target, data->usageID))
found = 1;
break;
-
- case VIR_SECRET_USAGE_TYPE_PASSPHRASE:
- if (STREQ(secret->def->usage.name, data->usageID))
- found = 1;
- break;
}
cleanup:
diff --git a/tests/secretxml2xmlin/usage-passphrase.xml b/tests/secretxml2xmlin/usage-passphrase.xml
deleted file mode 100644
index 2b94b80..0000000
--- a/tests/secretxml2xmlin/usage-passphrase.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<secret ephemeral='no' private='no'>
- <uuid>f52a81b2-424e-490c-823d-6bd4235bc572</uuid>
- <description>Sample Passphrase Secret</description>
- <usage type='passphrase'>
- <name>mumblyfratz</name>
- </usage>
-</secret>
diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c
index c444e4d..8dcbb40 100644
--- a/tests/secretxml2xmltest.c
+++ b/tests/secretxml2xmltest.c
@@ -80,7 +80,6 @@ mymain(void)
DO_TEST("usage-volume");
DO_TEST("usage-ceph");
DO_TEST("usage-iscsi");
- DO_TEST("usage-passphrase");
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.5.5
8 years, 11 months
[libvirt] [PATCH] config: Add listen address setter
by Visarion Alexandru
Learn to set the address the domain is listening on.
---
.../libvirt-gconfig-domain-graphics-spice.c | 18 ++++++++++++++++++
.../libvirt-gconfig-domain-graphics-spice.h | 3 +++
libvirt-gconfig/libvirt-gconfig.sym | 1 +
3 files changed, 22 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 079ea27..a773084 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -165,3 +165,21 @@ void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra
gvir_config_object_replace_child_with_attribute_enum
(GVIR_CONFIG_OBJECT(graphics), "gl", "enable", G_TYPE_BOOLEAN, gl);
}
+
+void gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice *graphics,
+ const char *address)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), "listen", address, NULL);
+
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics),
+ "listen",
+ "address",
+ address);
+
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics),
+ "listen",
+ "type",
+ "address");
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 25c132e..4bca850 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -95,6 +95,9 @@ gvir_config_domain_graphics_spice_get_image_compression
void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics,
gboolean gl);
+void gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice *graphics,
+ const char *address);
+
G_END_DECLS
#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SPICE_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index f11f97a..86768ae 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -736,6 +736,7 @@ global:
LIBVIRT_GCONFIG_0.2.4 {
gvir_config_domain_graphics_spice_set_gl;
gvir_config_domain_video_set_accel3d;
+ gvir_config_domain_graphics_spice_set_listen_address;
} LIBVIRT_GCONFIG_0.2.2;
# .... define new API here using predicted next version number ....
--
2.5.5
8 years, 11 months
[libvirt] [PATCH 00/16] Add typedef accessors for virConf
by Daniel P. Berrange
Every caller of virConfGetValue is doing the same kind of
dance to ensure the returned value is set and has the
right kind of type. This is a clear sign we should have
typesafe APIs for accessor virConf values.
This series introduces such APIs and converts much of
the code. What is not converted is src/lxc/lxc_native.c,
src/vmx/vmx.c, src/xenconfig/xen_common.c and
src/xenconfig/xen_xl.c. These are left as an exercise
for someone else.
Daniel P. Berrange (16):
tests: remove pointless virconftest.sh wrapper
virconf: fix off-by-1 when appending \n to config file
virconf: add typed value accessor methods
libvirtd: convert to typesafe virConf accessors
qemu: convert to typesafe virConf accessors
libvirt: convert to typesafe virConf accessors
virtlockd: convert to typesafe virConf accessors
virtlogd: convert to typedef virConf accessors
lxc: convert to typesafe virConf accessors
libxl: convert to typesafe virConf accessors
uri: convert to typesafe virConf accessors
virt-login-shell: convert to typesafe virConf accessors
selinux: convert to typesafe virConf accessors
lockd: convert to typesafe virConf accessors
sanlock: convert to typesafe virConf accessors
remote: convert to typesafe virConf accessors
daemon/libvirtd-config.c | 306 ++++++++---------------
daemon/libvirtd-config.h | 42 ++--
po/POTFILES.in | 2 -
src/libvirt-admin.c | 66 ++---
src/libvirt.c | 70 +++---
src/libvirt_private.syms | 10 +
src/libxl/libxl_conf.c | 53 +---
src/locking/lock_daemon_config.c | 90 +------
src/locking/lock_daemon_config.h | 9 +-
src/locking/lock_driver_lockd.c | 61 ++---
src/locking/lock_driver_sanlock.c | 97 +++-----
src/logging/log_daemon_config.c | 96 +-------
src/logging/log_daemon_config.h | 7 +-
src/lxc/lxc_conf.c | 49 ++--
src/lxc/lxc_conf.h | 2 +-
src/qemu/qemu_conf.c | 395 ++++++++++++------------------
src/qemu/qemu_conf.h | 20 +-
src/remote/remote_driver.c | 15 +-
src/security/security_selinux.c | 42 ++--
src/util/virconf.c | 502 +++++++++++++++++++++++++++++++++++++-
src/util/virconf.h | 34 ++-
src/util/viruri.c | 48 ++--
tests/Makefile.am | 19 +-
tests/libvirtdconftest.c | 245 -------------------
tests/virconftest.c | 411 ++++++++++++++++++++++++++++++-
tests/virconftest.sh | 26 --
tools/virt-login-shell.c | 141 +++--------
27 files changed, 1488 insertions(+), 1370 deletions(-)
delete mode 100644 tests/libvirtdconftest.c
delete mode 100755 tests/virconftest.sh
--
2.7.4
8 years, 11 months
[libvirt] [PATCH] qemu: don't set fake reboot if it will not be used
by Nikolay Shirokovskiy
The use case is similar to e2b86f580. First call shutdown with
reboot semantics in agent mode. As a result fake reboot flag is set.
Next issue shutdown from guest and you will get reboot due to fake
reboot flag set.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d184b..f9562bd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1997,8 +1997,6 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
useAgent = false;
}
- qemuDomainSetFakeReboot(driver, vm, isReboot);
-
if (useAgent) {
qemuDomainObjEnterAgent(vm);
ret = qemuAgentShutdown(priv->agent, agentFlag);
@@ -2018,6 +2016,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
goto endjob;
}
+ qemuDomainSetFakeReboot(driver, vm, isReboot);
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorSystemPowerdown(priv->mon);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
--
1.8.3.1
8 years, 11 months
[libvirt] [PATCH] tests: command: Fix build on ppc64/aarch64
by Andrea Bolognani
Commit ca10bb040fcf introduced a new test that fails to build
on at least some architectures:
commandtest.c: In function 'test25':
commandtest.c:1121:5: error: comparison is always true due to
limited range of data type [-Werror=type-limits]
if (rv >= 0) {
^
Change the type of 'rv' from char to int, which is the proper
return type for virCommandExec() anyway.
---
Posting this to the list so that Michal/others can chime in.
Using int instead of char seems completely safe here, and in
fact should probably have been the right choice from the start.
On the other hand, I would expect this kind of error if we were
using unsigned char, not plain char... By the way, changing it
to signed char is another way to get the code to compile again
on ppc64/aarch64.
tests/commandtest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 2b77b9b..7bf5447 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -1068,7 +1068,7 @@ static int test25(const void *unused ATTRIBUTE_UNUSED)
{
int ret = -1;
int pipeFD[2] = { -1, -1};
- char rv = 0;
+ int rv = 0;
ssize_t tries = 100;
pid_t pid;
--
2.7.4
8 years, 11 months
[libvirt] Disconnected from qemu, keepalive timeout
by Nir Levy
Hello Guys,
Thanks for reading this,
I have compiled libvirt and qemu over fedora 22 for using debug information and no opt ("-g3 -O0").
I am investigating the xml feature
<qemu:commandline>
<qemu:arg value='-trace'/>
<qemu:arg value='events=/home/qemu_traced_symbols'/>
</qemu:commandline>
qemu_traced_symbols includes all qemu traced symbols.
I have used:
catch syscall clone
set follow-fork-mode child
set detach-on-fork off
and debugged the child
so after libvirt start VM2 wanted to debug the parameters (cmd->args, which indeed includes -trace and events=/home/qemu_traced_symbols
I have debugged the the child after spawning.
And returned for the parent (using gdb inferior 1)
for debugging the virCommandHandshakeWait (with the args)
but I keep getting
error: Disconnected from qemu:///system due to keepalive timeout
grep @ libvirt-1.2.21/ shows no code only change log.
Can you please help me resolve this issue?
How do those args are passed, is it via JSON?
Kind regards,
Nir Levy
SW Engineer
Web: www.asocstech.com<http://www.asocstech.com/> |
[cid:image001.jpg@01D1B599.5A2C9530]
8 years, 11 months