[libvirt] [PATCH] Fix Memory Leak in testMessageArrayRef()
by Nehal J Wani
While running virdbustest, it was found that valgrind pointed out
the following memory leaks:
==9996== 17 (8 direct, 9 indirect) bytes in 1 blocks are definitely lost in loss record 9 of 36
==9996== at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==9996== by 0x4A06B62: realloc (vg_replace_malloc.c:662)
==9996== by 0x4C6B587: virReallocN (viralloc.c:245)
==9996== by 0x4C6B6AE: virExpandN (viralloc.c:294)
==9996== by 0x4C82B54: virDBusMessageDecodeArgs (virdbus.c:907)
==9996== by 0x4C83463: virDBusMessageDecode (virdbus.c:1141)
==9996== by 0x402C45: testMessageArrayRef (virdbustest.c:273)
==9996== by 0x404E71: virtTestRun (testutils.c:201)
==9996== by 0x401C2D: mymain (virdbustest.c:479)
==9996== by 0x4055ED: virtTestMain (testutils.c:789)
==9996== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==9996==
==9996== 28 (16 direct, 12 indirect) bytes in 1 blocks are definitely lost in loss record 12 of 36
==9996== at 0x4A06BE0: realloc (vg_replace_malloc.c:662)
==9996== by 0x4C6B587: virReallocN (viralloc.c:245)
==9996== by 0x4C6B6AE: virExpandN (viralloc.c:294)
==9996== by 0x4C82B54: virDBusMessageDecodeArgs (virdbus.c:907)
==9996== by 0x4C83463: virDBusMessageDecode (virdbus.c:1141)
==9996== by 0x402C45: testMessageArrayRef (virdbustest.c:273)
==9996== by 0x404E71: virtTestRun (testutils.c:201)
==9996== by 0x401C2D: mymain (virdbustest.c:479)
==9996== by 0x4055ED: virtTestMain (testutils.c:789)
==9996== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
==9996==
---
tests/virdbustest.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tests/virdbustest.c b/tests/virdbustest.c
index 1870f35..bdb1c24 100644
--- a/tests/virdbustest.c
+++ b/tests/virdbustest.c
@@ -250,6 +250,7 @@ static int testMessageArrayRef(const void *args ATTRIBUTE_UNUSED)
size_t out_nstrv2 = 0;
const char *in_str2 = "World";
char *out_str1 = NULL, *out_str2 = NULL;
+ size_t i = 0;
if (!(msg = dbus_message_new_method_call("org.libvirt.test",
"/org/libvirt/test",
@@ -315,6 +316,12 @@ static int testMessageArrayRef(const void *args ATTRIBUTE_UNUSED)
VIR_FREE(out_int32);
VIR_FREE(out_str1);
VIR_FREE(out_str2);
+ for (i = 0; i < out_nstrv1; i++)
+ VIR_FREE(out_strv1[i]);
+ VIR_FREE(out_strv1);
+ for (i = 0; i < out_nstrv2; i++)
+ VIR_FREE(out_strv2[i]);
+ VIR_FREE(out_strv2);
dbus_message_unref(msg);
return ret;
}
--
1.7.1
10 years, 7 months
[libvirt] [PATCH 0/4] storage: Fix VolOpen error reporting
by Cole Robinson
In https://bugzilla.redhat.com/show_bug.cgi?id=1080613 , something is
causing StorageVolGetXML to fail, but it's not raising any error message.
Code inspection found that most users of VolOpen are susceptible to error
reporting issues.
The first 3 patches are some code reorganization and cleanups that make
it easier to identify the VolOpen callers. Patch 4 fixes up the reporting
issue.
Cole Robinson (4):
storage: Rename UpdateVolInfoFlags to UpdateVolInfo
storage: move block format lookup to shared UpdateVolInfo
storage: Rename VolOpenCheckMode to VolOpen
storage: Always report an error from VolOpen
src/storage/storage_backend.c | 234 +++++++++++++++++-----------------
src/storage/storage_backend.h | 18 +--
src/storage/storage_backend_disk.c | 3 +-
src/storage/storage_backend_fs.c | 28 ++--
src/storage/storage_backend_logical.c | 11 +-
src/storage/storage_backend_mpath.c | 36 +-----
src/storage/storage_backend_scsi.c | 43 +------
7 files changed, 159 insertions(+), 214 deletions(-)
--
1.8.5.3
10 years, 7 months
[libvirt] [PATCH tck 0/6] Fix tests which need a full OS image
by Daniel P. Berrange
A bunch of tests currently attempt to kickstart a full Fedora
OS image install. Everytime I try to update this kickstart to
a new version of Fedora it causes no end of pain. Switch the
tests over to use Richard Jones' virt-builder command which
is part of libguestfs. This makes it trivial to deploy and
customize full OS images from pre-built templates.
Mike - does Suse include a new enough version of libguestfs
to get access to the 'virt-builder' tool yet ?
Daniel P. Berrange (6):
Add ability to provision full OS using virt-builder
Fix path to dnsmasq leases file
Add ability to setup NIC when creating guest XML
Force destroy guests if graceful shutdown fails
Convert nwfilter and domain balloon tests to virtbuilder images
Remove obsolete kickstart provisioning helper methods
Build.PL | 1 -
conf/default.cfg | 25 +++
conf/ks.cfg | 30 ----
lib/Sys/Virt/TCK.pm | 280 +++++++++++++++++++++++++-----
lib/Sys/Virt/TCK/DomainBuilder.pm | 20 ++-
lib/Sys/Virt/TCK/NetworkHelpers.pm | 140 +--------------
perl-Sys-Virt-TCK.spec.PL | 1 -
scripts/domain/110-memory-balloon.t | 10 +-
scripts/nwfilter/090-install-image.t | 55 ------
scripts/nwfilter/100-ping-still-working.t | 54 +++---
scripts/nwfilter/210-no-mac-spoofing.t | 81 +++++----
scripts/nwfilter/220-no-ip-spoofing.t | 78 +++++----
scripts/nwfilter/230-no-mac-broadcast.t | 53 +++---
scripts/nwfilter/240-no-arp-spoofing.t | 60 ++++---
scripts/nwfilter/300-vsitype.t | 40 +++--
scripts/nwfilter/nwfilter_concurrent.sh | 4 +-
16 files changed, 493 insertions(+), 439 deletions(-)
delete mode 100644 conf/ks.cfg
delete mode 100644 scripts/nwfilter/090-install-image.t
--
1.8.5.3
10 years, 7 months
[libvirt] [PATCH tck] Find ebtables in /sbin or /usr/sbin
by Mike Latimer
If ebtables binary is not found in /sbin, use /usr/sbin.
---
scripts/nwfilter/100-ping-still-working.t | 3 ++-
scripts/nwfilter/210-no-mac-spoofing.t | 3 ++-
scripts/nwfilter/220-no-ip-spoofing.t | 3 ++-
scripts/nwfilter/230-no-mac-broadcast.t | 3 ++-
scripts/nwfilter/240-no-arp-spoofing.t | 3 ++-
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
index 0bfdc00..1105d70 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -64,7 +64,8 @@ my $guestip = get_ip_from_leases($mac);
diag "ip is $guestip";
# check ebtables entry
-my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
+my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
# fixme to include mac adress
ok($ebtable =~ "vnet0", "check ebtables entry");
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t b/scripts/nwfilter/210-no-mac-spoofing.t
index fb20351..d7c57e6 100644
--- a/scripts/nwfilter/210-no-mac-spoofing.t
+++ b/scripts/nwfilter/210-no-mac-spoofing.t
@@ -64,7 +64,8 @@ my $guestip = get_ip_from_leases($mac);
diag "ip is $guestip";
# check ebtables entry
-my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
+my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
# ebtables shortens :00: to :0: so we need to do that too
$_ = $mac;
diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-no-ip-spoofing.t
index 063bb5b..5e8e0d7 100644
--- a/scripts/nwfilter/220-no-ip-spoofing.t
+++ b/scripts/nwfilter/220-no-ip-spoofing.t
@@ -64,7 +64,8 @@ my $guestip = get_ip_from_leases($mac);
diag "ip is $guestip";
# check ebtables entry
-my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
+my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
# check if IP address is listed
ok($ebtable =~ "$guestip", "check ebtables entry");
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t b/scripts/nwfilter/230-no-mac-broadcast.t
index 09a758b..a7d3b8e 100644
--- a/scripts/nwfilter/230-no-mac-broadcast.t
+++ b/scripts/nwfilter/230-no-mac-broadcast.t
@@ -63,7 +63,8 @@ my $guestip = get_ip_from_leases($mac);
diag "ip is $guestip";
# check ebtables entry
-my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
+my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
# ebtables shortens :00: to :0: so we need to do that too
$_ = $mac;
diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
index c31ea48..596a0ce 100644
--- a/scripts/nwfilter/240-no-arp-spoofing.t
+++ b/scripts/nwfilter/240-no-arp-spoofing.t
@@ -65,7 +65,8 @@ my $guestip = get_ip_from_leases($mac);
diag "ip is $guestip";
# check ebtables entry
-my $ebtable = `/sbin/ebtables -L;/sbin/ebtables -t nat -L`;
+my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
+my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
# check if IP address is listed
ok($ebtable =~ "$guestip", "check ebtables entry");
--
1.8.4.5
10 years, 7 months
[libvirt] [PATCH tck] 100-ping-still-working.t: Replace vnet0 with mac address
by Mike Latimer
Using a statically defined vnet0 may fail if multiple VMs are running on the
test machine. Switch to mac address, but replace '00' with '0' to match the
output of ebtables.
---
scripts/nwfilter/100-ping-still-working.t | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/100-ping-still-working.t
index 1105d70..6c931ff 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -67,8 +67,8 @@ diag "ip is $guestip";
my $ebtables = (-e '/sbin/ebtables') ? '/sbin/ebtables' : '/usr/sbin/ebtables';
my $ebtable = `$ebtables -L;$ebtables -t nat -L`;
diag $ebtable;
-# fixme to include mac adress
-ok($ebtable =~ "vnet0", "check ebtables entry");
+$mac =~ s/00/0/g;
+ok($ebtable =~ "$mac", "check ebtables entry");
# ping guest1
my $ping = `ping -c 10 $guestip`;
--
1.8.4.5
10 years, 7 months
[libvirt] guest band width setting
by Pradeep Kiruvale
Hi All,
I am new to QEMU/libvirt
I was starting to learn the libvirt code,I was browsing the code how
the guest network bandwidth to be set like we mention <inbound> <outbound>
tags in the xml,but where in code exactly these values set to the guest
interface.
I browsed the code a lot could not find it.Please help to understand how
this works.
Thanks in advance
Pradeep
10 years, 7 months
[libvirt] [PATCH] virsh: fix 'help event'
by Eric Blake
'virsh help event' included a summary line "event - (null)"
due to a misnamed info field.
* tools/virsh-domain.c (info_event): Use correct name.
* tools/virsh-network.c (info_network_event): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Deserves to be in 1.2.3
tools/virsh-domain.c | 2 +-
tools/virsh-network.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d9aa4fa..73414f8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11030,7 +11030,7 @@ static vshEventCallback vshEventCallbacks[] = {
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
static const vshCmdInfo info_event[] = {
- {.name = "event",
+ {.name = "help",
.data = N_("Domain Events")
},
{.name = "desc",
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 078a3cf..4b0df62 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1180,7 +1180,7 @@ vshEventLifecyclePrint(virConnectPtr conn ATTRIBUTE_UNUSED,
}
static const vshCmdInfo info_network_event[] = {
- {.name = "net-event",
+ {.name = "help",
.data = N_("Network Events")
},
{.name = "desc",
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] Drop dependency on pm-is-supported
by Cédric Bosdonnat
From: Cédric Bosdonnat <cedric.bosdonnat(a)free.fr>
pm-is-supported is the only thing needed in pm-utils, better get rid of
it since systemd is heavily used for libvirt.
---
src/util/virnodesuspend.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 8088931..9839de2 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -29,6 +29,8 @@
#include "viralloc.h"
#include "virlog.h"
#include "virerror.h"
+#include "virfile.h"
+#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NONE
@@ -263,41 +265,45 @@ int nodeSuspendForDuration(unsigned int target,
static int
virNodeSuspendSupportsTarget(unsigned int target, bool *supported)
{
- virCommandPtr cmd;
- int status;
int ret = -1;
+ char *buf = NULL;
+ char **states = NULL;
+ bool canSuspend = false;
+ bool canHibernate = false;
if (virNodeSuspendInitialize() < 0)
return -1;
*supported = false;
+ if (virFileReadAll("/sys/power/state", 1024, &buf) < 0)
+ goto cleanup;
+
+ states = virStringSplit(buf, " ", 0);
+
+ canSuspend = (virStringArrayHasString(states, "mem") ||
+ virStringArrayHasString(states, "standby"));
+ canHibernate = virStringArrayHasString(states, "disk");
+
switch (target) {
case VIR_NODE_SUSPEND_TARGET_MEM:
- cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
+ *supported = canSuspend;
break;
case VIR_NODE_SUSPEND_TARGET_DISK:
- cmd = virCommandNewArgList("pm-is-supported", "--hibernate", NULL);
+ *supported = canHibernate;
break;
case VIR_NODE_SUSPEND_TARGET_HYBRID:
- cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
+ *supported = canSuspend && canHibernate;
break;
default:
return ret;
}
- if (virCommandRun(cmd, &status) < 0)
- goto cleanup;
-
- /*
- * Check return code of command == 0 for success
- * (i.e., the PM capability is supported)
- */
- *supported = (status == 0);
ret = 0;
cleanup:
- virCommandFree(cmd);
+ VIR_FREE(buf);
+ virStringFreeList(states);
return ret;
}
--
1.8.4.5
10 years, 7 months
[libvirt] [PATCH] bhyve: don't leak tap devices on failures
by Roman Bogorodskiy
On failures, virBhyveProcessStart() does not cleanup network
interfaces that could be created by virBhyveProcessBuildBhyveCmd(),
which results in a leaked tap device.
To fix that, extract network cleanup code to bhyveNetCleanup()
and use it in cleanup stage of virBhyveProcessStart().
---
src/bhyve/bhyve_process.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index b37855e..a557bc5 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -63,6 +63,24 @@ bhyveProcessAutoDestroy(virDomainObjPtr vm,
return vm;
}
+static void
+bhyveNetCleanup(virDomainObjPtr vm)
+{
+ size_t i;
+
+ for (i = 0; i < vm->def->nnets; i++) {
+ virDomainNetDefPtr net = vm->def->nets[i];
+ int actualType = virDomainNetGetActualType(net);
+
+ if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+ ignore_value(virNetDevBridgeRemovePort(
+ virDomainNetGetActualBridgeName(net),
+ net->ifname));
+ ignore_value(virNetDevTapDelete(net->ifname));
+ }
+ }
+}
+
int
virBhyveProcessStart(virConnectPtr conn,
bhyveConnPtr driver,
@@ -167,6 +185,8 @@ virBhyveProcessStart(virConnectPtr conn,
ignore_value(virCommandRun(destroy_cmd, NULL));
virCommandFree(destroy_cmd);
}
+
+ bhyveNetCleanup(vm);
}
virCommandFree(load_cmd);
@@ -181,7 +201,6 @@ virBhyveProcessStop(bhyveConnPtr driver,
virDomainObjPtr vm,
virDomainShutoffReason reason ATTRIBUTE_UNUSED)
{
- size_t i;
int ret = -1;
virCommandPtr cmd = NULL;
@@ -203,17 +222,8 @@ virBhyveProcessStop(bhyveConnPtr driver,
vm->def->name,
(int)vm->pid);
- for (i = 0; i < vm->def->nnets; i++) {
- virDomainNetDefPtr net = vm->def->nets[i];
- int actualType = virDomainNetGetActualType(net);
-
- if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
- ignore_value(virNetDevBridgeRemovePort(
- virDomainNetGetActualBridgeName(net),
- net->ifname));
- ignore_value(virNetDevTapDelete(net->ifname));
- }
- }
+ /* Cleanup network interfaces */
+ bhyveNetCleanup(vm);
/* No matter if shutdown was successful or not, we
* need to unload the VM */
--
1.8.4.2
10 years, 7 months
[libvirt] [PATCH] util: remove useless comment for virCgroupMoveTask in vircgroup.c
by Hongwei Bi
Signed-off-by: Hongwei Bi <hwbi2008(a)gmail.com>
---
src/util/vircgroup.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a0904d6..b881c8c 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1148,7 +1148,6 @@ virCgroupAddTaskStrController(virCgroupPtr group,
*
* @src_group: The source cgroup where all tasks are removed from
* @dest_group: The destination where all tasks are added to
- * @controller: The cgroup controller to be operated on
*
* Returns: 0 on success or -1 on failure
*/
--
1.7.9.5
10 years, 7 months