[libvirt] [PATCH glib v2] Fix event loop implementation on win32
by Daniel P. Berrange
Libvirt uses gnulib for making winsock look like POSIX
sockets. This means that in the libvirt event handle
callbacks the application will be given a file descriptor
rather than a winsock HANDLE object. The g_io_channel_unix_new
method will detect that it is an FD and delegate to the
g_io_channel_win32_new_fd method. Unfortunately the glib Win32
event loop impl is not very good at dealing with FD objects,
simulating poll() by doing a read() on the FD :-(
The API docs for g_io_channel_win32_new_fd say
"All reads from the file descriptor should be done by
this internal GLib thread. Your code should call only
g_io_channel_read()."
This isn't going to fly for libvirt, since it has zero
knowledge of glib at all, so is just doing normal read().
Fortunately we can work around this problem by turning
the FD we get from libvirt back into a HANDLE using the
_get_osfhandle() method.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-glib/libvirt-glib-event.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c
index 87019b5..1e1ffec 100644
--- a/libvirt-glib/libvirt-glib-event.c
+++ b/libvirt-glib/libvirt-glib-event.c
@@ -31,6 +31,10 @@
#include "libvirt-glib/libvirt-glib.h"
+#ifdef G_OS_WIN32
+#include <io.h>
+#endif
+
/**
* SECTION:libvirt-glib-event
* @short_description: Integrate libvirt with the GMain event framework
@@ -164,7 +168,11 @@ gvir_event_handle_add(int fd,
data->events = events;
data->cb = cb;
data->opaque = opaque;
+#ifdef G_OS_WIN32
+ data->channel = g_io_channel_win32_new_socket(_get_osfhandle(fd));
+#else
data->channel = g_io_channel_unix_new(fd);
+#endif
data->ff = ff;
g_debug("Add handle %p %d %d %d %p\n", data, data->watch, data->fd, events, data->opaque);
--
1.8.4.2
10 years, 10 months
[libvirt] [Question] About ivshmemory device and slot number confliction.
by Wangyufei (James)
Hello,
I want to use ivshmemory device which is supported by qemu, but libvirt does not support it.
So I use qemu:commandline to make ivshmemory device in qemu command pass-through.
But then hot-plug a virtio-net device failed.
The reason is that a qemu:commandline pci device's slot number is assigned by qemu not libvirt.
And hot-plug device's slot is assigned by libvirt.
So it failed beacause of slot confliction.
I have two questions to ask:
1. Why libvirt does not support ivshmemory device? If libvirt intends to support it, when?
2. Can libvirt handle with qemu:commandline pci device's slot number? Just like pci:commandline to assign a slot number. what's your opinion?
Best Regards,
-WangYufei
10 years, 10 months
[libvirt] [PATCH 0/5] Fix deadlock in nwfilter code
by Daniel P. Berrange
Since we introduced fine grained locking into the QEMU driver so
that VM start can run in parallel, we appear to have caused a
race with the nwfilter code. In particular since we no longer
hold the global QEMU driver lock for the duration of VM startup
we have a lock ordering flaw. This results in deadlock when
nwfilter operations happen in parallel with VM startup. This
also affects the LXC driver.
This patch series attempts to address the problem
https://bugzilla.redhat.com/show_bug.cgi?id=929412
the removal of the windows thread impl isn't strictly required,
I just didn't want to waste time creating a read/write lock impl
for Windows threads.
Daniel P. Berrange (5):
Add a read/write lock implementation
Remove windows thread implementation in favour of pthreads
Push nwfilter update locking up to top level
Add a mutex to serialize updates to firewall
Turn nwfilter conf update mutex into a read/write lock
configure.ac | 15 +-
src/Makefile.am | 4 -
src/conf/nwfilter_conf.c | 23 +-
src/conf/nwfilter_conf.h | 3 +-
src/libvirt_private.syms | 8 +-
src/lxc/lxc_driver.c | 6 +
src/nwfilter/nwfilter_driver.c | 12 +-
src/nwfilter/nwfilter_gentech_driver.c | 21 +-
src/nwfilter/nwfilter_gentech_driver.h | 2 +-
src/qemu/qemu_driver.c | 6 +
src/uml/uml_driver.c | 4 +
src/util/virthread.c | 291 +++++++++++++++++++++++-
src/util/virthread.h | 51 ++++-
src/util/virthreadpthread.c | 278 -----------------------
src/util/virthreadpthread.h | 49 ----
src/util/virthreadwin32.c | 396 ---------------------------------
src/util/virthreadwin32.h | 53 -----
17 files changed, 395 insertions(+), 827 deletions(-)
delete mode 100644 src/util/virthreadpthread.c
delete mode 100644 src/util/virthreadpthread.h
delete mode 100644 src/util/virthreadwin32.c
delete mode 100644 src/util/virthreadwin32.h
--
1.8.4.2
10 years, 10 months
[libvirt] how nwfilter parse variable in xml file
by yue
hi,all
we can define variable in nwfilter xml file, and assign value in domain xml .
i add a new attribute , if the value is constant, it works .
if it is variable, it will product wrong iptables rules.
i want to know how libvirt process variable? where is the difference between processing constant and variable?
when it is variable, if validator function is needed?
thanks
10 years, 10 months
[libvirt] [PATCH 0/3] Enhance virnetdevbandwidthtest
by Michal Privoznik
As discussed with Eric, we may need slightly different approach.
Michal Privoznik (3):
virfile: Introduce virFileAppendStr
virCommand: Introduce virCommandSetDryRun
virnetdevbandwidthtest: Introduce testVirNetDevBandwidthSet
src/libvirt_private.syms | 2 +
src/util/vircommand.c | 59 ++++++++++++++++++++++++-
src/util/vircommand.h | 2 +
src/util/virfile.c | 48 +++++++++++++++++----
src/util/virfile.h | 2 +
tests/virnetdevbandwidthtest.c | 98 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 201 insertions(+), 10 deletions(-)
--
1.8.5.2
10 years, 10 months
[libvirt] [PATCH RESEND V2 1/1] Add hw random number generator (/dev/hwrng) to cgroup ACL
by Pradipta Kr. Banerjee
From: "Pradipta Kr. Banerjee" <bpradip(a)in.ibm.com>
Creating a qemu VM with /dev/hwrng as backend RNG device throws the
following error - "Could not open '/dev/hwrng': Permission denied"
This patch fixes the issue
Signed-off-by: Pradipta Kr. Banerjee <bpradip(a)in.ibm.com>
---
v2: Added acl code as part of per-VM cgroup setup
src/qemu/qemu_cgroup.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index f0cacd0..8e2076e 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -533,6 +533,18 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
goto cleanup;
}
+ if (vm->def->rng &&
+ (vm->def->rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM)) {
+ VIR_DEBUG("Setting Cgroup ACL for RNG device");
+ rv = virCgroupAllowDevicePath(priv->cgroup, vm->def->rng->source.file,
+ VIR_CGROUP_DEVICE_RW);
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
+ vm->def->rng->source.file, "rw", rv == 0);
+ if (rv < 0 &&
+ !virLastErrorIsSystemErrno(ENOENT))
+ goto cleanup;
+ }
+
ret = 0;
cleanup:
virObjectUnref(cfg);
--
1.8.3.1
10 years, 10 months
[libvirt] [PATCH v3] qemu: Use virtio network device for aarch64/virt
by Oleg Strikov
This patch changes network device type used by default from rtl8139
to virtio when architecture type is aarch64 and machine type is virt.
Qemu doesn't support any other machine types for aarch64 right now and
we can't make any other aarch64-specific tuning in this function yet.
Signed-off-by: Oleg Strikov <oleg.strikov(a)canonical.com>
---
src/qemu/qemu_domain.c | 3 ++-
.../qemuxml2argv-aarch64-virt-default-nic.args | 6 ++++++
.../qemuxml2argv-aarch64-virt-default-nic.xml | 22 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 +++
4 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c947e2e..a0e9a33 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -795,11 +795,12 @@ qemuDomainDefaultNetModel(const virDomainDef *def)
{
if (def->os.arch == VIR_ARCH_S390 ||
def->os.arch == VIR_ARCH_S390X)
return "virtio";
- if (def->os.arch == VIR_ARCH_ARMV7L) {
+ if (def->os.arch == VIR_ARCH_ARMV7L ||
+ def->os.arch == VIR_ARCH_AARCH64) {
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
if (STREQ(def->os.machine, "virt"))
return "virtio";
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
new file mode 100644
index 0000000..d4d403b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 \
+-usb -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
+-net user,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
new file mode 100644
index 0000000..868de94
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
@@ -0,0 +1,22 @@
+<domain type="qemu">
+ <name>aarch64-virt-default-nic</name>
+ <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>1</vcpu>
+ <features>
+ <acpi/>
+ </features>
+ <os>
+ <type arch="aarch64" machine="virt">hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <cmdline>console=ttyAMA0</cmdline>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a25264e..1a18ee2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1316,10 +1316,13 @@ mymain(void)
DO_TEST("aarch64-virt-virtio",
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("aarch64-virt-default-nic",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO);
DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_KVM_PIT_TICK_POLICY);
--
1.7.9.5
10 years, 10 months
[libvirt] [PATCH] BSD: implement virProcess{Get,Set}Affinity
by Roman Bogorodskiy
I guess commit message provides enough information, but I want
to share some testing info. So, with qemu driver I get:
virsh # vcpuinfo qemu
VCPU: 0
CPU: 0
State: running
CPU Affinity: yyyy
virsh #
Check the corresponding process using cpuset(1) tool from base
system:
> sudo cpuset -g -p 1308
pid 1308 mask: 0, 1, 2, 3
>
virsh # vcpupin qemu --vcpu 0 --live 2,3
virsh # vcpuinfo qemu
VCPU: 0
CPU: 0
State: running
CPU Affinity: --yy
virsh #
Now cpuset(1) says:
> sudo cpuset -g -p 1308
pid 1308 mask: 2, 3
>
Now, do:
> sudo cpuset -l 0-3 -p 1308
And check back again:
virsh # vcpuinfo qemu
VCPU: 0
CPU: 0
State: running
CPU Affinity: yyyy
virsh #
Roman Bogorodskiy (1):
BSD: implement virProcess{Get,Set}Affinity
src/util/virprocess.c | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
--
1.8.4.3
10 years, 10 months
[libvirt] [PATCH v2] qemu: Use virtio network device for aarch64/virt
by Oleg Strikov
This patch changes network device type used by default from rtl8139
to virtio when architecture type is aarch64 and machine type is virt.
Qemu doesn't support any other machine types for aarch64 right now and
we can't make any other aarch64-specific tuning in this function yet.
Signed-off-by: Oleg Strikov <oleg.strikov(a)canonical.com>
---
src/qemu/qemu_domain.c | 3 ++-
.../qemuxml2argv-aarch64-virt-default-nic.args | 6 ++++++
.../qemuxml2argv-aarch64-virt-default-nic.xml | 22 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 +++
4 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
create mode 100644
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c947e2e..a0e9a33 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -795,11 +795,12 @@ qemuDomainDefaultNetModel(const virDomainDef *def)
{
if (def->os.arch == VIR_ARCH_S390 ||
def->os.arch == VIR_ARCH_S390X)
return "virtio";
- if (def->os.arch == VIR_ARCH_ARMV7L) {
+ if (def->os.arch == VIR_ARCH_ARMV7L ||
+ def->os.arch == VIR_ARCH_AARCH64) {
if (STREQ(def->os.machine, "versatilepb"))
return "smc91c111";
if (STREQ(def->os.machine, "virt"))
return "virtio";
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
new file mode 100644
index 0000000..d4d403b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append
console=ttyAMA0 \
+-usb -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
+-net user,vlan=0,name=hostnet0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
new file mode 100644
index 0000000..868de94
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
@@ -0,0 +1,22 @@
+<domain type="qemu">
+ <name>aarch64-virt-default-nic</name>
+ <uuid>6ba410c5-1e5c-4d57-bee7-2228e7ffa32f</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>1</vcpu>
+ <features>
+ <acpi/>
+ </features>
+ <os>
+ <type arch="aarch64" machine="virt">hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <cmdline>console=ttyAMA0</cmdline>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a25264e..1a18ee2 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1316,10 +1316,13 @@ mymain(void)
DO_TEST("aarch64-virt-virtio",
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("aarch64-virt-default-nic",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO);
DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_KVM_PIT_TICK_POLICY);
--
1.7.9.5
10 years, 10 months
Re: [libvirt] [PATCH] Sheepdog: Auto Adding volume and correct refresh volume problem. Resent file
by joel SIMOES
From: Joel SIMOES <joel.simoes(a)laposte.net>
---
src/storage/storage_backend_sheepdog.c | 92 ++++++++++++++++++++++++++++++----
1 file changed, 82 insertions(+), 10 deletions(-)
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index a6981ce..75304b1 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -86,7 +86,8 @@ virStorageBackendSheepdogParseNodeInfo(virStoragePoolDefPtr pool,
pool->available = pool->capacity - pool->allocation;
return 0;
- } while ((p = next));
+ }
+ while ((p = next));
return -1;
}
@@ -109,6 +110,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,15 +187,18 @@ 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;
}
-
static int
virStorageBackendSheepdogDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
@@ -143,12 +211,14 @@ virStorageBackendSheepdogDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "delete", vol->name, NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
+ if (ret < 0)
+ goto cleanup;
+cleanup:
virCommandFree(cmd);
return ret;
}
-
static int
virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
@@ -174,7 +244,6 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
return 0;
}
-
static int
virStorageBackendSheepdogBuildVol(virConnectPtr conn,
virStoragePoolObjPtr pool,
@@ -195,12 +264,12 @@ virStorageBackendSheepdogBuildVol(virConnectPtr conn,
goto cleanup;
ret = 0;
+
cleanup:
virCommandFree(cmd);
return ret;
}
-
int
virStorageBackendSheepdogParseVdiList(virStorageVolDefPtr vol,
char *output)
@@ -257,7 +326,8 @@ virStorageBackendSheepdogParseVdiList(virStorageVolDefPtr vol,
return -1;
return 0;
- } while ((p = next));
+ }
+ while ((p = next));
return -1;
}
@@ -295,7 +365,6 @@ cleanup:
return ret;
}
-
static int
virStorageBackendSheepdogResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
@@ -310,7 +379,10 @@ virStorageBackendSheepdogResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virCommandAddArgFormat(cmd, "%llu", capacity);
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
+ if (ret < 0)
+ goto cleanup;
+cleanup:
virCommandFree(cmd);
return ret;
--
1.8.3.2
10 years, 10 months