On Tue, Dec 09, 2014 at 04:52:16PM +0100, Michal Privoznik wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1160995 In our config files users are expected to pass several integer values for different configuration knobs. However, majority of them expect a nonnegative number and only a few of them accept a negative number too (notably keepalive_interval in libvirtd.conf). Therefore, a new type to config value is introduced: VIR_CONF_ULONG that is set whenever an integer is positive or zero. With this approach knobs accepting VIR_CONF_LONG should accept VIR_CONF_ULONG too. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- daemon/libvirtd-config.c | 51 ++++++++++++++++++++++++--------------- src/locking/lock_daemon_config.c | 20 ++++++++++++--- src/locking/lock_driver_lockd.c | 4 +-- src/locking/lock_driver_sanlock.c | 6 ++--- src/lxc/lxc_conf.c | 6 ++--- src/qemu/qemu_conf.c | 43 ++++++++++++++++++++++----------- src/util/virconf.c | 4 ++- src/util/virconf.h | 1 + src/xenconfig/xen_common.c | 6 ++--- tests/libvirtdconftest.c | 9 ++++--- 10 files changed, 97 insertions(+), 53 deletions(-)
[...]
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c index 8b93f4e..d589d51 100644 --- a/tests/libvirtdconftest.c +++ b/tests/libvirtdconftest.c @@ -65,7 +65,7 @@ munge_param(const char *datain, if (c_isspace(*tmp)) continue; if (c_isdigit(*tmp)) { - *type = VIR_CONF_LONG; + *type = VIR_CONF_ULONG; replace = "\"foo\""; } else if (*tmp == '[') { *type = VIR_CONF_LIST; @@ -130,15 +130,16 @@ testCorrupt(const void *opaque) #endif switch (type) { - case VIR_CONF_LONG: - if (!strstr(err->message, "invalid type: got string; expected long")) { + case VIR_CONF_ULONG: + if (!strstr(err->message, "invalid type: got string; expected unsigned long") && + !strstr(err->message, "invalid type: got string; expected long")) { VIR_DEBUG("Wrong error for long: '%s'", err->message); ret = -1; } break; case VIR_CONF_STRING: - if (!strstr(err->message, "invalid type: got long; expected string")) { + if (!strstr(err->message, "invalid type: got unsigned long; expected string")) { VIR_DEBUG("Wrong error for string: '%s'", err->message); ret = -1; -- 2.0.4
Special-casing the ULONG and adding a '-2' somewhere in the tests would show you've done the right thing. Anyway, ACK, but I'd wait after release since this does not fix anything, strictly speaking. Martin
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list