[libvirt] [PATCH] Fix memory leaks in cmdInterfaceEdit and cmdNWFilterEdit.
by Laine Stump
This applies a fix to thos functions similar to that made to cmdEdit
in 270895063d1cf86ab42fa220a8d090c24d58dbc0, thus fnixing a memory
leak - if tmp is unlinked and NULLed early in the function, the memory
used by tmp is never freed. Since we will always unlink tmp prior to
freeing its memory at the end of the function, just remove the earlier
code and let cleanup: do the cleanup.
---
tools/virsh.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index eb11a78..fb66a72 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3248,9 +3248,6 @@ cmdInterfaceEdit (vshControl *ctl, const vshCmd *cmd)
doc_edited = editReadBackFile (ctl, tmp);
if (!doc_edited) goto cleanup;
- unlink (tmp);
- tmp = NULL;
-
/* Compare original XML with edited. Has it changed at all? */
if (STREQ (doc, doc_edited)) {
vshPrint (ctl, _("Interface %s XML configuration not changed.\n"),
@@ -4193,9 +4190,6 @@ cmdNWFilterEdit (vshControl *ctl, const vshCmd *cmd)
doc_edited = editReadBackFile (ctl, tmp);
if (!doc_edited) goto cleanup;
- unlink (tmp);
- tmp = NULL;
-
/* Compare original XML with edited. Has it changed at all? */
if (STREQ (doc, doc_edited)) {
vshPrint (ctl, _("Network filter %s XML configuration not changed.\n"),
--
1.6.6.1
14 years, 6 months
[libvirt] [PATCH] lxc: Fix failure on starting a domain that has multiple network interfaces
by Ryota Ozaki
[Error message]
error: Failed to start domain lxc_test1
error: internal error Failed to create veth device pair: 512
The reason of the failure is that lxc driver unexpectedly re-uses
an auto-assigned veth name and tries to create the created veth
again. The failure will happen when a domain has multiple network
interfaces and the names of those are not specified in XML.
The patch fixes the problem by resetting buffers of veth names
in every iteration of creating veth.
* src/lxc/lxc_driver.c: prevent re-using auto-assigned veth name
Reported by Kumar L Srikanth-B22348.
---
src/lxc/lxc_driver.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 409b1cf..554bf66 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -786,14 +786,15 @@ static int lxcSetupInterfaces(virConnectPtr conn,
{
int rc = -1, i;
char *bridge = NULL;
- char parentVeth[PATH_MAX] = "";
- char containerVeth[PATH_MAX] = "";
brControl *brctl = NULL;
if (brInit(&brctl) != 0)
return -1;
for (i = 0 ; i < def->nnets ; i++) {
+ char parentVeth[PATH_MAX] = "";
+ char containerVeth[PATH_MAX] = "";
+
switch (def->nets[i]->type) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
{
--
1.6.5.2
14 years, 6 months
[libvirt] Creating multiple network interfaces in libvirt Domain.
by Kumar L Srikanth-B22348
Hi,
I want to create a Domain with two interfaces. I am using LXC hypervisor
in the libvirt.
My domain XML is shown below:
<domain type='lxc' id='1'>
<name>srikanth_vm2</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/root/lxc/fedora1'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<source network='default'/>
</interface>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
I am able to define the Domain. But, I am not able to start the Domain.
While starting the domain, I am getting the following error:
error: Failed to start domain srikanth_vm2
error: internal error Failed to create veth device pair: 512
Can you please let me know where I am going wrong?
Regards,
Srikanth.
14 years, 7 months
[libvirt] [PATCH] Fix a virsh edit memory leak
by Chris Lalancette
When running virsh edit, we are unlinking and setting
the tmp variable to NULL before going to the end of the
function, meaning that we never free tmp. Since the
exit to the function will always unlink and free tmp,
just remove this bit of code and let it get done at the
end.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
tools/virsh.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 04b47a1..ab099da 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8066,9 +8066,6 @@ cmdEdit (vshControl *ctl, const vshCmd *cmd)
doc_edited = editReadBackFile (ctl, tmp);
if (!doc_edited) goto cleanup;
- unlink (tmp);
- tmp = NULL;
-
/* Compare original XML with edited. Has it changed at all? */
if (STREQ (doc, doc_edited)) {
vshPrint (ctl, _("Domain %s XML configuration not changed.\n"),
--
1.6.6.1
14 years, 7 months