[libvirt] [PATCH] command: test umask support
by Eric Blake
Add testsuite coverage for the previous patch.
* tests/commandhelper.c (main): Output umask.
* tests/commandtest.c (test15): Also test umask.
(mymain): Add test.
* tests/commanddata/*.log: Update expected output.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tests/commanddata/test10.log | 1 +
tests/commanddata/test11.log | 1 +
tests/commanddata/test12.log | 1 +
tests/commanddata/test13.log | 1 +
tests/commanddata/test14.log | 1 +
tests/commanddata/test15.log | 1 +
tests/commanddata/test2.log | 1 +
tests/commanddata/test20.log | 1 +
tests/commanddata/test21.log | 1 +
tests/commanddata/test24.log | 1 +
tests/commanddata/test3.log | 1 +
tests/commanddata/test4.log | 1 +
tests/commanddata/test5.log | 1 +
tests/commanddata/test6.log | 1 +
tests/commanddata/test7.log | 1 +
tests/commanddata/test8.log | 1 +
tests/commanddata/test9.log | 1 +
tests/commandhelper.c | 3 +++
tests/commandtest.c | 3 +++
19 files changed, 23 insertions(+)
diff --git a/tests/commanddata/test10.log b/tests/commanddata/test10.log
index e1d6092..6b22786 100644
--- a/tests/commanddata/test10.log
+++ b/tests/commanddata/test10.log
@@ -12,3 +12,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test11.log b/tests/commanddata/test11.log
index e1d6092..6b22786 100644
--- a/tests/commanddata/test11.log
+++ b/tests/commanddata/test11.log
@@ -12,3 +12,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test12.log b/tests/commanddata/test12.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test12.log
+++ b/tests/commanddata/test12.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test13.log b/tests/commanddata/test13.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test13.log
+++ b/tests/commanddata/test13.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test14.log b/tests/commanddata/test14.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test14.log
+++ b/tests/commanddata/test14.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test15.log b/tests/commanddata/test15.log
index f439a85..edb2fc3 100644
--- a/tests/commanddata/test15.log
+++ b/tests/commanddata/test15.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:.../commanddata
+UMASK:0002
diff --git a/tests/commanddata/test2.log b/tests/commanddata/test2.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test2.log
+++ b/tests/commanddata/test2.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test20.log b/tests/commanddata/test20.log
index 7d48121..a0475e6 100644
--- a/tests/commanddata/test20.log
+++ b/tests/commanddata/test20.log
@@ -11,3 +11,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test21.log b/tests/commanddata/test21.log
index 1b59206..703e6da 100644
--- a/tests/commanddata/test21.log
+++ b/tests/commanddata/test21.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test24.log b/tests/commanddata/test24.log
index 8670952..38cbb54 100644
--- a/tests/commanddata/test24.log
+++ b/tests/commanddata/test24.log
@@ -5,3 +5,4 @@ FD:3
FD:4
DAEMON:yes
CWD:/
+UMASK:0022
diff --git a/tests/commanddata/test3.log b/tests/commanddata/test3.log
index c6da253..f44400b 100644
--- a/tests/commanddata/test3.log
+++ b/tests/commanddata/test3.log
@@ -12,3 +12,4 @@ FD:5
FD:7
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test4.log b/tests/commanddata/test4.log
index 1876685..6cd2095 100644
--- a/tests/commanddata/test4.log
+++ b/tests/commanddata/test4.log
@@ -10,3 +10,4 @@ FD:1
FD:2
DAEMON:yes
CWD:/
+UMASK:0022
diff --git a/tests/commanddata/test5.log b/tests/commanddata/test5.log
index f745c3f..f801dca 100644
--- a/tests/commanddata/test5.log
+++ b/tests/commanddata/test5.log
@@ -8,3 +8,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test6.log b/tests/commanddata/test6.log
index 5394428..1476995 100644
--- a/tests/commanddata/test6.log
+++ b/tests/commanddata/test6.log
@@ -4,3 +4,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test7.log b/tests/commanddata/test7.log
index cdfe445..e30efe7 100644
--- a/tests/commanddata/test7.log
+++ b/tests/commanddata/test7.log
@@ -9,3 +9,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test8.log b/tests/commanddata/test8.log
index 87874fd..897bf6e 100644
--- a/tests/commanddata/test8.log
+++ b/tests/commanddata/test8.log
@@ -5,3 +5,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commanddata/test9.log b/tests/commanddata/test9.log
index 3a93c19..e9e1611 100644
--- a/tests/commanddata/test9.log
+++ b/tests/commanddata/test9.log
@@ -18,3 +18,4 @@ FD:1
FD:2
DAEMON:no
CWD:/tmp
+UMASK:0022
diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 796b89d..03fe506 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
+#include <sys/stat.h>
#include "internal.h"
#include "virutil.h"
@@ -121,6 +122,8 @@ int main(int argc, char **argv) {
fprintf(log, "CWD:%s\n", cwd);
VIR_FREE(cwd);
+ fprintf(log, "UMASK:%04o\n", umask(0));
+
VIR_FORCE_FCLOSE(log);
if (argc > 1 && STREQ(argv[1], "--close-stdin")) {
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 5f52a00..6400ea2 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -617,6 +617,7 @@ static int test15(const void *unused ATTRIBUTE_UNUSED)
if (virAsprintf(&cwd, "%s/commanddata", abs_srcdir) < 0)
goto cleanup;
virCommandSetWorkingDirectory(cmd, cwd);
+ virCommandSetUmask(cmd, 002);
if (virCommandRun(cmd, NULL) < 0) {
virErrorPtr err = virGetLastError();
@@ -1133,6 +1134,8 @@ mymain(void)
if (chdir("/tmp") < 0)
return EXIT_FAILURE;
+ umask(022);
+
setpgid(0, 0);
ignore_value(setsid());
--
1.9.3
10 years, 3 months
[libvirt] [PATCH] Storage: Fix allocation for raw files.
by Prerna Saxena
When virsh vol-clone is attempted on a raw file where capacity > allocation,
the resulting cloned volume has a size that matches the virtual-size of
the parent; in place of matching its actual, disk size.
For example : Given this image:
[root@localhost]# qemu-img info /var/lib/libvirt/images/f20.raw
image: /var/lib/libvirt/images/f20.raw
file format: raw
virtual size: 2.0G (2147483648 bytes)
disk size: 617M
When this disk is copied using virsh vol-clone :
[root@localhost~] vol-clone --vol f20.raw --newname f20-copy.raw
--pool default
Vol f20-copy.raw cloned from f20.raw
[root@localhost~]
The characteristics of the cloned disk differ in "disk size".
Its allocated disk size is more than the allocated size of parent file;
which is an anomaly. It has picked up an allocated size matching
the parent's virtual size.
[root@localhost~] qemu-img info /var/lib/libvirt/images/f20-copy.raw
image: /var/lib/libvirt/images/f20-copy.raw
file format: raw
virtual size: 2.0G (2147483648 bytes)
disk size: 2.0G
This patch fixes the cloned disk to have same _allocated_size_ as
the parent file from which it was cloned.
Signed-off-by: Prerna Saxena <prerna(a)linux.vnet.ibm.com>
---
src/storage/storage_driver.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 433d7b7..930b45a 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1821,11 +1821,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
if (newvol->target.capacity < origvol->target.capacity)
newvol->target.capacity = origvol->target.capacity;
- /* Make sure allocation is at least as large as the destination cap,
- * to make absolutely sure we copy all possible contents */
- if (newvol->target.allocation < origvol->target.capacity)
- newvol->target.allocation = origvol->target.capacity;
-
if (!backend->buildVolFrom) {
virReportError(VIR_ERR_NO_SUPPORT,
"%s", _("storage pool does not support volume creation from an existing volume"));
--
1.9.3
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
10 years, 3 months
[libvirt] [PATCH] util: don't shadow global umask declaration
by Martin Kletzander
Commit 0e1a1a8c introduced umask for virCommand, but the variables
used emit a warning on older compilers about shadowed global
declaration.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
Pushed as a build-breaker && trivial.
src/util/vircommand.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index efb5f69..cbe94f8 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -133,7 +133,7 @@ struct _virCommand {
#if defined(WITH_SECDRIVER_APPARMOR)
char *appArmorProfile;
#endif
- int umask;
+ int mask;
};
/* See virCommandSetDryRun for description for this variable */
@@ -583,8 +583,8 @@ virExec(virCommandPtr cmd)
/* child */
- if (cmd->umask)
- umask(cmd->umask);
+ if (cmd->mask)
+ umask(cmd->mask);
ret = EXIT_CANCELED;
openmax = sysconf(_SC_OPEN_MAX);
if (openmax < 0) {
@@ -1085,12 +1085,12 @@ virCommandSetMaxFiles(virCommandPtr cmd, unsigned int files)
cmd->maxFiles = files;
}
-void virCommandSetUmask(virCommandPtr cmd, int umask)
+void virCommandSetUmask(virCommandPtr cmd, int mask)
{
if (!cmd || cmd->has_error)
return;
- cmd->umask = umask;
+ cmd->mask = mask;
}
/**
--
2.1.0
10 years, 3 months
[libvirt] [PATCH] sanlock: Avoid freeing uninitialized value
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=1136788
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/locking/lock_driver_sanlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index aade437..aa6b8fb 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -885,7 +885,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
int *fd)
{
virLockManagerSanlockPrivatePtr priv = lock->privateData;
- struct sanlk_options *opt;
+ struct sanlk_options *opt = NULL;
struct sanlk_resource **res_args;
int res_count;
bool res_free = false;
--
2.1.0
10 years, 3 months
[libvirt] [PATCH V2] fix: unix sockets created for virtio-serail has insufficient permissions
by Chunyan Liu
Add umask to _virCommand, allow user to set umask to command.
Set umask(002) to qemu process to overwrite default umask(022) so
that unix sockets created for virtio-serial has expected permissions.
Fix problem reported here:
https://sourceware.org/bugzilla/show_bug.cgi?id=13078#c11
https://bugzilla.novell.com/show_bug.cgi?id=888166
To use virtio-serial device, unix socket created for chardev with
default umask(022) has insufficient permissions.
e.g.:
-device virtio-serial \
-chardev socket,path=/tmp/foo,server,nowait,id=foo \
-device virtserialport,chardev=foo,name=org.fedoraproject.port.0
srwxr-xr-x 1 qemu qemu 0 21. Jul 14:19 /tmp/somefile.sock
Other users in the same group (like real user, test engines, etc)
cannot write to this socket.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
Changes:
* set umask(002) to the whole qemu process instead of calling
umask in qemu unix_listen_opts.
V1 is here:
http://www.mail-archive.com/libvir-list@redhat.com/msg101513.html
src/libvirt_private.syms | 1 +
src/qemu/qemu_process.c | 1 +
src/util/vircommand.c | 11 +++++++++++
src/util/vircommand.h | 1 +
4 files changed, 14 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 71fc063..f136d24 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1171,6 +1171,7 @@ virCommandSetPidFile;
virCommandSetPreExecHook;
virCommandSetSELinuxLabel;
virCommandSetUID;
+virCommandSetUmask;
virCommandSetWorkingDirectory;
virCommandToString;
virCommandWait;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f68dfbe..f76aa5a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4141,6 +4141,7 @@ int qemuProcessStart(virConnectPtr conn,
virCommandSetPreExecHook(cmd, qemuProcessHook, &hookData);
virCommandSetMaxProcesses(cmd, cfg->maxProcesses);
virCommandSetMaxFiles(cmd, cfg->maxFiles);
+ virCommandSetUmask(cmd, 0x002);
VIR_DEBUG("Setting up security labelling");
if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 1d6dbd9..efb5f69 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -133,6 +133,7 @@ struct _virCommand {
#if defined(WITH_SECDRIVER_APPARMOR)
char *appArmorProfile;
#endif
+ int umask;
};
/* See virCommandSetDryRun for description for this variable */
@@ -582,6 +583,8 @@ virExec(virCommandPtr cmd)
/* child */
+ if (cmd->umask)
+ umask(cmd->umask);
ret = EXIT_CANCELED;
openmax = sysconf(_SC_OPEN_MAX);
if (openmax < 0) {
@@ -1082,6 +1085,14 @@ virCommandSetMaxFiles(virCommandPtr cmd, unsigned int files)
cmd->maxFiles = files;
}
+void virCommandSetUmask(virCommandPtr cmd, int umask)
+{
+ if (!cmd || cmd->has_error)
+ return;
+
+ cmd->umask = umask;
+}
+
/**
* virCommandClearCaps:
* @cmd: the command to modify
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index d3b286d..bf65de4 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -72,6 +72,7 @@ void virCommandSetUID(virCommandPtr cmd, uid_t uid);
void virCommandSetMaxMemLock(virCommandPtr cmd, unsigned long long bytes);
void virCommandSetMaxProcesses(virCommandPtr cmd, unsigned int procs);
void virCommandSetMaxFiles(virCommandPtr cmd, unsigned int files);
+void virCommandSetUmask(virCommandPtr cmd, int umask);
void virCommandClearCaps(virCommandPtr cmd);
--
1.8.4.5
10 years, 3 months
[libvirt] [PATCH v1 0/6] ivshmem support
by Maxime Leroy
The following patches are an implementation of
a new shmem device to support ivshmem in libvirt.
Any feedback is welcome.
Changes since RFC:
- replace <ivshmem> by a more generic term <shmem>
- remove role attribute
- libvirt is able to start and stop an ivshmem server
- update xml format from:
<ivshmem use_server='yes' role='master'>
<source file='/tmp/socket-ivshmem0'/>
<size unit='M'>32</size>
<msi vectors='32' ioeventfd='on'/>
</ivshmem>
to:
<shmem name='shmem0' model='ivshmem'>
<server path='/tmp/sockect-ivshem0' start='yes'/>
<size unit='M'>32</size>
<msi vectors='32' ioeventfd='on'/>
</shmem>
Maxime Leroy (6):
doc: schema: Add documentation for the shmem support
conf: Parse and format shmem device XML
qemu: Add cap flag QEMU_CAPS_IVSHMEM
qemu: Build command line for ivshmem device
tests: Add tests for ivshmem device handling
ivshmem: add start param to server attribute
configure.ac | 4 +
docs/formatdomain.html.in | 71 ++++++
docs/schemas/domaincommon.rng | 52 +++++
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 264 ++++++++++++++++++++++-
src/conf/domain_conf.h | 42 ++++
src/libvirt_private.syms | 7 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 112 +++++++++-
src/qemu/qemu_command.h | 4 +
src/qemu/qemu_hotplug.c | 1 +
src/qemu/qemu_process.c | 10 +
src/util/virivshmemserver.c | 141 ++++++++++++
src/util/virivshmemserver.h | 28 +++
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemuhelptest.c | 17 +-
tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args | 10 +
tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml | 35 +++
tests/qemuxml2argvtest.c | 3 +
tests/qemuxml2xmltest.c | 2 +
27 files changed, 808 insertions(+), 7 deletions(-)
create mode 100644 src/util/virivshmemserver.c
create mode 100644 src/util/virivshmemserver.h
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ivshmem.xml
--
1.9.3
10 years, 3 months
[libvirt] [PATCH] spec: Fix preun script for daemon
by Jiri Denemark
%systemd_preun macro cannot be split in several lines.
https://bugzilla.redhat.com/show_bug.cgi?id=1136736
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 4dc801b..4756d7d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1677,11 +1677,7 @@ fi
%preun daemon
%if %{with_systemd}
%if %{with_systemd_macros}
- %systemd_preun \
- libvirtd.socket \
- libvirtd.service \
- virtlockd.socket \
- virtlockd.service
+ %systemd_preun libvirtd.socket libvirtd.service virtlockd.socket virtlockd.service
%else
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
--
2.1.0
10 years, 3 months
[libvirt] [PATCH 0/2] bulk api: implement block group
by Li Wei
This patchset implement the block group for bulk stats, currently only
support JSON monitor.
Li Wei (2):
qemu: implement block group for bulk stats.
virsh: add block group for bulk stats.
include/libvirt/libvirt.h.in | 1 +
src/libvirt.c | 13 ++++
src/qemu/qemu_driver.c | 31 ++++++++
src/qemu/qemu_monitor.c | 23 ++++++
src/qemu/qemu_monitor.h | 5 ++
src/qemu/qemu_monitor_json.c | 170 +++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 5 ++
tools/virsh-domain-monitor.c | 7 ++
tools/virsh.pod | 4 +-
9 files changed, 257 insertions(+), 2 deletions(-)
--
1.9.3
10 years, 3 months
[libvirt] ignore this message
by Gene Czarcinski
Sorry about that. I am having some trouble posting to this mailing
list. Just ignore this message.
10 years, 3 months
[libvirt] ignore this message
by Gene Czarcinski
Sorry about that. I am having some trouble posting to this mailing
list. Just ignore this message.
Gene
10 years, 3 months