[libvirt] [question] doubt about cpu model 'qemu64'
Hello, Recently I noticed that if I gave no model to qemu, then I would get 'qemu64' as default cpu model. Model 'qemu64' defined in qemu and defined in libvirt both support feature 'svm'. And if I start a VM with 'qemu64' as the qemu default model, I can get no 'svm' feature in the GuestOS: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht pni cx16 popcnt hypervisor syscall nx lm lahf_lm My host cpu is intel E5620, and it doesn't support 'svm' feature: 'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse36', 'clflush', 'ds', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'ht', 'tm', 'pbe', 'pni', 'pclmulqdq', 'dtes64', 'monitor', 'ds_cpl', 'vmx', 'smx', 'est', 'tm2', 'ssse3', 'cx16', 'xtpr', 'pdcm', 'pcid', 'dca', 'sse4.1', 'sse4.2', 'popcnt', 'aes', 'syscall', 'nx', 'pdpe1gb', 'rdtscp', 'lm', 'lahf_lm', 'dts', 'arat', 'constant_tsc' I can get the same result with libvirt API compareCPU on the host: model:qemu64; ret:0 model:Conroe; ret:2 model:Penryn; ret:2 model:Nehalem; ret:2 model:Westmere; ret:2 model:SandyBridge; ret:0 model:Haswell; ret:0 Isn't it strange that the host cpu doesn't support 'qemu64' model, but we can still start a VM with 'qemu64' as the default model on it? Best Regards, -WangYufei -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/2] make qemu dump memory in kdump-compressed format
On 02/25/2014 06:56 PM, Jiri Denemark wrote: On Tue, Feb 25, 2014 at 17:54:30 +0800, Qiao Nuohan wrote: --memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is used to add --compress and [--compression-format]string to virsh dump --memory-only and send dump-guest-memory command to qemu with dump format specified to one of elf, kdump-zlib, kdump-lzo and kdump-snappy. Signed-off-by: Qiao Nuohanqiaonuo...@cn.fujitsu.com --- include/libvirt/libvirt.h.in | 15 ++- src/driver.h | 3 ++- src/libvirt.c| 10 -- src/qemu/qemu_driver.c | 30 + src/qemu/qemu_monitor.c | 6 +++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- src/remote/remote_protocol.x | 1 + src/test/test_driver.c | 12 +++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++- 12 files changed, 113 insertions(+), 21 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..aae3c49 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1180,6 +1180,18 @@ typedef enum { VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ } virDomainCoreDumpFlags; +typedef enum { +VIR_MEMORY_DUMP_COMPRESS_ZLIB = 1, /* dump guest memory in +kdump-compressed format, with +zlib-compressed */ +VIR_MEMORY_DUMP_COMPRESS_LZO= 2, /* dump guest memory in +kdump-compressed format, with +lzo-compressed */ +VIR_MEMORY_DUMP_COMPRESS_SNAPPY = 3, /* dump guest memory in +kdump-compressed format, with +snappy-compressed */ +} virMemoryDumpFormat; + /* Domain migration flags. */ typedef enum { VIR_MIGRATE_LIVE = (1 0), /* live migration */ @@ -1728,7 +1740,8 @@ int virDomainManagedSaveRemove(virDomainPtr dom, */ int virDomainCoreDump (virDomainPtr domain, const char *to, - unsigned int flags); + unsigned int flags, + const unsigned int memory_dump_format); This is not allowed and I believe make syntax-check should fail on the corresponding change to remote_protocol.x. If you want to add a new parameter to an existing API, you have keep the API as is and instead create a new API with a different name that will have all the parameters you need. Hello Jirka, Thanks for pointing it out for me, I finally found it's libvirt's policy never to change a committed public API. But driver handling methods are allowed to be changed, am I right? -- Regards Qiao Nuohan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virDomainGetCPUStats: fix boundary value problem of start_cpu
This API has boundary value problem, if start_cpu is equal to the number of cpus, no error infomation will be reported. This is because the confused meaning of variable max_id, so change the comparision and rename the variable max_id to total_num. Signed-off-by: Jincheng Miao jm...@redhat.com --- src/qemu/qemu_driver.c | 18 +- src/util/vircgroup.c | 18 +- tools/virsh-domain.c | 12 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c9a865e..54b8e5b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15983,7 +15983,7 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm, { int rv = -1; size_t i; -int id, max_id; +int id, total_num; char *pos; char *buf = NULL; unsigned long long *sum_cpu_time = NULL; @@ -15999,19 +15999,19 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm, return QEMU_NB_PER_CPU_STAT_PARAM; /* To parse account file, we need to know how many cpus are present. */ -max_id = nodeGetCPUCount(); -if (max_id 0) +total_num = nodeGetCPUCount(); +if (total_num 0) return rv; -if (ncpus == 0) { /* returns max cpu ID */ -rv = max_id; +if (ncpus == 0) { /* returns total number of cpu */ +rv = total_num; goto cleanup; } -if (start_cpu max_id) { +if (start_cpu total_num - 1) { virReportError(VIR_ERR_INVALID_ARG, _(start_cpu %d larger than maximum of %d), - start_cpu, max_id); + start_cpu, total_num - 1); goto cleanup; } @@ -16024,8 +16024,8 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm, param_idx = 0; /* number of cpus to compute */ -if (start_cpu = max_id - ncpus) -id = max_id - 1; +if (start_cpu + ncpus = total_num) +id = total_num - 1; else id = start_cpu + ncpus - 1; diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 0f04b4d..2af06af 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2836,7 +2836,7 @@ virCgroupGetPercpuStats(virCgroupPtr group, { int rv = -1; size_t i; -int id, max_id; +int id, total_num; char *pos; char *buf = NULL; virTypedParameterPtr ent; @@ -2848,19 +2848,19 @@ virCgroupGetPercpuStats(virCgroupPtr group, return CGROUP_NB_PER_CPU_STAT_PARAM; /* To parse account file, we need to know how many cpus are present. */ -max_id = nodeGetCPUCount(); -if (max_id 0) +total_num = nodeGetCPUCount(); +if (total_num 0) return rv; -if (ncpus == 0) { /* returns max cpu ID */ -rv = max_id; +if (ncpus == 0) { /* returns total number of cpu */ +rv = total_num; goto cleanup; } -if (start_cpu max_id) { +if (start_cpu total_num - 1) { virReportError(VIR_ERR_INVALID_ARG, _(start_cpu %d larger than maximum of %d), - start_cpu, max_id); + start_cpu, total_num - 1); goto cleanup; } @@ -2873,8 +2873,8 @@ virCgroupGetPercpuStats(virCgroupPtr group, param_idx = 0; /* number of cpus to compute */ -if (start_cpu = max_id - ncpus) -id = max_id - 1; +if (start_cpu + ncpus = total_num) +id = total_num - 1; else id = start_cpu + ncpus - 1; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3e73340..0ead80f 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6331,7 +6331,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) { virDomainPtr dom; virTypedParameterPtr params = NULL; -int pos, max_id, cpu = 0, show_count = -1, nparams = 0; +int pos, total_num, cpu = 0, show_count = -1, nparams = 0; size_t i, j; bool show_total = false, show_per_cpu = false; unsigned int flags = 0; @@ -6376,12 +6376,12 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) goto do_show_total; /* get number of cpus on the node */ -if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, flags)) 0) +if ((total_num = virDomainGetCPUStats(dom, NULL, 0, 0, 0, flags)) 0) goto failed_stats; -if (show_count 0 || show_count max_id) { -if (show_count max_id) -vshPrint(ctl, _(Only %d CPUs available to show\n), max_id); -show_count = max_id; +if (show_count 0 || show_count total_num) { +if (show_count total_num) +vshPrint(ctl, _(Only %d CPUs available to show\n), total_num); +show_count = total_num; } /* get percpu information */ -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/3] spec file improvements
On 25.02.2014 18:52, Eric Blake wrote: Our spec file is non-deterministic if you have this in your ~/.rpmmacros: %_without_udev 1 because it then depends on whether you have systemd-devel installed rather than being explicitly stated in the spec file. [At this point, I'm sending the series to get the review started on the two trivial parts; I'm still working on patch 3, including coming up with a formula for proving that the unpatched build was non-deterministic, rather than just my claim above] Eric Blake (2): build: fix spelling of configure --with-systemd-daemon spec: explicitly avoid bhyve on Linux libvirt.spec.in | 2 ++ m4/virt-lib.m4 | 20 +--- 2 files changed, 15 insertions(+), 7 deletions(-) ACK series and the release material too. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] build: fix spelling of configur --with-systemd-daemon
Hey, There is a missing 'e' in configure in the subject line. Christophe On Tue, Feb 25, 2014 at 10:52:24AM -0700, Eric Blake wrote: Commit 68954fb added a configure option --with-systemd_daemon, which violates the conventions of configure files preferring dash in all option names. This fixes it, before we hit a release where the tarball is baked with an awkward name. * m4/virt-lib.m4 (LIBVIRT_CHECK_LIB, LIBVIRT_CHECK_LIB_ALT) (LIBVIRT_CHECK_PKG): Favor - over _ in configure option names. Signed-off-by: Eric Blake ebl...@redhat.com --- m4/virt-lib.m4 | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4 index cff4fbb..75b9b1d 100644 --- a/m4/virt-lib.m4 +++ b/m4/virt-lib.m4 @@ -1,7 +1,7 @@ dnl dnl virt-lib.m4: Helper macros for checking for libraries dnl -dnl Copyright (C) 2012-2013 Red Hat, Inc. +dnl Copyright (C) 2012-2014 Red Hat, Inc. dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public @@ -54,16 +54,17 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[ m4_pushdef([header_name], [$4]) m4_pushdef([check_name_lc], m4_tolower(check_name)) + m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-])) m4_pushdef([config_var], [WITH_]check_name) m4_pushdef([make_var], [WITH_]check_name) m4_pushdef([cflags_var], check_name[_CFLAGS]) m4_pushdef([libs_var], check_name[_LIBS]) - m4_pushdef([arg_var], [with-]check_name_lc) + m4_pushdef([arg_var], [with-]check_name_dash) m4_pushdef([with_var], [with_]check_name_lc) m4_divert_text([DEFAULTS], [with_var][=check]) - AC_ARG_WITH(check_name_lc, + AC_ARG_WITH(check_name_dash, [AS_HELP_STRING([--arg_var], [with lib]]m4_dquote(library_name)[[ support @:@default=check@:@])]) @@ -126,6 +127,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[ m4_popdef([make_var]) m4_popdef([config_var]) + m4_popdef([check_name_dash]) m4_popdef([check_name_lc]) m4_popdef([header_name]) @@ -182,18 +184,19 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[ m4_pushdef([header_name_alt], [$8]) m4_pushdef([check_name_lc], m4_tolower(check_name)) + m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-])) m4_pushdef([config_var], [WITH_]check_name) m4_pushdef([make_var], [WITH_]check_name) m4_pushdef([cflags_var], check_name[_CFLAGS]) m4_pushdef([libs_var], check_name[_LIBS]) - m4_pushdef([arg_var], [with-]check_name_lc) + m4_pushdef([arg_var], [with-]check_name_dash) m4_pushdef([with_var], [with_]check_name_lc) m4_pushdef([config_var_alt], [WITH_]check_name_alt) m4_pushdef([make_var_alt], [WITH_]check_name_alt) m4_divert_text([DEFAULTS], [with_var][=check]) - AC_ARG_WITH(check_name_lc, + AC_ARG_WITH(check_name_dash, [AS_HELP_STRING([--arg_var], [with lib]]m4_dquote(library_name)[[ support @:@default=check@:@])]) @@ -273,6 +276,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[ m4_popdef([config_var]) m4_popdef([check_name_lc]) + m4_popdef([check_name_dash]) m4_popdef([header_name_alt]) m4_popdef([function_name_alt]) @@ -310,16 +314,17 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[ m4_pushdef([pc_version], [$3]) m4_pushdef([check_name_lc], m4_tolower(check_name)) + m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-])) m4_pushdef([config_var], [WITH_]check_name) m4_pushdef([make_var], [WITH_]check_name) m4_pushdef([cflags_var], check_name[_CFLAGS]) m4_pushdef([libs_var], check_name[_LIBS]) - m4_pushdef([arg_var], [with-]check_name_lc) + m4_pushdef([arg_var], [with-]check_name_dash) m4_pushdef([with_var], [with_]check_name_lc) m4_divert_text([DEFAULTS], [with_var][=check]) - AC_ARG_WITH(check_name_lc, + AC_ARG_WITH(check_name_dash, [AS_HELP_STRING([--arg_var], [with ]]m4_dquote(pc_name)[[ (= ]]m4_dquote(pc_version)[[) support @:@default=check@:@])]) @@ -353,6 +358,7 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[ m4_popdef([config_var]) m4_popdef([check_name_lc]) + m4_popdef([check_name_dash]) m4_popdef([pc_version]) m4_popdef([pc_name]) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list pgpFAmXHgoX43.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
trusted.* xattrs are only for CAP_SYS_ADMIN [host] # setfattr -n trusted.me.md5 -v d41d8cd98f00b204e9800998ecf8427e xattr-test [host] # getfattr -m - -d xattr-test # file: xattr-test trusted.me.md5=d41d8cd98f00b204e9800998ecf8427e [lxc] # getfattr -n trusted.me.md5 xattr-test xattr-test: trusted.me.md5: No such attribute [lxc] # strace -e trace=getxattr getfattr -n trusted.me.md5 xattr-test getxattr(xattr-test, trusted.me.md5, 0x0, 0) = -1 ENODATA (No data available) xattr-test: trusted.me.md5: No such attribute +++ exited with 1 +++ maybe ENODATA is from here http://lxr.free-electrons.com/source/fs/xattr.c#L56 so the capable(CAP_SYS_ADMIN) check fails. and if this check fails the check in cap_inode_setxattr() http://lxr.free-electrons.com/source/security/commoncap.c#L620 will also fail. but I don't know why. CAP_SYS_ADMIN is there /stephan -- Software is like sex, it's better when it's free! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: don't even call networkRunHook if there is no network
On 25.02.2014 16:46, Laine Stump wrote: networkAllocateActualDevice() is called for *all* interfaces, not just those with type='network'. In that case, it will jump down to its validate: label immediately, without allocating anything. After validation is done, two counters are potentially updated (one for the network, and one for any particular physical device that is chosen), and then networkRunHook() is called. This patch refactors that code a slight bit so that networkRunHook() doesn't get called if netdef is NULL (i.e. type != network) and to place the conditional increment of dev-connections inside the if (netdef) as well - dev can never be non-null if netdef is null (because dev is the pointer to a device in a network's pool of devices), so this doesn't have any functional effect, it just makes the code clearer. --- src/network/bridge_driver.c | 47 ++--- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 152bd06..3fb5ad3 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3662,36 +3662,35 @@ validate: } } -if (dev) { -/* mark the allocation */ -dev-connections++; -if (actualType != VIR_DOMAIN_NET_TYPE_HOSTDEV) { -VIR_DEBUG(Using physical device %s, %d connections, - dev-device.dev, dev-connections); -} else { -VIR_DEBUG(Using physical device %04x:%02x:%02x.%x, connections %d, - dev-device.pci.domain, dev-device.pci.bus, - dev-device.pci.slot, dev-device.pci.function, - dev-connections); -} -} - if (netdef) { netdef-connections++; VIR_DEBUG(Using network %s, %d connections, netdef-name, netdef-connections); -} -/* finally we can call the 'plugged' hook script if any */ -if (networkRunHook(network, dom, iface, - VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, - VIR_HOOK_SUBOP_BEGIN) 0) { -/* adjust for failure */ -if (dev) -dev-connections--; -if (netdef) +if (dev) { +/* mark the allocation */ +dev-connections++; +if (actualType != VIR_DOMAIN_NET_TYPE_HOSTDEV) { +VIR_DEBUG(Using physical device %s, %d connections, + dev-device.dev, dev-connections); +} else { +VIR_DEBUG(Using physical device %04x:%02x:%02x.%x, connections %d, + dev-device.pci.domain, dev-device.pci.bus, + dev-device.pci.slot, dev-device.pci.function, + dev-connections); +} +} + +/* finally we can call the 'plugged' hook script if any */ +if (networkRunHook(network, dom, iface, + VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, + VIR_HOOK_SUBOP_BEGIN) 0) { +/* adjust for failure */ netdef-connections--; -goto error; +if (dev) +dev-connections--; +goto error; +} } ret = 0; I thought this problem was solved by 83c404ff. I wonder what went wrong. Or maybe nothing is actually wrong, and this is merely just a refactoring. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak in virSCSIDeviceListDel()
On 02/22/2014 09:00 PM, Nehal J Wani wrote: While running virscsitest, it was found that valgrind pointed out the following memory leak: ==320== 5 bytes in 1 blocks are definitely lost in loss record 4 of 37 ==320==at 0x4A069EE: malloc (vg_replace_malloc.c:270) ==320==by 0x3E6CE81171: strdup (strdup.c:43) ==320==by 0x4CB28DF: virStrdup (virstring.c:554) ==320==by 0x4CAC987: virSCSIDeviceSetUsedBy (virscsi.c:289) ==320==by 0x402321: test2 (virscsitest.c:100) ==320==by 0x403231: virtTestRun (testutils.c:199) ==320==by 0x402121: mymain (virscsitest.c:180) ==320==by 0x4039AD: virtTestMain (testutils.c:782) ==320==by 0x3E6CE1ED1C: (below main) (libc-start.c:226) ==320== --- src/util/virscsi.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) ACK and pushed. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: unplug bandwidth and call networkRunHook only when appropriate
On 25.02.2014 16:47, Laine Stump wrote: According to commit b4e0299dm if networkAllocateActualDevice() was The 'm' at the end of has is a typo. s/dm/d,/ successful, it will *always* allocate an iface-data.network.actual, so we can use this during networkReleaseActualDevice() to know if there is really anything to undo. We were properly using this information to only decrement the network connections counter if it had previously been incremented, but we were unconditionally unplugging bandwidth and calling the unplugged network hook for *all* interfaces (during qemuProcessStop()) whether they had been previously plugged or not. This caused problems if a domain failed to start at some time prior to all interfaces being allocated. (I encountered this when an interface had a bandwidth floor set but no inbound QoS). This patch changes both the call to networkUnplugBandwidth() and the call to networkRunHook() to only be called if there was a previous call to plug for the same interface. --- src/network/bridge_driver.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
On Wed, Feb 26, 2014 at 11:38:08AM +0100, Stephan Sachse wrote: trusted.* xattrs are only for CAP_SYS_ADMIN [host] # setfattr -n trusted.me.md5 -v d41d8cd98f00b204e9800998ecf8427e xattr-test [host] # getfattr -m - -d xattr-test # file: xattr-test trusted.me.md5=d41d8cd98f00b204e9800998ecf8427e [lxc] # getfattr -n trusted.me.md5 xattr-test xattr-test: trusted.me.md5: No such attribute [lxc] # strace -e trace=getxattr getfattr -n trusted.me.md5 xattr-test getxattr(xattr-test, trusted.me.md5, 0x0, 0) = -1 ENODATA (No data available) xattr-test: trusted.me.md5: No such attribute +++ exited with 1 +++ maybe ENODATA is from here http://lxr.free-electrons.com/source/fs/xattr.c#L56 so the capable(CAP_SYS_ADMIN) check fails. and if this check fails the check in cap_inode_setxattr() http://lxr.free-electrons.com/source/security/commoncap.c#L620 will also fail. but I don't know why. CAP_SYS_ADMIN is there The capable() function only suceeds in the primary host namespace. The kernel uses ns_capable() in cases where container namespaces are allowed to use capabilities. So this indicates that the kernel guys didn't believe it to be safe to allow use of the 'trusted' xattr namespace in containers. That said, I didn't think the 'trusted.' prefix was needed for package installation. It thought it used the 'security.' xattr prefix for file ACLs. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
The capable() function only suceeds in the primary host namespace. The kernel uses ns_capable() in cases where container namespaces are allowed to use capabilities. So this indicates that the kernel guys didn't believe it to be safe to allow use of the 'trusted' xattr namespace in containers. That said, I didn't think the 'trusted.' prefix was needed for package installation. It thought it used the 'security.' xattr prefix for file ACLs. the trusted.* prefix was for testing, because it checks also at reading the attributes. security.capability is used for setcap http://lxr.free-electrons.com/source/security/commoncap.c#L620 but it also use capable() setfacl works fine /stephan -- Software is like sex, it's better when it's free! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: don't even call networkRunHook if there is no network
On 02/26/2014 12:42 PM, Michal Privoznik wrote: On 25.02.2014 16:46, Laine Stump wrote: [...] This patch refactors that code a slight bit so that networkRunHook() doesn't get called if netdef is NULL (i.e. type != network) and to place the conditional increment of dev-connections inside the if (netdef) as well - dev can never be non-null if netdef is null (because dev is the pointer to a device in a network's pool of devices), so this doesn't have any functional effect, it just makes the code clearer. --- I thought this problem was solved by 83c404ff. I wonder what went wrong. Or maybe nothing is actually wrong, and this is merely just a refactoring. Just refactoring to make it clearer what was happening (although it also makes that fix unnecessary); I coincidentally found it while working on the unplug bandwidth and call networkRunHook only when appropriate patch. I spent time figuring out exactly when dev and netdef would/wouldn't be NULL, and decided to make the code reflect my findings so that the next person to come along wouldn't need to go through the same investigation. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 1/10] nwfilter: make ignoring non-zero status easier to follow
On 02/26/2014 01:37 AM, Eric Blake wrote: While auditing all callers of virCommandRun, I noticed that nwfilter code never paid attention to commands with a non-zero status; they were merely passing a pointer to avoid spamming the logs with a message about commands that might indeed fail. But proving this required chasing through a lot of code; refactoring things to localize the decision of whether to ignore non-zero status makes it easier to prove that later changes to virFork don't negatively affect this code. While at it, I also noticed that ebiptablesRemoveRules would actually report success if the child process failed for a reason other than non-zero status, such as OOM. ACK. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak in virDomainSnapshotDiskDefClear()
On 02/22/2014 08:37 PM, Nehal J Wani wrote: While running domainsnapshotxml2xmltest, it was found that valgrind pointed out the following memory leaks: ==32176== 42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 42 of 66 ==32176==at 0x4A069EE: malloc (vg_replace_malloc.c:270) ==32176==by 0x4A06B62: realloc (vg_replace_malloc.c:662) ==32176==by 0x4C65A07: virReallocN (viralloc.c:243) ==32176==by 0x4C65B2E: virExpandN (viralloc.c:292) ==32176==by 0x4C65E30: virInsertElementsN (viralloc.c:434) ==32176==by 0x4CD71F3: virDomainDiskSourceDefParse (domain_conf.c:5078) ==32176==by 0x4CF6EF4: virDomainSnapshotDefParseNode (snapshot_conf.c:151) ==32176==by 0x4CF7314: virDomainSnapshotDefParseString (snapshot_conf.c:410) ==32176==by 0x41FB8D: testCompareXMLToXMLHelper (domainsnapshotxml2xmltest.c:100) ==32176==by 0x420FD1: virtTestRun (testutils.c:199) ==32176==by 0x41F859: mymain (domainsnapshotxml2xmltest.c:222) ==32176==by 0x42174D: virtTestMain (testutils.c:782) ==32176== ==32176== 128 (96 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 51 of 66 ==32176==at 0x4A06BE0: realloc (vg_replace_malloc.c:662) ==32176==by 0x4C65A07: virReallocN (viralloc.c:243) ==32176==by 0x4C65B2E: virExpandN (viralloc.c:292) ==32176==by 0x4C65E30: virInsertElementsN (viralloc.c:434) ==32176==by 0x4CD71F3: virDomainDiskSourceDefParse (domain_conf.c:5078) ==32176==by 0x4CF6EF4: virDomainSnapshotDefParseNode (snapshot_conf.c:151) ==32176==by 0x4CF7314: virDomainSnapshotDefParseString (snapshot_conf.c:410) ==32176==by 0x41FB8D: testCompareXMLToXMLHelper (domainsnapshotxml2xmltest.c:100) ==32176==by 0x420FD1: virtTestRun (testutils.c:199) ==32176==by 0x41F859: mymain (domainsnapshotxml2xmltest.c:222) ==32176==by 0x42174D: virtTestMain (testutils.c:782) ==32176==by 0x3E6CE1ED1C: (below main) (libc-start.c:226) ==32176== --- src/conf/snapshot_conf.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 12b0930..475525f 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -82,6 +82,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk) { VIR_FREE(disk-name); VIR_FREE(disk-file); +virDomainDiskHostDefFree(disk-nhosts, disk-hosts); This leaves nhosts and hosts at their original values, which seems to be OK everywhere this function is called, but it might be a problem if someone tries to reuse the disk definition instead of freeing it. I'd rather write this as: while (disk-nhosts) virDomainDiskHostDefClear(disk-hosts[--def-nhosts]) VIR_FREE(disk-hosts) Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] spec: Use correct versions of libgfapi in RHEL builds
RHEL still uses the 3.4.0 package of libgfapi and the package is built only for x86_64. --- libvirt.spec.in | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 3d5a69e..67b5557 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 +%if 0%{?fedora} = 19 || 0%{?rhel = 6} %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -153,6 +153,13 @@ %define with_numactl 0 %endif +# libgfapi is built only on x86_64 on rhel +%ifnarch x86_64 +%if 0%{?rhel = 6} +%define with_storage_gluster 0 +%endif +%endif + # RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor, # VMWare, libxenserver (xenapi), libxenlight (Xen 4.1 and newer), # or HyperV. @@ -571,9 +578,14 @@ BuildRequires: ceph-devel %endif %endif %if %{with_storage_gluster} +%if 0%{?rhel} = 6 +BuildRequires: glusterfs-api-devel = 3.4.0 +BuildRequires: glusterfs-devel = 3.4.0 +%else BuildRequires: glusterfs-api-devel = 3.4.1 BuildRequires: glusterfs-devel = 3.4.1 %endif +%endif %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Use correct versions of libgfapi in RHEL builds
On Wed, Feb 26, 2014 at 13:09:48 +0100, Peter Krempa wrote: RHEL still uses the 3.4.0 package of libgfapi and the package is built only for x86_64. --- libvirt.spec.in | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 3d5a69e..67b5557 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 +%if 0%{?fedora} = 19 || 0%{?rhel = 6} %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -153,6 +153,13 @@ %define with_numactl 0 %endif +# libgfapi is built only on x86_64 on rhel +%ifnarch x86_64 +%if 0%{?rhel = 6} +%define with_storage_gluster 0 +%endif +%endif + # RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor, # VMWare, libxenserver (xenapi), libxenlight (Xen 4.1 and newer), # or HyperV. @@ -571,9 +578,14 @@ BuildRequires: ceph-devel %endif %endif %if %{with_storage_gluster} +%if 0%{?rhel} = 6 +BuildRequires: glusterfs-api-devel = 3.4.0 +BuildRequires: glusterfs-devel = 3.4.0 +%else BuildRequires: glusterfs-api-devel = 3.4.1 BuildRequires: glusterfs-devel = 3.4.1 %endif +%endif The nested if/else/endif should be indented. %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel ACK once fixed. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: Honour -q in domblklist, vcpupin and emulatorpin
If user wants to grep some info from domain, e.g. disk paths: # virsh -q domblklist win7 | awk '{print $2}' Source /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso while with my change: # virsh -q domblklist win7 | awk '{print $2}' /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso We don't print table header in other commands, like list. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- tools/virsh-domain-monitor.c | 14 +++--- tools/virsh-domain.c | 10 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 1192565..4905b7e 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -495,12 +495,12 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) goto cleanup; if (details) -vshPrint(ctl, %-10s %-10s %-10s %s\n, _(Type), - _(Device), _(Target), _(Source)); +vshPrintExtra(ctl, %-10s %-10s %-10s %s\n, _(Type), + _(Device), _(Target), _(Source)); else -vshPrint(ctl, %-10s %s\n, _(Target), _(Source)); +vshPrintExtra(ctl, %-10s %s\n, _(Target), _(Source)); -vshPrint(ctl, \n); +vshPrintExtra(ctl, \n); for (i = 0; i ndisks; i++) { char *type = NULL; @@ -609,9 +609,9 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd) if (ninterfaces 0) goto cleanup; -vshPrint(ctl, %-10s %-10s %-10s %-11s %s\n, _(Interface), _(Type), - _(Source), _(Model), _(MAC)); -vshPrint(ctl, ---\n); +vshPrintExtra(ctl, %-10s %-10s %-10s %-11s %s\n, _(Interface), + _(Type), _(Source), _(Model), _(MAC)); +vshPrintExtra(ctl, ---\n); for (i = 0; i ninterfaces; i++) { char *type = NULL; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3e73340..2e3f0ed 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5815,8 +5815,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) if ((ncpus = virDomainGetVcpuPinInfo(dom, info.nrVirtCpu, cpumaps, cpumaplen, flags)) = 0) { -vshPrint(ctl, %s %s\n, _(VCPU:), _(CPU Affinity)); -vshPrint(ctl, --\n); +vshPrintExtra(ctl, %s %s\n, _(VCPU:), _(CPU Affinity)); +vshPrintExtra(ctl, --\n); for (i = 0; i ncpus; i++) { if (vcpu != -1 i != vcpu) continue; @@ -5944,9 +5944,9 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd) cpumaps = vshMalloc(ctl, cpumaplen); if (virDomainGetEmulatorPinInfo(dom, cpumaps, cpumaplen, flags) = 0) { -vshPrint(ctl, %s %s\n, _(emulator:), _(CPU Affinity)); -vshPrint(ctl, --\n); -vshPrint(ctl,*: ); +vshPrintExtra(ctl, %s %s\n, _(emulator:), _(CPU Affinity)); +vshPrintExtra(ctl, --\n); +vshPrintExtra(ctl,*: ); ret = vshPrintPinInfo(cpumaps, cpumaplen, maxcpu, 0); vshPrint(ctl, \n); } -- 1.9.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Use correct versions of libgfapi in RHEL builds
On 02/26/14 13:15, Jiri Denemark wrote: On Wed, Feb 26, 2014 at 13:09:48 +0100, Peter Krempa wrote: RHEL still uses the 3.4.0 package of libgfapi and the package is built only for x86_64. --- libvirt.spec.in | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) +%else BuildRequires: glusterfs-api-devel = 3.4.1 BuildRequires: glusterfs-devel = 3.4.1 %endif +%endif The nested if/else/endif should be indented. %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel ACK once fixed. Fixed pushed. Jirka Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH LIBVIRT] libxl: Recognise ARM architectures
Only tested on v7 but the v8 equivalent seems pretty obvious. XEN_CAP_REGEX already accepts more than it should (e.g. x86_64p or x86_32be) but I have stuck with the existing pattern. With this I can create a guest from: domain type='xen' namelibvirt-test/name uuid6343998e-9eda-11e3-98f6-77252a7d02f3/uuid memory393216/memory currentMemory393216/currentMemory vcpu1/vcpu os type arch='armv7l' machine='xenpv'linux/type kernel/boot/vmlinuz-arm-native/kernel cmdlineconsole=hvc0 earlyprintk debug root=/dev/xvda1/cmdline /os clock offset='utc'/ on_poweroffdestroy/on_poweroff on_rebootrestart/on_reboot on_crashdestroy/on_crash devices disk type='block' device='disk' source dev='/dev/marilith-n0/debian-disk'/ target dev='xvda1'/ /disk interface type='bridge' mac address='8e:a7:8e:3c:f4:f6'/ source bridge='xenbr0'/ /interface /devices /domain Using virsh create and I can destroy it too. Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null I haven't investigated yet. Signed-off-by: Ian Campbell ian.campb...@citrix.com --- src/libxl/libxl_conf.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 4cefadf..7ed692d 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -61,7 +61,7 @@ struct guest_arch { int ia64_be; }; -#define XEN_CAP_REGEX (xen|hvm)-[[:digit:]]+\\.[[:digit:]]+-(x86_32|x86_64|ia64|powerpc64)(p|be)? +#define XEN_CAP_REGEX (xen|hvm)-[[:digit:]]+\\.[[:digit:]]+-(aarch64|armv7l|x86_32|x86_64|ia64|powerpc64)(p|be)? static virClassPtr libxlDriverConfigClass; @@ -319,8 +319,11 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) } else if (STRPREFIX(token[subs[2].rm_so], powerpc64)) { arch = VIR_ARCH_PPC64; +} else if (STRPREFIX(token[subs[2].rm_so], armv7l)) { +arch = VIR_ARCH_ARMV7L; +} else if (STRPREFIX(token[subs[2].rm_so], aarch64)) { +arch = VIR_ARCH_AARCH64; } else { -/* XXX arm ? */ continue; } -- 1.7.10.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Use correct versions of libgfapi in RHEL builds
On Wed, Feb 26, 2014 at 01:09:48PM +0100, Peter Krempa wrote: RHEL still uses the 3.4.0 package of libgfapi and the package is built only for x86_64. --- libvirt.spec.in | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 3d5a69e..67b5557 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 +%if 0%{?fedora} = 19 || 0%{?rhel = 6} Be consistent, this ... %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -153,6 +153,13 @@ %define with_numactl 0 %endif +# libgfapi is built only on x86_64 on rhel +%ifnarch x86_64 +%if 0%{?rhel = 6} ... and this doesn't look like ... +%define with_storage_gluster 0 +%endif +%endif + # RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor, # VMWare, libxenserver (xenapi), libxenlight (Xen 4.1 and newer), # or HyperV. @@ -571,9 +578,14 @@ BuildRequires: ceph-devel %endif %endif %if %{with_storage_gluster} +%if 0%{?rhel} = 6 ... this, which is the only one that'll work, I guess. BTW: If 3.4.0 is enough, why are we requiring 3.4.1 somewhere? Martin +BuildRequires: glusterfs-api-devel = 3.4.0 +BuildRequires: glusterfs-devel = 3.4.0 +%else BuildRequires: glusterfs-api-devel = 3.4.1 BuildRequires: glusterfs-devel = 3.4.1 %endif +%endif %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Only tested on v7 but the v8 equivalent seems pretty obvious. XEN_CAP_REGEX already accepts more than it should (e.g. x86_64p or x86_32be) but I have stuck with the existing pattern. With this I can create a guest from: domain type='xen' namelibvirt-test/name uuid6343998e-9eda-11e3-98f6-77252a7d02f3/uuid memory393216/memory currentMemory393216/currentMemory vcpu1/vcpu os type arch='armv7l' machine='xenpv'linux/type kernel/boot/vmlinuz-arm-native/kernel cmdlineconsole=hvc0 earlyprintk debug root=/dev/xvda1/cmdline /os clock offset='utc'/ on_poweroffdestroy/on_poweroff on_rebootrestart/on_reboot on_crashdestroy/on_crash devices disk type='block' device='disk' source dev='/dev/marilith-n0/debian-disk'/ target dev='xvda1'/ /disk interface type='bridge' mac address='8e:a7:8e:3c:f4:f6'/ source bridge='xenbr0'/ /interface /devices /domain Using virsh create and I can destroy it too. Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null I haven't investigated yet. That'll be because no console or serial device is listed in your config above I expect. Also looks like bogus error handling in the console API, not checking for null. ACK Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, 2014-02-26 at 12:37 +, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null I haven't investigated yet. That'll be because no console or serial device is listed in your config above I expect. Also looks like bogus error handling in the console API, not checking for null. Thanks. I've just tried (inside devices.../...): console tty='/dev/pts/5'/ and console type='pty' target port='0'/ /console which I gleaned from http://libvirt.org/drvxen.html but neither seem to do the trick (and the first ones use of an explicit pts looks odd to me...). ACK Thanks. Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: Honour -q in domblklist, vcpupin and emulatorpin
On Wed, Feb 26, 2014 at 01:25:09PM +0100, Michal Privoznik wrote: If user wants to grep some info from domain, e.g. disk paths: # virsh -q domblklist win7 | awk '{print $2}' Source /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso while with my change: # virsh -q domblklist win7 | awk '{print $2}' /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso We don't print table header in other commands, like list. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- tools/virsh-domain-monitor.c | 14 +++--- tools/virsh-domain.c | 10 +- 2 files changed, 12 insertions(+), 12 deletions(-) ACK Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] build: fix spelling of configur --with-systemd-daemon
On 02/26/2014 03:02 AM, Christophe Fergeau wrote: Hey, There is a missing 'e' in configure in the subject line. Thanks; fixed (actually, reworded): build: use --with-systemd-daemon as configure option . On 02/26/2014 02:59 AM, Michal Privoznik wrote: On 25.02.2014 18:52, Eric Blake wrote: Our spec file is non-deterministic if you have this in your ~/.rpmmacros: %_without_udev 1 ACK series and the release material too. Thanks; pushed. (Missed rc2, but that's no real loss). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/2] make qemu dump memory in kdump-compressed format
On 02/26/2014 01:08 AM, Qiao Nuohan wrote: int virDomainCoreDump (virDomainPtr domain, const char *to, - unsigned int flags); + unsigned int flags, + const unsigned int memory_dump_format); This is not allowed and I believe make syntax-check should fail on the corresponding change to remote_protocol.x. If you want to add a new I don't know if syntax-check would catch it, but the fact that you would have had to modify src/remote_protocol-structs is indeed a red flag that reviewers will catch. parameter to an existing API, you have keep the API as is and instead create a new API with a different name that will have all the parameters you need. Hello Jirka, Thanks for pointing it out for me, I finally found it's libvirt's policy never to change a committed public API. But driver handling methods are allowed to be changed, am I right? Changing driver handling methods is fine. That said, how are you going to provide the extra parameter to the driver handler without also having a public API? We have a script that validates that all the driver function names are close derivatives of the public API names, because that's the only way to programmatically enforce that we have proper ACL checks in all APIs. So really, the easiest would be adding a new API and new driver methods, with a better signature. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] spec: Fix braces around macros
In commit 72f7658ba24491672e6b81118f892400916e9404 I've added a few macros with bad bracing. Although they work as expected fix them so that we use uniform syntax. --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index fae4bb7..ef3b832 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 || 0%{?rhel = 6} +%if 0%{?fedora} = 19 || 0%{?rhel} = 6 %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -155,7 +155,7 @@ # libgfapi is built only on x86_64 on rhel %ifnarch x86_64 -%if 0%{?rhel = 6} +%if 0%{?rhel} = 6 %define with_storage_gluster 0 %endif %endif -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Fix braces around macros
On Wed, Feb 26, 2014 at 02:21:11PM +0100, Peter Krempa wrote: In commit 72f7658ba24491672e6b81118f892400916e9404 I've added a few macros with bad bracing. Although they work as expected fix them so that we use uniform syntax. --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index fae4bb7..ef3b832 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 || 0%{?rhel = 6} +%if 0%{?fedora} = 19 || 0%{?rhel} = 6 %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -155,7 +155,7 @@ # libgfapi is built only on x86_64 on rhel %ifnarch x86_64 -%if 0%{?rhel = 6} +%if 0%{?rhel} = 6 %define with_storage_gluster 0 %endif %endif -- 1.8.5.5 ACK, thanks. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Fix braces around macros
On 02/26/2014 06:21 AM, Peter Krempa wrote: In commit 72f7658ba24491672e6b81118f892400916e9404 I've added a few macros with bad bracing. Although they work as expected fix them so that we use uniform syntax. --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) I'd prefer we simplify things to just require 3.4.0 as a minimum gluster everywhere, instead of trying to distinguish between fedora and rhel. The only reason we started with 3.4.1 was because I started testing on Fedora; now that we've proved a lower minimum version works, it is just fine to use the lower minimum. diff --git a/libvirt.spec.in b/libvirt.spec.in index fae4bb7..ef3b832 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 || 0%{?rhel = 6} +%if 0%{?fedora} = 19 || 0%{?rhel} = 6 %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -155,7 +155,7 @@ # libgfapi is built only on x86_64 on rhel %ifnarch x86_64 -%if 0%{?rhel = 6} +%if 0%{?rhel} = 6 These two hunks make sense, but we might as well get the version fix done at the same time to minimize the churn in gluster-related spec changes. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Fix braces around macros
On 02/26/14 14:29, Eric Blake wrote: On 02/26/2014 06:21 AM, Peter Krempa wrote: In commit 72f7658ba24491672e6b81118f892400916e9404 I've added a few macros with bad bracing. Although they work as expected fix them so that we use uniform syntax. --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) I'd prefer we simplify things to just require 3.4.0 as a minimum gluster everywhere, instead of trying to distinguish between fedora and rhel. The only reason we started with 3.4.1 was because I started testing on Fedora; now that we've proved a lower minimum version works, it is just fine to use the lower minimum. diff --git a/libvirt.spec.in b/libvirt.spec.in index fae4bb7..ef3b832 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 || 0%{?rhel = 6} +%if 0%{?fedora} = 19 || 0%{?rhel} = 6 %define with_storage_gluster 0%{!?_without_storage_gluster:%{server_drivers}} %else %define with_storage_gluster 0 @@ -155,7 +155,7 @@ # libgfapi is built only on x86_64 on rhel %ifnarch x86_64 -%if 0%{?rhel = 6} +%if 0%{?rhel} = 6 These two hunks make sense, but we might as well get the version fix done at the same time to minimize the churn in gluster-related spec changes. Oh well, I've already pushed just the brace fix. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] spec: Use correct versions of libgfapi in RHEL builds
On 02/26/2014 05:35 AM, Martin Kletzander wrote: On Wed, Feb 26, 2014 at 01:09:48PM +0100, Peter Krempa wrote: RHEL still uses the 3.4.0 package of libgfapi and the package is built only for x86_64. --- libvirt.spec.in | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 3d5a69e..67b5557 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -98,7 +98,7 @@ %else %define with_storage_sheepdog 0 %endif -%if 0%{?fedora} = 19 +%if 0%{?fedora} = 19 || 0%{?rhel = 6} Be consistent, this ... rpmbuild isn't dying, but I think this is trying to compute the value of a variable literally named 'rhel = 6', which doesn't exist, so the overall %if ends up looking like '%if ... || 0' and the rhel arm never fires. ... and this doesn't look like ... %endif %if %{with_storage_gluster} +%if 0%{?rhel} = 6 ... this, which is the only one that'll work, I guess. Indeed, this is the form that works whether 'rhel' is defined ('%if 07 = 6', remembering that %if does decimal math rather than octal), or undefined ('%if 0 = 6'). BTW: If 3.4.0 is enough, why are we requiring 3.4.1 somewhere? 3.4.1 happens to be what Fedora ships with, and where gluster was originally tested. But I'm okay with going with the simpler change of just requiring 3.4.0 as a minimum, now that we've tested that, rather than trying to make this quite so complex. We definitely need a followup. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On 02/26/2014 05:37 AM, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Only tested on v7 but the v8 equivalent seems pretty obvious. XEN_CAP_REGEX already accepts more than it should (e.g. x86_64p or x86_32be) but I have stuck with the existing pattern. With this I can create a guest from: domain type='xen' namelibvirt-test/name uuid6343998e-9eda-11e3-98f6-77252a7d02f3/uuid memory393216/memory currentMemory393216/currentMemory vcpu1/vcpu os type arch='armv7l' machine='xenpv'linux/type kernel/boot/vmlinuz-arm-native/kernel cmdlineconsole=hvc0 earlyprintk debug root=/dev/xvda1/cmdline /os ACK I've gone ahead and pushed the patch. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
for me there is no valid reason why a container is not allowed to set file capabilities. and here is the patch (send to Eric W. Biederman ebied...@xmission.com) works for me -- Software is like sex, it's better when it's free! Subject: [PATCH] capability: allow setxattr within userns a lxc container with user namespace enabled can not set file capabilities. every yum install pkg where the pkg has file capabilities fails with Error unpacking rpm package PKG error: unpacking of archive failed on file FILE: cpio: cap_set_file for me there is no valid reason why a container is not allowed to set file capabilities Signed-off-by: Stephan Sachse sac...@nugmbh.de --- security/commoncap.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/security/commoncap.c b/security/commoncap.c index b9d613e..9efdbef 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -621,14 +621,14 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { if (!strcmp(name, XATTR_NAME_CAPS)) { - if (!capable(CAP_SETFCAP)) + if (!ns_capable(current_user_ns(), CAP_SETFCAP)) return -EPERM; return 0; } if (!strncmp(name, XATTR_SECURITY_PREFIX, sizeof(XATTR_SECURITY_PREFIX) - 1) - !capable(CAP_SYS_ADMIN)) + !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) return -EPERM; return 0; } @@ -647,14 +647,14 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name, int cap_inode_removexattr(struct dentry *dentry, const char *name) { if (!strcmp(name, XATTR_NAME_CAPS)) { - if (!capable(CAP_SETFCAP)) + if (!ns_capable(current_user_ns(), CAP_SETFCAP)) return -EPERM; return 0; } if (!strncmp(name, XATTR_SECURITY_PREFIX, sizeof(XATTR_SECURITY_PREFIX) - 1) - !capable(CAP_SYS_ADMIN)) + !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) return -EPERM; return 0; } -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/2] make qemu dump memory in kdump-compressed format
On Wed, Feb 26, 2014 at 04:08:11PM +0800, Qiao Nuohan wrote: On 02/25/2014 06:56 PM, Jiri Denemark wrote: On Tue, Feb 25, 2014 at 17:54:30 +0800, Qiao Nuohan wrote: --memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is used to add --compress and [--compression-format]string to virsh dump --memory-only and send dump-guest-memory command to qemu with dump format specified to one of elf, kdump-zlib, kdump-lzo and kdump-snappy. Signed-off-by: Qiao Nuohanqiaonuo...@cn.fujitsu.com --- include/libvirt/libvirt.h.in | 15 ++- src/driver.h | 3 ++- src/libvirt.c| 10 -- src/qemu/qemu_driver.c | 30 + src/qemu/qemu_monitor.c | 6 +++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- src/remote/remote_protocol.x | 1 + src/test/test_driver.c | 12 +++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++- 12 files changed, 113 insertions(+), 21 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..aae3c49 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1180,6 +1180,18 @@ typedef enum { VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ } virDomainCoreDumpFlags; +typedef enum { +VIR_MEMORY_DUMP_COMPRESS_ZLIB = 1, /* dump guest memory in +kdump-compressed format, with +zlib-compressed */ +VIR_MEMORY_DUMP_COMPRESS_LZO= 2, /* dump guest memory in +kdump-compressed format, with +lzo-compressed */ +VIR_MEMORY_DUMP_COMPRESS_SNAPPY = 3, /* dump guest memory in +kdump-compressed format, with +snappy-compressed */ +} virMemoryDumpFormat; + /* Domain migration flags. */ typedef enum { VIR_MIGRATE_LIVE = (1 0), /* live migration */ @@ -1728,7 +1740,8 @@ int virDomainManagedSaveRemove(virDomainPtr dom, */ int virDomainCoreDump (virDomainPtr domain, const char *to, - unsigned int flags); + unsigned int flags, + const unsigned int memory_dump_format); This is not allowed and I believe make syntax-check should fail on the corresponding change to remote_protocol.x. If you want to add a new parameter to an existing API, you have keep the API as is and instead create a new API with a different name that will have all the parameters you need. Hello Jirka, Thanks for pointing it out for me, I finally found it's libvirt's policy never to change a committed public API. But driver handling methods are allowed to be changed, am I right? Yes no. There should be a 1-1 mapping of APIs in libvirt.h to driver callbacks defined in src/driver.h. The driver.h maps into the remote RPC protocol and that is considered part of the ABI and thus must not change. What is permitted is in the implementation of the new APIs is to share code with the impl of the old API. ie in qemu_driver.c Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
Quoting Stephan Sachse (ste.sac...@gmail.com): for me there is no valid reason why a container is not allowed to set file capabilities. (For the sake of the libvir-list, I replied to this on the lxc-devel@ list with a proposal that should work; but this particular patch is not safe, as nothing would stop an unprivileged user from mapping 0 to his uid in a new namespace, adding CAP_SYS_ADMIN, getting back to the init namespace, and running it with privilege. Adding a new capability format which adds the kuid_t of the user_ns root would solve this. Thanks Stephan for pushing on this.) -serge -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, Feb 26, 2014 at 02:55:13PM +, Ian Campbell wrote: On Wed, 2014-02-26 at 15:00 +0100, Olaf Hering wrote: On Wed, Feb 26, Ian Campbell wrote: On Wed, 2014-02-26 at 12:37 +, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null That'll be because no console or serial device is listed in your config above I expect. Also looks like bogus error handling in the console API, not checking for null. Thanks. I've just tried (inside devices.../...): console tty='/dev/pts/5'/ and console type='pty' target port='0'/ /console which I gleaned from http://libvirt.org/drvxen.html but neither seem to do the trick (and the first ones use of an explicit pts looks odd to me...). I learned yesterday this should be serial instead of console, maybe it fixes also your case. My understanding was that this was for HVM guests, whereas ARM has a PV console but I suppose I should try it anyway. I've got a flight to catch so it'll be a few days I expect. Yep, if ARM has a PV console, then we'd need to add tiny bit to the XML to allow us to configure that explicitly, similar to how we do for KVM's virtio-console support. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, 2014-02-26 at 15:00 +0100, Olaf Hering wrote: On Wed, Feb 26, Ian Campbell wrote: On Wed, 2014-02-26 at 12:37 +, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null That'll be because no console or serial device is listed in your config above I expect. Also looks like bogus error handling in the console API, not checking for null. Thanks. I've just tried (inside devices.../...): console tty='/dev/pts/5'/ and console type='pty' target port='0'/ /console which I gleaned from http://libvirt.org/drvxen.html but neither seem to do the trick (and the first ones use of an explicit pts looks odd to me...). I learned yesterday this should be serial instead of console, maybe it fixes also your case. My understanding was that this was for HVM guests, whereas ARM has a PV console but I suppose I should try it anyway. I've got a flight to catch so it'll be a few days I expect. Thanks, Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] LXC: capset fails with userns
On Wed, Feb 26, 2014 at 08:54:02AM -0600, Serge Hallyn wrote: Quoting Stephan Sachse (ste.sac...@gmail.com): for me there is no valid reason why a container is not allowed to set file capabilities. (For the sake of the libvir-list, I replied to this on the lxc-devel@ list with a proposal that should work; but this particular patch is not safe, as nothing would stop an unprivileged user from mapping 0 to his uid in a new namespace, adding CAP_SYS_ADMIN, getting back to the init namespace, and running it with privilege. Adding a new capability format which adds the kuid_t of the user_ns root would solve this. Thanks Stephan for pushing on this.) Thanks, I thought there would be some good reason for this restriction. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, 2014-02-26 at 06:34 -0700, Eric Blake wrote: On 02/26/2014 05:37 AM, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Only tested on v7 but the v8 equivalent seems pretty obvious. XEN_CAP_REGEX already accepts more than it should (e.g. x86_64p or x86_32be) but I have stuck with the existing pattern. With this I can create a guest from: domain type='xen' namelibvirt-test/name uuid6343998e-9eda-11e3-98f6-77252a7d02f3/uuid memory393216/memory currentMemory393216/currentMemory vcpu1/vcpu os type arch='armv7l' machine='xenpv'linux/type kernel/boot/vmlinuz-arm-native/kernel cmdlineconsole=hvc0 earlyprintk debug root=/dev/xvda1/cmdline /os ACK I've gone ahead and pushed the patch. Wow, that was quick, thanks! Ian. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH LIBVIRT] libxl: Recognise ARM architectures
On Wed, Feb 26, Ian Campbell wrote: On Wed, 2014-02-26 at 12:37 +, Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 12:34:17PM +, Ian Campbell wrote: Currently virsh console fails with: Connected to domain libvirt-test Escape character is ^] error: internal error: cannot find character device null That'll be because no console or serial device is listed in your config above I expect. Also looks like bogus error handling in the console API, not checking for null. Thanks. I've just tried (inside devices.../...): console tty='/dev/pts/5'/ and console type='pty' target port='0'/ /console which I gleaned from http://libvirt.org/drvxen.html but neither seem to do the trick (and the first ones use of an explicit pts looks odd to me...). I learned yesterday this should be serial instead of console, maybe it fixes also your case. Olaf -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: cleanup tap devices on FreeBSD
Daniel P. Berrange wrote: On Mon, Feb 24, 2014 at 11:12:33PM +0400, Roman Bogorodskiy wrote: We have to explicitly destroy TAP devices on FreeBSD because they're not freed after being closed, otherwise we end up with orphaned TAP devices after destroying a domain. --- src/qemu/qemu_process.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ffa939a..9181423 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -61,6 +61,7 @@ #include viruuid.h #include virprocess.h #include virtime.h +#include virnetdevbridge.h #include virnetdevtap.h #include virbitmap.h #include viratomic.h @@ -4381,6 +4382,12 @@ void qemuProcessStop(virQEMUDriverPtr driver, virDomainNetGetActualVirtPortProfile(net), cfg-stateDir)); VIR_FREE(net-ifname); +} else if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_BRIDGE) { +/* On some OSes, e.g. FreeBSD, tap devices are not cleaned up when released, + * so we have to handle that manually */ + ignore_value(virNetDevBridgeRemovePort(virDomainNetGetActualBridgeName(net), + net-ifname)); +ignore_value(virNetDevTapDelete(net-ifname)); } /* release the physical device (or any other resources used by * this interface in the network driver Conceptually ok, but I fear this impl will result in the logs getting polluted with cannot delete tap device or similar log messages on OS where TAP device deletion is automatic. Do you have an idea about better way to do that? Maybe we could create something opposite to virNetDevTapCreateInBridgePort(), e.g. virNetDevTapReleaseInBridgePort() which would destroy tap device on FreeBSD and do nothing on Linux? But that will still require platform specific #ifdef's because checking tap releasing feels like a little out of scope of configure checks. Roman Bogorodskiy pgpC6I7kmbo3c.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: cleanup tap devices on FreeBSD
On 02/26/2014 08:57 AM, Roman Bogorodskiy wrote: Conceptually ok, but I fear this impl will result in the logs getting polluted with cannot delete tap device or similar log messages on OS where TAP device deletion is automatic. Do you have an idea about better way to do that? Maybe add a boolean parameter that says whether the function should be quiet to avoid log noise, where the default is noisy but this cleanup path is quiet. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: cleanup tap devices on FreeBSD
On Wed, Feb 26, 2014 at 09:12:11AM -0700, Eric Blake wrote: On 02/26/2014 08:57 AM, Roman Bogorodskiy wrote: Conceptually ok, but I fear this impl will result in the logs getting polluted with cannot delete tap device or similar log messages on OS where TAP device deletion is automatic. Do you have an idea about better way to do that? Maybe add a boolean parameter that says whether the function should be quiet to avoid log noise, where the default is noisy but this cleanup path is quiet. Or just make it #ifdef BSD, or call virNetDevExists() to check it ? Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: Enable 'host-passthrough' cpu mode for arm
This patch allows libvirt user to specify 'host-passthrough' cpu mode while using qemu/kvm backend on arm (arm32). It uses 'host' as a CPU model name instead of some other stub (correct CPU detection is not implemented yet) to allow libvirt user to specify 'host-model' cpu mode as well. Signed-off-by: Oleg Strikov oleg.stri...@canonical.com --- This is a port of the following aarch64-specific change: http://libvirt.org/git/?p=libvirt.git;a=commit;h=29ea437e408e441bad67e4ffae731286d356ca4a Only function names were changed. --- src/cpu/cpu_arm.c | 30 ++ 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 1853810..5baff42 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -26,6 +26,7 @@ #include viralloc.h #include cpu.h +#include virstring.h #define VIR_FROM_THIS VIR_FROM_CPU @@ -45,16 +46,19 @@ ArmNodeData(virArch arch) } static int -ArmDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, +ArmDecode(virCPUDefPtr cpu, const virCPUData *data ATTRIBUTE_UNUSED, const char **models ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED, const char *preferred ATTRIBUTE_UNUSED, unsigned int flags) { - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1); +if (cpu-model == NULL +VIR_STRDUP(cpu-model, host) 0) +return -1; + return 0; } @@ -64,6 +68,24 @@ ArmDataFree(virCPUDataPtr data) VIR_FREE(data); } +static int +ArmUpdate(virCPUDefPtr guest, + const virCPUDef *host) +{ +guest-match = VIR_CPU_MATCH_EXACT; +virCPUDefFreeModel(guest); +return virCPUDefCopyModel(guest, host, true); +} + +static virCPUCompareResult +ArmGuestData(virCPUDefPtr host ATTRIBUTE_UNUSED, + virCPUDefPtr guest ATTRIBUTE_UNUSED, + virCPUDataPtr *data ATTRIBUTE_UNUSED, + char **message ATTRIBUTE_UNUSED) +{ +return VIR_CPU_COMPARE_IDENTICAL; +} + struct cpuArchDriver cpuDriverArm = { .name = arm, .arch = archs, @@ -73,8 +95,8 @@ struct cpuArchDriver cpuDriverArm = { .encode = NULL, .free = ArmDataFree, .nodeData = ArmNodeData, -.guestData = NULL, +.guestData = ArmGuestData, .baseline = NULL, -.update = NULL, +.update = ArmUpdate, .hasFeature = NULL, }; -- 1.7.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] Add virusbtest
Test src/util/virusb.c. Ján Tomko (2): Add tests for virUSBDeviceFind functions Add a test for virUSBDeviceList functions .gitignore | 1 + cfg.mk | 3 +- tests/Makefile.am | 12 + tests/virusbtest.c | 343 + .../sys_bus_usb/devices/1-1.5.3.1/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.1/idProduct| 1 + .../sys_bus_usb/devices/1-1.5.3.1/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3.1/serial | 1 + .../sys_bus_usb/devices/1-1.5.3.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.3/idProduct| 1 + .../sys_bus_usb/devices/1-1.5.3.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3.3/serial | 1 + .../sys_bus_usb/devices/1-1.5.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3/serial | 1 + .../sys_bus_usb/devices/1-1.5.4/devnum | 1 + .../sys_bus_usb/devices/1-1.5.4/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.4/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.4/serial | 1 + .../sys_bus_usb/devices/1-1.5.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5.5/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.5/serial | 1 + .../sys_bus_usb/devices/1-1.5.6/devnum | 1 + .../sys_bus_usb/devices/1-1.5.6/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.6/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.6/serial | 1 + .../sys_bus_usb/devices/1-1.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5/idProduct| 1 + .../sys_bus_usb/devices/1-1.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.5/serial | 1 + .../sys_bus_usb/devices/1-1.6/devnum | 1 + .../sys_bus_usb/devices/1-1.6/idProduct| 1 + .../sys_bus_usb/devices/1-1.6/idVendor | 1 + .../sys_bus_usb/devices/1-1.6/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/1-1/devnum | 1 + .../sys_bus_usb/devices/1-1/idProduct | 1 + .../sys_bus_usb/devices/1-1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/1-1/serial | 1 + .../sys_bus_usb/devices/2-1.2/devnum | 1 + .../sys_bus_usb/devices/2-1.2/idProduct| 1 + .../sys_bus_usb/devices/2-1.2/idVendor | 1 + .../sys_bus_usb/devices/2-1.2/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/2-1/devnum | 1 + .../sys_bus_usb/devices/2-1/idProduct | 1 + .../sys_bus_usb/devices/2-1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/2-1/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb1/devnum | 1 + .../sys_bus_usb/devices/usb1/idProduct | 1 + .../sys_bus_usb/devices/usb1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb1/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb2/devnum | 1 + .../sys_bus_usb/devices/usb2/idProduct | 1 + .../sys_bus_usb/devices/usb2/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb2/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb3/devnum | 1 + .../sys_bus_usb/devices/usb3/idProduct | 1 + .../sys_bus_usb/devices/usb3/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb3/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb4/devnum | 1 + .../sys_bus_usb/devices/usb4/idProduct | 1 + .../sys_bus_usb/devices/usb4/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb4/serial | 1 + 64 files changed, 418 insertions(+), 1 deletion(-) create mode 100644 tests/virusbtest.c create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/serial create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/serial create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor create mode 100644
[libvirt] [PATCH 1/2] Add tests for virUSBDeviceFind functions
Mock the /sys/bus/usb directory and test the finding (and not finding) of some USB devices. --- .gitignore | 1 + cfg.mk | 3 +- tests/Makefile.am | 12 + tests/virusbtest.c | 268 + .../sys_bus_usb/devices/1-1.5.3.1/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.1/idProduct| 1 + .../sys_bus_usb/devices/1-1.5.3.1/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3.1/serial | 1 + .../sys_bus_usb/devices/1-1.5.3.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.3/idProduct| 1 + .../sys_bus_usb/devices/1-1.5.3.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3.3/serial | 1 + .../sys_bus_usb/devices/1-1.5.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3/serial | 1 + .../sys_bus_usb/devices/1-1.5.4/devnum | 1 + .../sys_bus_usb/devices/1-1.5.4/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.4/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.4/serial | 1 + .../sys_bus_usb/devices/1-1.5.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5.5/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.5/serial | 1 + .../sys_bus_usb/devices/1-1.5.6/devnum | 1 + .../sys_bus_usb/devices/1-1.5.6/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.6/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.6/serial | 1 + .../sys_bus_usb/devices/1-1.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5/idProduct| 1 + .../sys_bus_usb/devices/1-1.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.5/serial | 1 + .../sys_bus_usb/devices/1-1.6/devnum | 1 + .../sys_bus_usb/devices/1-1.6/idProduct| 1 + .../sys_bus_usb/devices/1-1.6/idVendor | 1 + .../sys_bus_usb/devices/1-1.6/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/1-1/devnum | 1 + .../sys_bus_usb/devices/1-1/idProduct | 1 + .../sys_bus_usb/devices/1-1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/1-1/serial | 1 + .../sys_bus_usb/devices/2-1.2/devnum | 1 + .../sys_bus_usb/devices/2-1.2/idProduct| 1 + .../sys_bus_usb/devices/2-1.2/idVendor | 1 + .../sys_bus_usb/devices/2-1.2/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/2-1/devnum | 1 + .../sys_bus_usb/devices/2-1/idProduct | 1 + .../sys_bus_usb/devices/2-1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/2-1/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb1/devnum | 1 + .../sys_bus_usb/devices/usb1/idProduct | 1 + .../sys_bus_usb/devices/usb1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb1/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb2/devnum | 1 + .../sys_bus_usb/devices/usb2/idProduct | 1 + .../sys_bus_usb/devices/usb2/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb2/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb3/devnum | 1 + .../sys_bus_usb/devices/usb3/idProduct | 1 + .../sys_bus_usb/devices/usb3/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb3/serial | 1 + .../virusbtestdata/sys_bus_usb/devices/usb4/devnum | 1 + .../sys_bus_usb/devices/usb4/idProduct | 1 + .../sys_bus_usb/devices/usb4/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb4/serial | 1 + 64 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 tests/virusbtest.c create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/serial create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/serial create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/serial create
[libvirt] [PATCH 2/2] Add a test for virUSBDeviceList functions
Most of them are already tested in a limited way by testing virUSBDeviceFind. --- tests/virusbtest.c | 75 ++ 1 file changed, 75 insertions(+) diff --git a/tests/virusbtest.c b/tests/virusbtest.c index f9104bf..74b9a5e 100644 --- a/tests/virusbtest.c +++ b/tests/virusbtest.c @@ -204,6 +204,78 @@ cleanup: static int +testUSBList(const void *opaque ATTRIBUTE_UNUSED) +{ +virUSBDeviceListPtr list = NULL; +virUSBDeviceListPtr devlist = NULL; +virUSBDevicePtr dev = NULL; +int ret = -1; +size_t i, ndevs; + +if (!(list = virUSBDeviceListNew())) +goto cleanup; + +if (virUSBDeviceFindByVendor(0x1d6b, 0x0002, NULL, true, devlist) 0) +goto cleanup; + +ndevs = virUSBDeviceListCount(devlist); +for (i = 0; i ndevs; i++) { +dev = virUSBDeviceListGet(devlist, 0); +dev = virUSBDeviceListSteal(devlist, dev); + +if (virUSBDeviceListAdd(list, dev) 0) +goto cleanup; +dev = NULL; +} + +virObjectUnref(devlist); +devlist = NULL; + +if (virUSBDeviceFindByVendor(0x18d1, 0x4e22, NULL, true, devlist) 0) +goto cleanup; + +ndevs = virUSBDeviceListCount(devlist); +for (i = 0; i ndevs; i++) { +dev = virUSBDeviceListGet(devlist, 0); +dev = virUSBDeviceListSteal(devlist, dev); + +if (virUSBDeviceListAdd(list, dev) 0) +goto cleanup; +dev = NULL; +} + +if (virUSBDeviceFind(0x18d1, 0x4e22, 1, 20, NULL, true, dev) 0) +goto cleanup; + +if (!virUSBDeviceListFind(list, dev)) { +virReportError(VIR_ERR_INTERNAL_ERROR, + Device '%s' not in list when it should be, + virUSBDeviceGetName(dev)); +goto cleanup; +} + +virUSBDeviceListDel(list, dev); +dev = NULL; + +if (virUSBDeviceListCount(list) != 5) { +virReportError(VIR_ERR_INTERNAL_ERROR, + Wrong device count %zu expected %d, + virUSBDeviceListCount(list), + 5); +goto cleanup; +} + +ret = 0; + +cleanup: +virObjectUnref(list); +virObjectUnref(devlist); +virUSBDeviceFree(dev); +return ret; +} + + +static int mymain(void) { int rv = 0; @@ -251,6 +323,9 @@ mymain(void) DO_TEST_FIND_BY_VENDOR_FAIL(Bogus vendor and product, 0xf00d, 0xbeef); DO_TEST_FIND_BY_VENDOR_FAIL(Valid vendor, 0x1d6b, 0xbeef); +if (virtTestRun(USB List test, testUSBList, NULL) 0) +rv = -1; + if (rv 0) return EXIT_FAILURE; return EXIT_SUCCESS; -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [lxc-devel] capset fails with userns
Quoting Stephan Sachse (ste.sac...@gmail.com): Look at security/commoncap.c:cap_inode_setxattr() Whereas file ownership is properly namespaced, and task capabilities are properly namespaced, file capabilities are more problematic. To support this, I think we'd need a new capability xattr format. If we add the kuid_t of the user_namespace root id, I think we could safely support this. sorry for this :) but i'm not a kernel/c programmer. No no, thanks for raising the issue, and thanks for having sent a patch! maybe there must be more then one cap set per file. security.capability for the init_ns security.capability.{kuid_t} for the userns the name of the xattr must be transparently mapped. in userns for get*() if there is no security.capability.{kuid_t} use the security.capability. but never write to security.capability always to security.capability.{kuid_t} or the format of security.capability must be changed to support more then one set of caps. every capability set must be associated with a kuid_t. To avoid impacting the performance of the host case, we could keep the current XATTR_NAME_CAPS format in init_user_ns, and add a new XATTR_NAME_CAPS_V2 which adds the kuid_t. back to line one of my mail: i'm not a kernel/c programmer :'( This frankly looks like fun, but I won't have time to work on this this week. If anyone else does, I'll happily look at the patches. thanks, -serge -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: cleanup tap devices on FreeBSD
Daniel P. Berrange wrote: On Wed, Feb 26, 2014 at 09:12:11AM -0700, Eric Blake wrote: On 02/26/2014 08:57 AM, Roman Bogorodskiy wrote: Conceptually ok, but I fear this impl will result in the logs getting polluted with cannot delete tap device or similar log messages on OS where TAP device deletion is automatic. Do you have an idea about better way to do that? Maybe add a boolean parameter that says whether the function should be quiet to avoid log noise, where the default is noisy but this cleanup path is quiet. Or just make it #ifdef BSD, or call virNetDevExists() to check it ? I think I came to an #idef based idea which looks more or less easy to follow: - in virnetdevtap.h, define something like VIR_TAP_NEEDS_MANUAL_CLEANUP on certain OSes (i.e. FreeBSD only at this point) - Use it in qemu_process.c (that should be a little more readable than #ifdef __FreeBSD__) Roman Bogorodskiy pgptiRQ9cJ_ql.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix minor typo (unkown)
Hi, Sorry for not using git mailing capabilities (my mail service does not work well with git). Thanks for reviewing this patch. Best regards, Yuri 0001-Fix-typo-unkown-unknown.patch Description: Binary data -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix minor typo (unkown)
On 02/26/2014 10:06 AM, Yuri Chornoivan wrote: Hi, Sorry for not using git mailing capabilities (my mail service does not work well with git). Thanks for reviewing this patch. ACK and pushed. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: ignore cygwin toolchain droppings
The cygwin compiler automatically creates a '*.exe.manifest' companion file for any .exe file that contains a substring that would otherwise cause newer Windows to pester users about needing admin rights (such as update, instal, setup...). This means that compilation on cygwin left behind tests/networkxml2xmlupdatetest.exe.manifest. * .gitignore: Ignore manifest files. Signed-off-by: Eric Blake ebl...@redhat.com --- Pushing under the trivial rule. .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 69c81df..1b063e1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.a *.cov *.exe +*.exe.manifest *.gcda *.gcno *.gcov -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: skip virportallocatortest on cygwin
Cygwin supports dlfcn.h and even has limited LD_PRELOAD capabilities; but because it does not use ELF binaries it cannot support RTLD_NEXT lookups. CC libvirportallocatormock_la-virportallocatortest.lo virportallocatortest.c: In function 'init_syms': virportallocatortest.c:47:24: error: 'RTLD_NEXT' undeclared (first use in this function) realsocket = dlsym(RTLD_NEXT, socket); * tests/virportallocatortest.c: Also require RTLD_NEXT. Signed-off-by: Eric Blake ebl...@redhat.com --- Pushing under the build-breaker rule. tests/virportallocatortest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c index 34843e3..5a93dad 100644 --- a/tests/virportallocatortest.c +++ b/tests/virportallocatortest.c @@ -23,7 +23,7 @@ #include virfile.h #include testutils.h -#if HAVE_DLFCN_H +#if HAVE_DLFCN_H defined(RTLD_NEXT) # ifdef MOCK_HELPER # include internal.h -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/4] qemu: export disk snapshot capability
On 02/19/2014 01:09 AM, Francesco Romani wrote: - Original Message - This patch series extend the QEMU capabilities XML to report if the underlying QEMU binary supports, or not, the live disk snapshotting. Could please someone take a look and review this? Any comment would be really appreciated! ping Apologies for the delay. This series was submitted before the freeze, so I hope it's low enough risk to commit into 1.2.2 if the review goes well. I'm doing the review now... -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] qemu: export disk snapshot support in capabilities
On 01/17/2014 08:31 AM, Francesco Romani wrote: This patch add an element to QEMU's capability XML, to s/add/adds/ show if the underlying QEMU binary supports the live disk snapshotting or not. This allow any client to know ahead of time if the feature s/allow/allows/ is available. Without this information available, the only way to check for the snapshot support is to request one and check for errors. Signed-off-by: Francesco Romani from...@redhat.com --- docs/schemas/capability.rng | 6 ++ src/qemu/qemu_capabilities.c | 7 +++ 2 files changed, 13 insertions(+) It would probably also be good to test this in tests/capabilityschemadata/, but maybe that happens later in the series... /optional +optional + element name='disksnapshot' Existing capabilities have an interesting mix of spelling: underscores: os_type, squashed: baselabel, camelCase: machine maxCpus=''. I would have problaby picked disk-snapshot if I were writing it without knowledge of pre-existing code, but don't see any examples of that. So, your naming is probably as good as any. +++ b/src/qemu/qemu_capabilities.c @@ -687,6 +687,7 @@ virQEMUCapsInitGuest(virCapsPtr caps, virQEMUCapsPtr qemubinCaps = NULL; virQEMUCapsPtr kvmbinCaps = NULL; int ret = -1; +bool hasdisksnapshot = false; /* Check for existence of base emulator, or alternate base * which can be used with magic cpu choice @@ -774,6 +775,12 @@ virQEMUCapsInitGuest(virCapsPtr caps, !virCapabilitiesAddGuestFeature(guest, deviceboot, 1, 0)) That, and you were copying from 'deviceboot' which also uses squashed style. goto error; +if (virQEMUCapsGet(qemubinCaps, QEMU_CAPS_DISK_SNAPSHOT)) +hasdisksnapshot = true; + +if (!virCapabilitiesAddGuestFeature(guest, disksnapshot, hasdisksnapshot, 0)) +goto error; I probably would have skipped the temporary variable, but then hit longer line length: if (!virCapabilitiesAddGuestFeature(guest, disksnapshot, virQEMUCapsGet(qemubinCaps, QEMU_CAPS_DISK_SNAPSHOT)), 0)) goto error; so your way is fine as-is. Preliminary ACK, assuming the rest of the series covers testing and documentation (and as you said in the cover letter, existing docs are a bit sparse). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/4] qemu: export disk snapshot capability
On 01/17/2014 08:31 AM, Francesco Romani wrote: This patch series extend the QEMU capabilities XML to report if the underlying QEMU binary supports, or not, the live disk snapshotting. Without this patch series, the only way to know if QEMU has this support is to actually request a disk snapshot and to see what happens. The change is split in four patches: * patch #1 actually adds the new element in the QEMU capabilities XML. formatcaps.html.in wasn't very detailed about the actual XML format, so I've not updated it. Anyone feel free to point out what should be added, and I'll comply. The new element has the form disksnapshot default='value' toggle='off' because I'd like to convey two informations: - disk snapshot is supposed to be here, and it is (default='on') - disk snapshot is supposed to be here, and is NOT (default='off') Put in a different way, I tried to help the client as much as possible. I'm not particolary fond of this format, and I'm really open to alternatives here. Perhaps a simpler disksnapshot/ element can convey the same meaning? Suggestions welcome. Using merely disksnapshot/ is too terse - that element can only appear when qemu is new enough, but if it is absent, you don't know whether libvirt is new enough to tell you status but qemu is too old, or whether libvirt is too old to tell you status. The toggle='off' attribute is a bit much, but your choice of XML is at least consistent with other features (that is, seeing the disksnapshot element tells the client that this libvirt is new enough to support telling you the capability via the 'default=' attribute; where a missing disksnapshot is a sign of an older libvirt where you have to just try the command. The toggle='off' is a bit overkill, since it is not an option that can change state over the life of qemu or via any choice in the domain XML, but it is at least consistent with other feature capabilities, so a client can write a generic parser that handles all sorts of features, even the ones with toggle='yes' that can be overridden on a per-domain basis). * patches #2, #3 Are trivial and they provide the ground for the last patch which add a new unit tests. They are just dependencies for it. I tried to make them less invasive as possible. * patch #4 add a new unit test, aiming to test not only this new feature but also the whole XML capabilities test. I was under the impression that this kind of test do not really fit into existing one, so I added a new one. Suggestions about possible improvements for this test are welcome Thanks for adding tests as part of your submission, and again I apologize that no one has reviewed this for so long. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] qemu: add function to fill capabilities cache
On 01/17/2014 08:31 AM, Francesco Romani wrote: extract and export the code to add the capabilities for a given QEMU binary in the capabilities cache. The intended use case is for testing, and make writing more test easier. --- src/qemu/qemu_capabilities.c | 31 +-- src/qemu/qemu_capabilities.h | 2 ++ 2 files changed, 27 insertions(+), 6 deletions(-) Looks like a clean refactor; I'll see how it gets used later, but for this patch: ACK -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Libvirt Java Bindings - adding domain event support - pull request
Hi all I'm new to this list, I've been making use of the Libvirt Java bindings recently. I wanted to make use of domain events yesterday so my application can be alerted when the state of a domain changes etc. However I quickly discovered that domain events are completely broken in the current Java bindings. Whilst some of the Libvirt functions required to support domain events are exposed, the critical underpinnings are not. Specifically there is no support for setting up the event loop. So I have implemented support for domain events in the Java bindings. Currently I've only implemented the following domain event IDs: * VIR_DOMAIN_EVENT_ID_LIFECYCLE * VIR_DOMAIN_EVENT_ID_REBOOT * VIR_DOMAIN_EVENT_ID_RTC_CHANGE Implementing these is enough to test that my implementation is sane, I'm hoping to implement the majority of the other events soon. Events can be listened to by, registering via the Connect object, as follows: con.domainEventRegisterAny(DomainEventID.VIR_DOMAIN_EVENT_ID_LIFECYCLE, new DomainLifecycleEventHandler() { @Override public void onStarted(Connect connection, Domain domain, DomainEventType event, DomainEventStartedDetailType detail) throws LibvirtException { System.out.println(Got start event: + event + :: + detail + for domain + domain.getName()); } }); I've put my clone of the libvirt-java git repository on Github, my modifications to the Java binding are in a separate branch and should be simple to merge. The changes can be viewed at: https://github.com/intrbiz/libvirt-java/compare/master...ce-domain-events I'm keen to get these enhancements / fixes merged into libvirt-java. I would also like to submit further fixes to race conditions in the free() handling. Any advice / thoughts / comments welcome. Regards, Chris Ellis -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] qemu: export the virQEMUCapsInitGuest function.
On 01/17/2014 08:31 AM, Francesco Romani wrote: make the function public. the function is useful to XML capabilities unit test. --- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_capabilities.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) ACK. +++ b/src/qemu/qemu_capabilities.h @@ -269,6 +269,8 @@ virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virQEMUCapsCachePtr cache, void virQEMUCapsCacheFree(virQEMUCapsCachePtr cache); virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache); +int virQEMUCapsInitGuest(virCapsPtr caps, virQEMUCapsCachePtr cache, + virArch hostarch, virArch guestarch); Spurious double space. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 1/4] add new virDomainMemoryDump API
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is adding new virDomainMemoryDump API, so that the format in which qemu dump domain's memory can be specified. Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com_ --- include/libvirt/libvirt.h.in | 21 ++ src/access/viraccessperm.c | 2 +- src/access/viraccessperm.h | 6 +++ src/driver.h | 7 src/libvirt.c| 95 src/libvirt_public.syms | 5 +++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++- src/remote_protocol-structs | 7 src/test/test_driver.c | 17 +++- 10 files changed, 172 insertions(+), 4 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..ab6efca 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1180,6 +1180,19 @@ typedef enum { VIR_DUMP_MEMORY_ONLY = (1 4), /* use dump-guest-memory */ } virDomainCoreDumpFlags; +/* Domain memory dump's format */ +typedef enum { +VIR_MEMORY_DUMP_COMPRESS_ZLIB = 1, /* dump guest memory in +kdump-compressed format, with +zlib-compressed */ +VIR_MEMORY_DUMP_COMPRESS_LZO= 2, /* dump guest memory in +kdump-compressed format, with +lzo-compressed */ +VIR_MEMORY_DUMP_COMPRESS_SNAPPY = 3, /* dump guest memory in +kdump-compressed format, with +snappy-compressed */ +} virMemoryDumpFormat; + /* Domain migration flags. */ typedef enum { VIR_MIGRATE_LIVE = (1 0), /* live migration */ @@ -1731,6 +1744,14 @@ int virDomainCoreDump (virDomainPtr domain, unsigned int flags); /* + * Domain core dump + */ +int virDomainMemoryDump (virDomainPtr domain, + const char *to, + unsigned int flags, + unsigned int dumpformat); + +/* * Screenshot of current domain console */ char * virDomainScreenshot (virDomainPtr domain, diff --git a/src/access/viraccessperm.c b/src/access/viraccessperm.c index d517c66..af4f05e 100644 --- a/src/access/viraccessperm.c +++ b/src/access/viraccessperm.c @@ -42,7 +42,7 @@ VIR_ENUM_IMPL(virAccessPermDomain, init_control, inject_nmi, send_input, send_signal, fs_trim, block_read, block_write, mem_read, open_graphics, open_device, screenshot, - open_namespace); + open_namespace, memory_dump); VIR_ENUM_IMPL(virAccessPermInterface, VIR_ACCESS_PERM_INTERFACE_LAST, diff --git a/src/access/viraccessperm.h b/src/access/viraccessperm.h index 6d14f05..2537fbf 100644 --- a/src/access/viraccessperm.h +++ b/src/access/viraccessperm.h @@ -205,6 +205,12 @@ typedef enum { VIR_ACCESS_PERM_DOMAIN_CORE_DUMP, /* Dump guest core */ /** + * @desc: Dump domain's memory only + * @message: Dumping domain's memory requires authorization + */ +VIR_ACCESS_PERM_DOMAIN_MEMORY_DUMP, /* Dump guest's memory only */ + +/** * @desc: Use domain power management * @message: Using domain power management requires authoriation */ diff --git a/src/driver.h b/src/driver.h index fbfaac4..7c001e6 100644 --- a/src/driver.h +++ b/src/driver.h @@ -306,6 +306,12 @@ typedef int const char *to, unsigned int flags); +typedef int +(*virDrvDomainMemoryDump)(virDomainPtr domain, + const char *to, + unsigned int flags, + unsigned int dumpformat); + typedef char * (*virDrvDomainScreenshot)(virDomainPtr domain, virStreamPtr stream, @@ -1200,6 +1206,7 @@ struct _virDriver { virDrvDomainSaveImageGetXMLDesc domainSaveImageGetXMLDesc; virDrvDomainSaveImageDefineXML domainSaveImageDefineXML; virDrvDomainCoreDump domainCoreDump; +virDrvDomainMemoryDump domainMemoryDump; virDrvDomainScreenshot domainScreenshot; virDrvDomainSetVcpus domainSetVcpus; virDrvDomainSetVcpusFlags domainSetVcpusFlags; diff --git a/src/libvirt.c b/src/libvirt.c index dcf6b53..ec106a6 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2999,6 +2999,101 @@ error: return -1; } +/** + * virDomainMemoryDump: + * @domain: a domain object + * @to: path for the core file + * @flags: bitwise-OR of virDomainCoreDumpFlags + *
[libvirt] [PATCH v3 3/4] allow virsh dump --memory-only specify dump format
This patch is used to add --compress and [--compression-format] string to virsh dump --memory-only. And virsh dump --memory-only is going be implemented by new virDomainMemoryDump API. Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com --- tools/virsh-domain.c | 55 ++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..14ef612 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_(dump domain's memory only) }, +{.name = compress, + .type = VSH_OT_BOOL, + .help = N_(make qemu dump domain's memory in kdump-compressed format) +}, +{.name = compression-format, + .type = VSH_OT_DATA, + .help = N_(specify the compression format of kdump-compressed format) +}, {.name = NULL} }; @@ -4501,6 +4509,9 @@ doDump(void *opaque) const char *name = NULL; const char *to = NULL; unsigned int flags = 0; +bool optCompress; +const char *compression_format = NULL; +unsigned int memory_dump_format = 0; sigemptyset(sigmask); sigaddset(sigmask, SIGINT); @@ -4524,11 +4535,51 @@ doDump(void *opaque) if (vshCommandOptBool(cmd, memory-only)) flags |= VIR_DUMP_MEMORY_ONLY; -if (virDomainCoreDump(dom, to, flags) 0) { -vshError(ctl, _(Failed to core dump domain %s to %s), name, to); +optCompress = vshCommandOptBool(cmd, compress); +if (optCompress !(flags VIR_DUMP_MEMORY_ONLY)) { +vshError(ctl, %s, + _(compress flag cannot be set without memory-only flag)); goto out; } +if (vshCommandOptString(cmd, compression-format, compression_format)) { +if (!optCompress) { +vshError(ctl, %s, + _(compression-format cannot be set without compress + flag)); +goto out; +} + +if (STREQ(compression_format, zlib)) +memory_dump_format = VIR_MEMORY_DUMP_COMPRESS_ZLIB; +else if (STREQ(compression_format, lzo)) +memory_dump_format = VIR_MEMORY_DUMP_COMPRESS_LZO; +else if (STREQ(compression_format, snappy)) +memory_dump_format = VIR_MEMORY_DUMP_COMPRESS_SNAPPY; +else { +vshError(ctl, _(compression format '%s' is not supported, +expecting 'zlib', 'lzo' or 'snappy'.), + compression_format); +goto out; +} +} else { +if (optCompress) +memory_dump_format = VIR_MEMORY_DUMP_COMPRESS_ZLIB; +} + +if (flags VIR_DUMP_MEMORY_ONLY) { +if (virDomainMemoryDump(dom, to, flags, memory_dump_format) 0) { +vshError(ctl, _(Failed to dump the memory of domain %s to %s), + name, to); +goto out; +} +} else { +if (virDomainCoreDump(dom, to, flags) 0) { +vshError(ctl, _(Failed to core dump domain %s to %s), name, to); +goto out; +} +} + ret = '0'; out: pthread_sigmask(SIG_SETMASK, oldsigmask, NULL); -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list