[libvirt] [libvirt-glib 1/5] gconfig: Fix gvir_config_domain_os_get_boot_devices() API doc
by Christophe Fergeau
The elements of the returned list are integer enum values, so they cannot
be unreffed.
---
libvirt-gconfig/libvirt-gconfig-domain-os.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c
index 03c8a85..b922a0e 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-os.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c
@@ -267,8 +267,7 @@ static gboolean add_boot_device(xmlNodePtr node, gpointer opaque)
* @os: a #GVirConfigDomainOs
*
* Gets the list of devices attached to @os. The returned list should be
- * freed with g_list_free(), after its elements have been unreffed with
- * g_object_unref().
+ * freed with g_list_free().
*
* Returns: (element-type LibvirtGConfig.DomainOsBootDevice) (transfer full):
* a newly allocated #GList of #GVirConfigDomainOsBootDevice.
--
1.8.4.2
10 years, 10 months
[libvirt] [PATCHv2 0/2] Fix problems with "forwardPlainNames"
by Laine Stump
changes from V1:
* Fix the test cases
* more information in commit log
* Add 2nd patch to make default forwardPlainNames='yes', as suggested
by danpb (since that was the original behavior).
Here is the thread of the original patch:
https://www.redhat.com/archives/libvir-list/2013-December/msg00397.html
(continued here in January):
https://www.redhat.com/archives/libvir-list/2014-January/msg01521.html
I believe I've addressed Daniel's concerns except the ability to
prevent forwarding of unresolved names in the configured domain, but
that was never the intended behavior to begin with. These patches fix
the bugs in the currently advertised behavior; we can create followup
patches for this "new" behavior if there is demand (so far there have
only been people saying that behavior should be *removed* :-)
Laine Stump (2):
network: only prevent forwarding of DNS requests for unqualified names
network: change default of forwardPlainNames to 'yes'
src/conf/network_conf.c | 32 +++++++++++++++-------
src/conf/network_conf.h | 17 ++++++++++--
src/network/bridge_driver.c | 17 +++++-------
tests/networkxml2confdata/dhcp6-nat-network.conf | 2 --
tests/networkxml2confdata/dhcp6-network.conf | 2 --
.../dhcp6host-routed-network.conf | 2 --
tests/networkxml2confdata/isolated-network.conf | 2 --
.../nat-network-dns-forwarders.conf | 2 --
.../networkxml2confdata/nat-network-dns-hosts.conf | 4 +--
.../nat-network-dns-srv-record-minimal.conf | 2 --
.../nat-network-dns-srv-record.conf | 2 --
.../nat-network-dns-txt-record.conf | 2 --
tests/networkxml2confdata/nat-network.conf | 2 --
tests/networkxml2confdata/netboot-network.conf | 2 --
.../networkxml2confdata/netboot-proxy-network.conf | 2 --
tests/networkxml2confdata/routed-network.conf | 2 --
tests/networkxml2xmlout/nat-network-dns-hosts.xml | 2 +-
.../nat-network-dns-more-hosts.xml | 2 +-
.../nat-network-no-hosts.xml | 1 +
19 files changed, 49 insertions(+), 50 deletions(-)
--
1.8.5.3
10 years, 10 months
[libvirt] [PATCH] Host cpu offline/online removes the cpus available for vms
by Shivaprasad G Bhat
Online/Offline operations on the host cpus removes the machine/cpuset.cpus
which are never added back. The guests with vcpu pinning can fail to boot
unless the xml is edited.
If the possibility that the offlined cpus are onlined back, the cpuset.cpus can be updated upon start of the guest thus allowing the guests to boot back without
erroring out.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/util/vircgroup.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a6d60c5..52575c9 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -72,6 +72,7 @@ typedef enum {
* before creating subcgroups and
* attaching tasks
*/
+ VIR_CGROUP_CPUS_HIERACHY = 1 << 1, /* call virCgroupCpuSetInherit */
} virCgroupFlags;
@@ -891,6 +892,7 @@ virCgroupMakeGroup(virCgroupPtr parent,
VIR_DEBUG("Make group %s", group->path);
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
char *path = NULL;
+ int inheritCpuset = 0;
/* We must never mkdir() in systemd's hierarchy */
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
@@ -933,15 +935,7 @@ virCgroupMakeGroup(virCgroupPtr parent,
goto cleanup;
}
}
- if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL &&
- (i == VIR_CGROUP_CONTROLLER_CPUSET ||
- STREQ(group->controllers[i].mountPoint,
- group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
- if (virCgroupCpuSetInherit(parent, group) < 0) {
- VIR_FREE(path);
- goto cleanup;
- }
- }
+ inheritCpuset = 1;
/*
* Note that virCgroupSetMemoryUseHierarchy should always be
* called prior to creating subcgroups and attaching tasks.
@@ -958,6 +952,19 @@ virCgroupMakeGroup(virCgroupPtr parent,
}
}
+ if (inheritCpuset || (flags & VIR_CGROUP_CPUS_HIERACHY))
+ {
+ if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL &&
+ (i == VIR_CGROUP_CONTROLLER_CPUSET ||
+ STREQ(group->controllers[i].mountPoint,
+ group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
+ if (virCgroupCpuSetInherit(parent, group) < 0) {
+ VIR_FREE(path);
+ goto cleanup;
+ }
+ }
+ }
+
VIR_FREE(path);
}
@@ -1275,7 +1282,7 @@ virCgroupNewPartition(const char *path,
if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0)
goto cleanup;
- if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0) {
+ if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_CPUS_HIERACHY) < 0) {
virCgroupRemove(*group);
goto cleanup;
}
10 years, 10 months
[libvirt] [PATCH] qemu: minor cleanups
by Martin Kletzander
Some cleanups around serial chardevs and miscellaneous things I've
found inconsistent or not very clean.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/domain_conf.c | 43 ++++++++++++++++++++++++++-----------------
src/qemu/qemu_capabilities.c | 4 ++--
src/qemu/qemu_command.c | 10 ++++++++--
3 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 28e24f9..fa1ecb5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1559,7 +1559,7 @@ virDomainChrSourceDefIsEqual(const virDomainChrSourceDef *src,
if (tgt->type != src->type)
return false;
- switch (src->type) {
+ switch ((enum virDomainChrType)src->type) {
case VIR_DOMAIN_CHR_TYPE_PTY:
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_FILE:
@@ -1583,16 +1583,22 @@ virDomainChrSourceDefIsEqual(const virDomainChrSourceDef *src,
STREQ_NULLABLE(src->data.nix.path, tgt->data.nix.path);
break;
+ case VIR_DOMAIN_CHR_TYPE_NULL:
case VIR_DOMAIN_CHR_TYPE_VC:
case VIR_DOMAIN_CHR_TYPE_STDIO:
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
+ case VIR_DOMAIN_CHR_TYPE_LAST:
/* nada */
return true;
}
- /* This should happen only on new,
- * yet unhandled type */
+ /* Even though gcc is able to detect that all possible values are
+ * handled in the switch above, it is not capable of realizing
+ * there isn't any possibility of escaping that switch without
+ * return. So for the sake of clean compilation, there has to be
+ * a return here */
+ /* coverity[dead_error_begin] */
return false;
}
@@ -6415,7 +6421,7 @@ error:
}
#define NET_MODEL_CHARS \
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ091234567890_-"
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
/* Parse the XML definition for a network interface
* @param node XML nodeset to parse for net definition
@@ -7182,11 +7188,11 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
}
switch ((enum virDomainChrType) def->type) {
- case VIR_DOMAIN_CHR_TYPE_LAST:
case VIR_DOMAIN_CHR_TYPE_NULL:
+ case VIR_DOMAIN_CHR_TYPE_VC:
case VIR_DOMAIN_CHR_TYPE_STDIO:
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
- case VIR_DOMAIN_CHR_TYPE_VC:
+ case VIR_DOMAIN_CHR_TYPE_LAST:
break;
case VIR_DOMAIN_CHR_TYPE_PTY:
@@ -15573,11 +15579,13 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
}
virBufferAddLit(buf, ">\n");
- switch (def->type) {
+ virBufferAdjustIndent(buf, 6);
+ switch ((enum virDomainChrType)def->type) {
case VIR_DOMAIN_CHR_TYPE_NULL:
case VIR_DOMAIN_CHR_TYPE_VC:
case VIR_DOMAIN_CHR_TYPE_STDIO:
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
+ case VIR_DOMAIN_CHR_TYPE_LAST:
/* nada */
break;
@@ -15588,7 +15596,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
if (def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
(def->data.file.path &&
!(flags & VIR_DOMAIN_XML_INACTIVE))) {
- virBufferEscapeString(buf, " <source path='%s'/>\n",
+ virBufferEscapeString(buf, "<source path='%s'/>\n",
def->data.file.path);
}
break;
@@ -15597,53 +15605,54 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
if (def->data.udp.bindService &&
def->data.udp.bindHost) {
virBufferAsprintf(buf,
- " <source mode='bind' host='%s' "
+ "<source mode='bind' host='%s' "
"service='%s'/>\n",
def->data.udp.bindHost,
def->data.udp.bindService);
} else if (def->data.udp.bindHost) {
- virBufferAsprintf(buf, " <source mode='bind' host='%s'/>\n",
+ virBufferAsprintf(buf, "<source mode='bind' host='%s'/>\n",
def->data.udp.bindHost);
} else if (def->data.udp.bindService) {
- virBufferAsprintf(buf, " <source mode='bind' service='%s'/>\n",
+ virBufferAsprintf(buf, "<source mode='bind' service='%s'/>\n",
def->data.udp.bindService);
}
if (def->data.udp.connectService &&
def->data.udp.connectHost) {
virBufferAsprintf(buf,
- " <source mode='connect' host='%s' "
+ "<source mode='connect' host='%s' "
"service='%s'/>\n",
def->data.udp.connectHost,
def->data.udp.connectService);
} else if (def->data.udp.connectHost) {
- virBufferAsprintf(buf, " <source mode='connect' host='%s'/>\n",
+ virBufferAsprintf(buf, "<source mode='connect' host='%s'/>\n",
def->data.udp.connectHost);
} else if (def->data.udp.connectService) {
virBufferAsprintf(buf,
- " <source mode='connect' service='%s'/>\n",
+ "<source mode='connect' service='%s'/>\n",
def->data.udp.connectService);
}
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
virBufferAsprintf(buf,
- " <source mode='%s' host='%s' service='%s'/>\n",
+ "<source mode='%s' host='%s' service='%s'/>\n",
def->data.tcp.listen ? "bind" : "connect",
def->data.tcp.host,
def->data.tcp.service);
- virBufferAsprintf(buf, " <protocol type='%s'/>\n",
+ virBufferAsprintf(buf, "<protocol type='%s'/>\n",
virDomainChrTcpProtocolTypeToString(
def->data.tcp.protocol));
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
- virBufferAsprintf(buf, " <source mode='%s'",
+ virBufferAsprintf(buf, "<source mode='%s'",
def->data.nix.listen ? "bind" : "connect");
virBufferEscapeString(buf, " path='%s'", def->data.nix.path);
virBufferAddLit(buf, "/>\n");
break;
}
+ virBufferAdjustIndent(buf, -6);
return 0;
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8420047..8aec293 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1,7 +1,7 @@
/*
* qemu_capabilities.c: QEMU capabilities generation
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -247,7 +247,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"boot-strict", /* 160 */
"pvpanic",
"enable-fips",
- "spice-file-xfer-disable"
+ "spice-file-xfer-disable",
);
struct _virQEMUCaps {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 96b8825..2db745a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1,7 +1,7 @@
/*
* qemu_command.c: QEMU command generation
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -6004,7 +6004,7 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix)
if (prefix)
virBufferAdd(&buf, prefix, strlen(prefix));
- switch (dev->type) {
+ switch ((enum virDomainChrType)dev->type) {
case VIR_DOMAIN_CHR_TYPE_NULL:
virBufferAddLit(&buf, "null");
break;
@@ -6071,6 +6071,12 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix)
dev->data.nix.path,
dev->data.nix.listen ? ",server,nowait" : "");
break;
+
+ case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
+ /* spicevmc doesn't have any '-serial' compatible option */
+ case VIR_DOMAIN_CHR_TYPE_LAST:
+ /* coverity[dead_error_begin] */
+ break;
}
if (virBufferError(&buf)) {
--
1.8.5.3
10 years, 10 months
[libvirt] [PATCHv7 0/2] Implement RBD storage pool support
by Adam Walters
Here is a re-based and fixed up re-submission of my patches to implement RBD
storage pool support for QEMU domains. Nothing in it has changed much, other
than it has been rebased against the lastest libvirt and two of my patches
have been squashed in order to pass a make, make check, and make syntax-check
after each individual patch.
The code here still works well for me, but I only have the one host to test
this on. If possible, I would like to try and get this merged for the 1.2.2
release cycle, so that other users can benefit from the added storage pool
support. As always, if you find any problems with my patches, please let me
know, and I will fix them up as soon as time permits.
Adam Walters (2):
qemu: conf Implement domain RBD storage pool support
domain: conf: Fix secret type checking for network volumes
src/conf/domain_conf.c | 6 +++--
src/qemu/qemu_conf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 3 deletions(-)
--
1.8.5.2
10 years, 10 months
[libvirt] [PATCH V3]Sheepdog: Auto Adding volume and pool refresh.
by joel SIMOES
From: Joel <joel.simoes(a)laposte.net>
Fix bug 1055479
https://bugzilla.redhat.com/show_bug.cgi?id=1055479
Libvirt lose sheepdogs volumes on pool refresh or restart.
When restarting sheepdog pool, all volumes are missing.
This patch add automatically all volume from the added pool.
---
src/storage/storage_backend_sheepdog.c | 74 +++++++++++++++++++++++++++++++++-
1 file changed, 72 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index a6981ce..a836f27 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -109,6 +109,70 @@ virStorageBackendSheepdogAddHostArg(virCommandPtr cmd,
virCommandAddArgFormat(cmd, "%d", port);
}
+static int
+virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolObjPtr pool)
+{
+ int ret;
+ char *output = NULL;
+
+ virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "list", "-r", NULL);
+ virStorageBackendSheepdogAddHostArg(cmd, pool);
+ virCommandSetOutputBuffer(cmd, &output);
+ ret = virCommandRun(cmd, NULL);
+ char** lines;
+ char** cells;
+
+ if (ret < 0)
+ goto cleanup;
+
+ ret = -1;
+ lines = virStringSplit(output, "\n", 0);
+ size_t i;
+ for (i = 0; *(lines + i); i++) {
+ char *line = *(lines + i);
+ cells = virStringSplit(line, " ", 0);
+ size_t j;
+ for (j = 0; *(cells + j); j++) {
+
+ char *cell = *(cells + j);
+ if (j == 1) {
+ virStorageVolDefPtr vol = NULL;
+ if (VIR_ALLOC(vol) < 0)
+ goto cleanup;
+
+ if (VIR_STRDUP(vol->name, cell) < 0)
+ goto cleanup;
+
+ vol->type = VIR_STORAGE_VOL_BLOCK;
+
+ if (VIR_EXPAND_N(pool->volumes.objs, pool->volumes.count, 1) < 0)
+ goto cleanup;
+ pool->volumes.objs[pool->volumes.count - 1] = vol;
+
+ if (virStorageBackendSheepdogRefreshVol(conn, pool, vol) < 0)
+ goto cleanup;
+
+ vol = NULL;
+ }
+
+ VIR_FREE(*(cells + j));
+ }
+
+ VIR_FREE(cells);
+ VIR_FREE(*(lines + i));
+ }
+
+
+ VIR_FREE(lines);
+ ret = 0;
+
+cleanup:
+ virCommandFree(cmd);
+ VIR_FREE(lines);
+ VIR_FREE(cells);
+ return ret;
+}
static int
virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -122,9 +186,15 @@ virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
ret = virCommandRun(cmd, NULL);
- if (ret == 0)
- ret = virStorageBackendSheepdogParseNodeInfo(pool->def, output);
+ if (ret < 0)
+ goto cleanup;
+ ret = virStorageBackendSheepdogParseNodeInfo(pool->def, output);
+ if (ret < 0)
+ goto cleanup;
+ ret = virStorageBackendSheepdogRefreshAllVol(conn, pool);
+
+cleanup:
virCommandFree(cmd);
VIR_FREE(output);
return ret;
--
1.8.3.2
10 years, 10 months
[libvirt] [PATCH] spice: don't force user to specify spicevmc channel
by Martin Kletzander
We support only one spicevmc channel name anyway and the code is
prepared to use the default one, there's only one check missing. I'm
not adding it to documentation in case there is another channel name
aded in the future, but this helps people using virsh for defining
domains with spice vdagent.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
I extended the context to see what I meant by "the code is already
prepared to use the default one".
src/qemu/qemu_command.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2db745a..2124477 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6127,30 +6127,31 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
"%s", _("virtio serial device has invalid address type"));
goto error;
}
virBufferAsprintf(&buf,
",bus=" QEMU_VIRTIO_SERIAL_PREFIX "%d.%d",
dev->info.addr.vioserial.controller,
dev->info.addr.vioserial.bus);
virBufferAsprintf(&buf,
",nr=%d",
dev->info.addr.vioserial.port);
}
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
+ dev->target.name &&
STRNEQ_NULLABLE(dev->target.name, "com.redhat.spice.0")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported spicevmc target name '%s'"),
dev->target.name);
goto error;
}
if (!(dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) {
virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
dev->info.alias, dev->info.alias);
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) {
virBufferAsprintf(&buf, ",name=%s", dev->target.name
? dev->target.name : "com.redhat.spice.0");
--
1.8.5.3
10 years, 10 months
[libvirt] [PATCH v2] Resolve Coverity dead_error_begin
by John Ferlan
Coverity complains about default: label in libxl_driver.c not be able
to be reached. It's by design for the code and since it's not necessary
in the code nor does it elicit any compiler/make check warnings - just
remove it rather than adding a coverity[dead_error_begin] tag.
While I'm at it, lxc_driver.c and nodeinfo.c have the same design, so I
removed the default labels and the existing coverity tags.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/libxl/libxl_driver.c | 3 ---
src/lxc/lxc_driver.c | 15 ---------------
src/nodeinfo.c | 4 ----
3 files changed, 22 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index fc0efa2..cb3deec 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4167,9 +4167,6 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
nodeset = NULL;
break;
-
- default:
- break;
}
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 73a2986..138c706 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -950,11 +950,6 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
VIR_TYPED_PARAM_ULLONG, val) < 0)
goto cleanup;
break;
-
- /* coverity[dead_error_begin] */
- default:
- break;
- /* should not hit here */
}
}
@@ -2626,11 +2621,6 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
param->value.s) < 0)
goto cleanup;
break;
-
- /* coverity[dead_error_begin] */
- default:
- break;
- /* should not hit here */
}
}
} else if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -2818,11 +2808,6 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
goto cleanup;
}
break;
-
- /* coverity[dead_error_begin] */
- default:
- break;
- /* should not hit here */
}
}
}
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 6ebfb4b..22b139f 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1478,10 +1478,6 @@ nodeGetMemoryParameters(virTypedParameterPtr params ATTRIBUTE_UNUSED,
return -1;
break;
-
- /* coverity[dead_error_begin] */
- default:
- break;
}
}
--
1.8.4.2
10 years, 10 months
[libvirt] [PATCH] libxl: Resove Coverity dead_error_begin
by John Ferlan
Coverity complains about default: label not be able to be reached. It's by
design for the code, so just add a Coverity tag for dead_error_begin
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/libxl/libxl_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index fc0efa2..513a597 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4168,6 +4168,7 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
break;
+ /* coverity[dead_error_begin] */
default:
break;
}
--
1.8.4.2
10 years, 10 months
[libvirt] [PATCH] virnetdevbandwidthtest: Introduce some more tests
by Michal Privoznik
And while doing this, fix one error raised by coverity. With
current code, @actual_cmd is allowed to be NULL for the whole
run of testVirNetDevBandwidthSet. However, if something else
was expected, the @actal_cmd is passed to virtTestDifference
which dereference it immediately.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/virnetdevbandwidthtest.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 5bcab12..073fdf8 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -92,7 +92,9 @@ testVirNetDevBandwidthSet(const void *data)
}
if (STRNEQ_NULLABLE(info->exp_cmd, actual_cmd)) {
- virtTestDifference(stderr, info->exp_cmd, actual_cmd);
+ virtTestDifference(stderr,
+ NULLSTR(info->exp_cmd),
+ NULLSTR(actual_cmd));
goto cleanup;
}
@@ -121,6 +123,31 @@ mymain(void)
} while (0)
+ DO_TEST_SET(NULL, NULL);
+
+ DO_TEST_SET(("<bandwidth/>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"));
+
+ DO_TEST_SET(("<bandwidth>"
+ " <inbound average='1024'/>"
+ "</bandwidth>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"
+ TC " qdisc add dev eth0 root handle 1: htb default 1\n"
+ TC " class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps\n"
+ TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
+ TC " filter add dev eth0 parent 1:0 protocol ip handle 1 fw flowid 1\n"));
+
+ DO_TEST_SET(("<bandwidth>"
+ " <outbound average='1024'/>"
+ "</bandwidth>"),
+ (TC " qdisc del dev eth0 root\n"
+ TC " qdisc del dev eth0 ingress\n"
+ TC " qdisc add dev eth0 ingress\n"
+ TC " filter add dev eth0 parent ffff: protocol ip u32 match ip src 0.0.0.0/0 "
+ "police rate 1024kbps burst 1024kb mtu 64kb drop flowid :1\n"));
+
DO_TEST_SET(("<bandwidth>"
" <inbound average='1' peak='2' floor='3' burst='4'/>"
" <outbound average='5' peak='6' burst='7'/>"
--
1.8.5.2
10 years, 10 months