[libvirt] [PATCH] virt-aa-helper: Fix permissions for vhost-user socket files
by Michal Dubiel
QEMU working in vhost-user mode communicates with the other end (i.e.
some virtual router application) via unix domain sockets. This requires
that permissions for the socket files are correctly written into
/etc/apparmor.d/libvirt/libvirt-UUID.files.
Signed-off-by: Michal Dubiel <md(a)semihalf.com>
---
src/security/virt-aa-helper.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 35423b5..a097aa6 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -592,19 +592,9 @@ valid_path(const char *path, const bool readonly)
if (!virFileExists(path)) {
vah_warning(_("path does not exist, skipping file type checks"));
- } else {
- if (stat(path, &sb) == -1)
+ } else if (stat(path, &sb) == -1)
return -1;
- switch (sb.st_mode & S_IFMT) {
- case S_IFSOCK:
- return 1;
- break;
- default:
- break;
- }
- }
-
opaths = sizeof(override)/sizeof(*(override));
npaths = sizeof(restricted)/sizeof(*(restricted));
@@ -1101,6 +1091,18 @@ get_files(vahControl * ctl)
}
}
+ for (i = 0; i < ctl->def->nnets; i++) {
+ if (ctl->def->nets[i] &&
+ ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
+ ctl->def->nets[i]->data.vhostuser) {
+ virDomainChrSourceDefPtr vhu = ctl->def->nets[i]->data.vhostuser;
+
+ if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",
+ vhu->type) != 0)
+ goto cleanup;
+ }
+ }
+
if (ctl->def->virtType == VIR_DOMAIN_VIRT_KVM) {
for (i = 0; i < ctl->def->nnets; i++) {
virDomainNetDefPtr net = ctl->def->nets[i];
--
1.9.1
9 years, 12 months
[libvirt] [[libvirt-php][PATCH v1] fix memory functions] define memory functions
by Vasiliy Tolstov
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index d46fbb9..093623c 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -136,6 +136,9 @@ static zend_function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_create_xml, NULL)
PHP_FE(libvirt_domain_memory_peek,NULL)
PHP_FE(libvirt_domain_memory_stats,NULL)
+ PHP_FE(libvirt_domain_set_memory,NULL)
+ PHP_FE(libvirt_domain_set_max_memory,NULL)
+ PHP_FE(libvirt_domain_set_memory_flags,NULL)
PHP_FE(libvirt_domain_block_stats,NULL)
PHP_FE(libvirt_domain_block_resize,NULL)
PHP_FE(libvirt_domain_block_job_abort,NULL)
--
2.3.3
9 years, 12 months
[libvirt] [PATCH] virQEMUCapsComputeCmdFlags: Indent correctly
by Michal Privoznik
There's a small formatting problem in the function. One line is
not correctly indented. Fix this.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Initially, there were two chunks in this patch (and slightly
different commit message), but Peter was faster than me
a08e796bba85014446ad013c65eb58cd629c48a5.
Pushed under trivial rule.
src/qemu/qemu_capabilities.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index fa68d65..e7002a3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1206,7 +1206,7 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (version >= 13000) {
if (strstr(netdev, "bridge"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
}
}
--
2.3.6
9 years, 12 months
[libvirt] [PATCH] qemu: caps: Fix syntax-check failure in version based capabilities
by Peter Krempa
A single-line 'if' body should not be encased in curly braces. Our
syntax-check enforces it. Introduced in 7f3515b4bb677d0ead1887547efc844
---
Pushed under the build-breaker rule.
src/qemu/qemu_capabilities.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e4549ef..fa68d65 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1337,9 +1337,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY);
}
- if (version >= 2003000) {
+ if (version >= 2003000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_ARM_VIRT_PCI);
- }
return 0;
}
--
2.4.1
9 years, 12 months
[libvirt] [PATCH libvirt] libxl: avoid freeing an uninitialised bitmap
by Ian Campbell
If vm->def->cputune.nvcpupin is 0 in libxlDomainSetVcpuAffinities (as
seems to be the case on arm) then the VIR_FREE after cleanup: would be
operating on an uninitialised pointer in map.map.
Fix this by using libxl_bitmap_init and libxl_bitmap_dispose in the
appropriate places (like VIR_FREE libxl_bitmap_dispose is also
idempotent, so there is no double free on exit from the loop).
libxl_bitmap_dispose is slightly preferable since it also sets
map.size back to 0, avoiding a potential source of confusion.
This fixes the crashes we've been seeing in the Xen automated tests on
ARM.
I had a glance at the handful of other users of libxl_bitmap and none
of them looked to have a similar issue.
Signed-off-by: Ian Campbell <ian.campbell(a)citrix.com>
---
src/libxl/libxl_domain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0652270..0904b78 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -789,6 +789,8 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
size_t i;
int ret = -1;
+ libxl_bitmap_init(&map);
+
for (i = 0; i < vm->def->cputune.nvcpupin; ++i) {
pin = vm->def->cputune.vcpupin[i];
cpumask = pin->cpumask;
@@ -802,13 +804,13 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
goto cleanup;
}
- VIR_FREE(map.map);
+ libxl_bitmap_dispose(&map); /* Also returns to freshly-init'd state */
}
ret = 0;
cleanup:
- VIR_FREE(map.map);
+ libxl_bitmap_dispose(&map);
virObjectUnref(cfg);
return ret;
}
--
1.7.10.4
9 years, 12 months
[libvirt] [libvirt-php][PATCH 0/7] Switch to space indent instead of TABs
by Michal Privoznik
Yeah, this is a big change. However, it's needed. Indenting by
TABs leads to more headache and the sooner we do this the better.
I've pushed the patches to my github too:
https://github.com/zippy2/libvirt-php/commits/fixes
Maybe we should introduce a syntax-check rule too. BUT - there's
no gnulib submodule (which introduction would be another
headache, so I'm okay with leaving that as an exercise for
somebody else).
Now, I realize there's not much reviewer's bandwidth, so what if
I just give you guys some time, and if there's no review in say a
week or two, I'll go ahead and push this?
Oh, and for better viewing of the patches use
--ignore-space-change. That cuts off any space change and leave
you with just interesting changes.
Michal Privoznik (7):
sockets.c: :retab
vncfunc.c: :retab
libvirt-php.c: :retab
libvirt-php.h: :retab
generate-api-docs.c: :retab
generate-api-docs: Adapt to new comments style
libvirt_stream_close: Pass the actual connect object
src/libvirt-php.c | 13598 ++++++++++++++++++++++----------------------
src/libvirt-php.h | 244 +-
src/sockets.c | 353 +-
src/vncfunc.c | 1397 +++--
tools/generate-api-docs.c | 457 +-
5 files changed, 8028 insertions(+), 8021 deletions(-)
--
2.3.6
9 years, 12 months
[libvirt] [PATCH] virsh: blockcopy: Report error if the copy job fails
by Peter Krempa
When the block job would fail while watching it using the "--wait"
option for blockcopy, virsh would rather unhelpfully report:
$ virsh blockcopy vm hdc /tmp/raw.img --granularity 4096 --verbose --wait
Now in mirroring phase
Add a special case when the block job vanishes while waiting for it to
finish to improve the message:
$ virsh blockcopy vm hdc /tmp/raw.img --granularity 8192 --verbose --wait
error: Block Copy unexpectedly failed
---
tools/virsh-domain.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1a124f3..4e890f4 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2312,8 +2312,11 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, _("failed to query job for disk %s"), path);
goto cleanup;
}
- if (result == 0)
- break;
+
+ if (result == 0) {
+ vshError(ctl, _("Block Copy unexpectedly failed"));
+ goto cleanup;
+ }
if (verbose)
vshPrintJobProgress(_("Block Copy"), info.end - info.cur, info.end);
--
2.4.1
9 years, 12 months
[libvirt] [PATCH 0/8] Test driver refactors and fixes
by Peter Krempa
Note that patch 1/8 of this series depends on patch 2/13 of the
"vCPU pinning and related refactors - Part 1.5" series:
http://www.redhat.com/archives/libvir-list/2015-June/msg00678.html
Peter Krempa (8):
test: Reuse virDomainObjGetOneDef in testDomainGetVcpusFlags
test: Switch to reference counting with testDomObjFromDomain
test: Refactor test driver domain object retrieval
test: Refactor test driver event sending
test: group domain APIs together
lib: setvcpus: Remove bogous flag check
test: Refactor testDomainSetVcpusFlags
test: Fix lock ordering in testDomainRevertToSnapshot
src/libvirt-domain.c | 6 -
src/test/test_driver.c | 941 +++++++++++++++++--------------------------------
2 files changed, 324 insertions(+), 623 deletions(-)
--
2.4.1
9 years, 12 months
[libvirt] [[PATCH v1] update sheepdog client] update sheepdog client path
by Vasiliy Tolstov
Nnever sheepdog versions have dog client binary
while old have collie. Check them both.
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
configure.ac | 10 +++++-----
src/storage/storage_backend_sheepdog.c | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 408ee11..93f9e38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1959,14 +1959,14 @@ AC_SUBST([LIBRBD_LIBS])
if test "$with_storage_sheepdog" = "yes" ||
test "$with_storage_sheepdog" = "check"; then
- AC_PATH_PROG([COLLIE], [collie], [], [$PATH:/sbin:/usr/sbin])
+ AC_PATH_PROGS([SHEEPDOGCLI], [collie dog], [], [$PATH:/sbin:/usr/sbin])
if test "$with_storage_sheepdog" = "yes"; then
- if test -z "$COLLIE"; then
- AC_MSG_ERROR([We need collie for Sheepdog storage driver])
+ if test -z "$SHEEPDOGCLI"; then
+ AC_MSG_ERROR([We need sheepdog client for Sheepdog storage driver])
fi
else
- if test -z "$COLLIE"; then
+ if test -z "$SHEEPDOGCLI"; then
with_storage_sheepdog=no
fi
@@ -1978,7 +1978,7 @@ if test "$with_storage_sheepdog" = "yes" ||
if test "$with_storage_sheepdog" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_STORAGE_SHEEPDOG], 1,
[whether Sheepdog backend for storage driver is enabled])
- AC_DEFINE_UNQUOTED([COLLIE],["$COLLIE"],[Location of collie program])
+ AC_DEFINE_UNQUOTED([SHEEPDOGCLI],["$SHEEPDOGCLI"],[Location of sheepdog client program])
fi
fi
AM_CONDITIONAL([WITH_STORAGE_SHEEPDOG],
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index af15c3b..69ba7836 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -150,7 +150,7 @@ virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED,
char **cells = NULL;
size_t i;
- virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "list", "-r", NULL);
+ virCommandPtr cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
if (virCommandRun(cmd, NULL) < 0)
@@ -195,7 +195,7 @@ virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
char *output = NULL;
virCommandPtr cmd;
- cmd = virCommandNewArgList(COLLIE, "node", "info", "-r", NULL);
+ cmd = virCommandNewArgList(SHEEPDOGCLI, "node", "info", "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
if (virCommandRun(cmd, NULL) < 0)
@@ -221,7 +221,7 @@ virStorageBackendSheepdogDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virCheckFlags(0, -1);
- virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "delete", vol->name, NULL);
+ virCommandPtr cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "delete", vol->name, NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
@@ -273,7 +273,7 @@ virStorageBackendSheepdogBuildVol(virConnectPtr conn,
goto cleanup;
}
- cmd = virCommandNewArgList(COLLIE, "vdi", "create", vol->name, NULL);
+ cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "create", vol->name, NULL);
virCommandAddArgFormat(cmd, "%llu", vol->target.capacity);
virStorageBackendSheepdogAddHostArg(cmd, pool);
if (virCommandRun(cmd, NULL) < 0)
@@ -358,7 +358,7 @@ virStorageBackendSheepdogRefreshVol(virConnectPtr conn ATTRIBUTE_UNUSED,
int ret;
char *output = NULL;
- virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "list", vol->name, "-r", NULL);
+ virCommandPtr cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
virCommandSetOutputBuffer(cmd, &output);
ret = virCommandRun(cmd, NULL);
@@ -394,7 +394,7 @@ virStorageBackendSheepdogResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virCheckFlags(0, -1);
- virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "resize", vol->name, NULL);
+ virCommandPtr cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "resize", vol->name, NULL);
virCommandAddArgFormat(cmd, "%llu", capacity);
virStorageBackendSheepdogAddHostArg(cmd, pool);
int ret = virCommandRun(cmd, NULL);
--
2.3.3
9 years, 12 months