[libvirt] [libvirt-test-API][PATCH] Add connection_getDomainCapabilities test case
In the case, we will validate getDomainCapabilities API for libvirt. jiahu (1): Add connection_getDomainCapabilities test case cases/test_connection.conf| 10 + repos/virconn/connection_getDomainCapabilities.py | 438 ++ 2 files changed, 448 insertions(+) create mode 100644 repos/virconn/connection_getDomainCapabilities.py -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/7] gendispatch: remove IOThreads from name fixups
On Wed, Mar 25, 2015 at 19:39:09 +0100, Ján Tomko wrote: No more APIs have IOThreads in their name now. --- src/rpc/gendispatch.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index aa73d0c..b642d6e 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -67,7 +67,6 @@ sub fixup_name { $name =~ s/Fsfreeze$/FSFreeze/; $name =~ s/Fsthaw$/FSThaw/; $name =~ s/Fsinfo$/FSInfo/; -$name =~ s/Iothreads$/IOThreads/; $name =~ s/Iothread$/IOThread/; $name =~ s/Scsi/SCSI/; $name =~ s/Wwn$/WWN/; Squash this to the previous patch. ACK Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 5/7] virsh: rename iothreadsinfo to iothreadinfo
On 03/25/2015 02:39 PM, Ján Tomko wrote: The plural seems unnecessary. --- tools/virsh-domain.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c8e0233..afd92b1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6792,7 +6792,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) /* * iothreadsinfo command ^^^ And this */ -static const vshCmdInfo info_iothreads[] = { +static const vshCmdInfo info_iothreadinfo[] = { {.name = help, .data = N_(view domain IOThreads) }, @@ -6801,7 +6801,7 @@ static const vshCmdInfo info_iothreads[] = { }, {.name = NULL} }; -static const vshCmdOptDef opts_iothreads[] = { +static const vshCmdOptDef opts_iothreadinfo[] = { {.name = domain, .type = VSH_OT_DATA, .flags = VSH_OFLAG_REQ, @@ -6823,7 +6823,7 @@ static const vshCmdOptDef opts_iothreads[] = { }; static bool -cmdIOThreadsInfo(vshControl *ctl, const vshCmd *cmd) +cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) { virDomainPtr dom; bool config = vshCommandOptBool(cmd, config); @@ -12891,10 +12891,10 @@ const vshCmdDef domManagementCmds[] = { .info = info_inject_nmi, .flags = 0 }, -{.name = iothreadsinfo, - .handler = cmdIOThreadsInfo, - .opts = opts_iothreads, - .info = info_iothreads, +{.name = iothreadinfo, + .handler = cmdIOThreadInfo, + .opts = opts_iothreadinfo, + .info = info_iothreadinfo, .flags = 0 }, {.name = iothreadpin, -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 1/2] cleanup conf/device_conf.h inclusion from util/virnetdev.h
Thanks Jan.. On Thu, Mar 26, 2015 at 12:14 AM, Ján Tomko jto...@redhat.com wrote: On Wed, Mar 25, 2015 at 07:33:41PM +0530, Shivaprasad G Bhat wrote: Move the struct and enum definitions from device_conf.h to virnetdev.h thus avoiding the file inclusion. The wrong reference of conf files from util/ is allowed in Makefile.am for now. The reason being, The change in Makefile.am for libvirt_util_la_CFLAGS to remove conf from the utils would require corresponding inclusion in util files to specify the paths explicitly. This would result in syntax-check failures (prohibit_cross_inclusion) which need to be worked around until there are patches reworking the incorrect inclusion. The syntax-check failure workaround seems dangerous as that might mask some easily resolvable failures. So dont touch the Makefile.am for now. Resolve the wrong inclusions in separate patches. Signed-off-by: Shivaprasad G Bhat sb...@linux.vnet.ibm.com --- src/conf/device_conf.h | 38 +- src/util/virnetdev.h | 38 +- 2 files changed, 38 insertions(+), 38 deletions(-) I like the cleanup, but it fails to build for me: In file included from ./util/virnetdev.h:30:0, from conf/device_conf.h:34, from conf/domain_conf.h:48, from conf/domain_capabilities.h:27, from conf/domain_capabilities.c:25: ./util/virnetlink.h:33:27: fatal error: netlink/msg.h: No such file or directory # include netlink/msg.h ^ compilation terminated. Makefile:7320: recipe for target 'conf/libvirt_conf_la-domain_capabilities.lo' failed It seems a change in the makefile will be necessary if we want to include virnetdev in conf/ It seems, the compilation fails only if the libnl-devel is not installed but libnl3-devel is installed. The /usr/include/netlink/msg.h part of libnl-devel helps the compilation with default include paths. Without that package it fails. Adding LIBNL_CFLAGS to AM_CFLAGS seems to fix it. Let me post the working changes in next version. Regards, Shiva Jan diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 7ea90f6..a650189 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -31,19 +31,7 @@ # include virutil.h # include virthread.h # include virbuffer.h - -typedef enum { -VIR_INTERFACE_STATE_UNKNOWN = 1, -VIR_INTERFACE_STATE_NOT_PRESENT, -VIR_INTERFACE_STATE_DOWN, -VIR_INTERFACE_STATE_LOWER_LAYER_DOWN, -VIR_INTERFACE_STATE_TESTING, -VIR_INTERFACE_STATE_DORMANT, -VIR_INTERFACE_STATE_UP, -VIR_INTERFACE_STATE_LAST -} virInterfaceState; - -VIR_ENUM_DECL(virInterfaceState) +# include virnetdev.h typedef struct _virDevicePCIAddress virDevicePCIAddress; typedef virDevicePCIAddress *virDevicePCIAddressPtr; @@ -55,30 +43,6 @@ struct _virDevicePCIAddress { int multi; /* virTristateSwitch */ }; -typedef struct _virInterfaceLink virInterfaceLink; -typedef virInterfaceLink *virInterfaceLinkPtr; -struct _virInterfaceLink { -virInterfaceState state; /* link state */ -unsigned int speed; /* link speed in Mbits per second */ -}; - -typedef enum { -VIR_NET_DEV_FEAT_GRXCSUM, -VIR_NET_DEV_FEAT_GTXCSUM, -VIR_NET_DEV_FEAT_GSG, -VIR_NET_DEV_FEAT_GTSO, -VIR_NET_DEV_FEAT_GGSO, -VIR_NET_DEV_FEAT_GGRO, -VIR_NET_DEV_FEAT_LRO, -VIR_NET_DEV_FEAT_RXVLAN, -VIR_NET_DEV_FEAT_TXVLAN, -VIR_NET_DEV_FEAT_NTUPLE, -VIR_NET_DEV_FEAT_RXHASH, -VIR_NET_DEV_FEAT_LAST -} virNetDevFeature; - -VIR_ENUM_DECL(virNetDevFeature) - int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr); int virDevicePCIAddressParseXML(xmlNodePtr node, diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index 856127b..8aab96b 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -30,7 +30,6 @@ # include virnetlink.h # include virmacaddr.h # include virpci.h -# include device_conf.h # ifdef HAVE_STRUCT_IFREQ typedef struct ifreq virIfreq; @@ -74,6 +73,43 @@ struct _virNetDevRxFilter { } vlan; }; +typedef enum { +VIR_NET_DEV_FEAT_GRXCSUM, +VIR_NET_DEV_FEAT_GTXCSUM, +VIR_NET_DEV_FEAT_GSG, +VIR_NET_DEV_FEAT_GTSO, +VIR_NET_DEV_FEAT_GGSO, +VIR_NET_DEV_FEAT_GGRO, +VIR_NET_DEV_FEAT_LRO, +VIR_NET_DEV_FEAT_RXVLAN, +VIR_NET_DEV_FEAT_TXVLAN, +VIR_NET_DEV_FEAT_NTUPLE, +VIR_NET_DEV_FEAT_RXHASH, +VIR_NET_DEV_FEAT_LAST +} virNetDevFeature; + +VIR_ENUM_DECL(virNetDevFeature) + +typedef enum { +VIR_INTERFACE_STATE_UNKNOWN = 1, +VIR_INTERFACE_STATE_NOT_PRESENT, +VIR_INTERFACE_STATE_DOWN, +VIR_INTERFACE_STATE_LOWER_LAYER_DOWN, +VIR_INTERFACE_STATE_TESTING, +VIR_INTERFACE_STATE_DORMANT, +VIR_INTERFACE_STATE_UP, +VIR_INTERFACE_STATE_LAST +} virInterfaceState; +
Re: [libvirt] [PATCH 7/7] add cpu time to iothreadinfo
On Wed, Mar 25, 2015 at 19:39:12 +0100, Ján Tomko wrote: Add cpuTime to virDomainIOThreadInfo, fill it out in the qemu driver and print it in virsh. --- daemon/remote.c | 1 + include/libvirt/libvirt-domain.h | 1 + src/qemu/qemu_driver.c | 10 ++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 1 + src/remote_protocol-structs | 1 + tools/virsh-domain.c | 18 ++ 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 2f4df48..1f44ed5 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2317,6 +2317,7 @@ remoteDispatchDomainGetIOThreadInfo(virNetServerPtr server ATTRIBUTE_UNUSED, */ dst-cpumap.cpumap_len = info[i]-cpumaplen; dst-cpumap.cpumap_val = (char *)info[i]-cpumap; +dst-cpu_time = info[i]-cpuTime; info[i]-cpumap = NULL; } } else { diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 7be4219..cca08ca 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1603,6 +1603,7 @@ struct _virDomainIOThreadInfo { unsigned char *cpumap; /* CPU map for thread. A pointer to an */ /* array of real CPUs (in 8-bit bytes) */ int cpumaplen; /* cpumap size */ +unsigned long long cpuTime;/* CPU time used, in nanoseconds */ Perhaps add a note that 0 is returned for offline VMs? }; void virDomainIOThreadInfoFree(virDomainIOThreadInfoPtr info); ... diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cb9cb9d..929cceb 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c ... @@ -6875,12 +6875,22 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, %-15u , info[i]-iothread_id); vshPrint(ctl, %-15s , mapstr); +if (info[i]-cpuTime != 0) { +double cpuUsed = info[i]-cpuTime; + +cpuUsed /= 10.0; + +vshPrint(ctl, %.1lf s , cpuUsed); +} Should we print a dash or something when the data is not present? vshPrint(ctl, \n); -virDomainIOThreadInfoFree(info[i]); } -VIR_FREE(info); cleanup: +if (niothreads 0) { +for (i = 0; i niothreads; i++) +virDomainIOThreadInfoFree(info[i]); +VIR_FREE(info); If you initialize info to NULL when it's defined you can avoid having the if (niothreads 0) condition. +} virBitmapFree(map); virDomainFree(dom); return niothreads = 0; ACK. I'll not insisting on fixing all the comments, but I'd prefer to have a dash in the output if CPU time doesn't make sense. Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-test-API][PATCH] Add connection_getDomainCapabilities test case
This case will test getDomainCapabilities API, and connection_getDomainCapabilities test case was added to test_connection.conf --- cases/test_connection.conf| 10 + repos/virconn/connection_getDomainCapabilities.py | 438 ++ 2 files changed, 448 insertions(+) create mode 100644 repos/virconn/connection_getDomainCapabilities.py diff --git a/cases/test_connection.conf b/cases/test_connection.conf index 7552024..5719937 100644 --- a/cases/test_connection.conf +++ b/cases/test_connection.conf @@ -47,3 +47,13 @@ virconn:free_pages 0 pagesize 4k,2M + +virconn:connection_getDomainCapabilities +emulatorbin +/usr/libexec/qemu-kvm +arch +x86_64 +machine +pc-i440fx-rhel7.0.0 +virttype +kvm diff --git a/repos/virconn/connection_getDomainCapabilities.py b/repos/virconn/connection_getDomainCapabilities.py new file mode 100644 index 000..f0cfa1f --- /dev/null +++ b/repos/virconn/connection_getDomainCapabilities.py @@ -0,0 +1,438 @@ +#!/usr/bin/env python +# test getDomainCapabilities() API for libvirtd + +import os +import libvirt +import hashlib +import fcntl + +from xml.dom import minidom +from libvirt import libvirtError +from src import sharedmod +from utils import utils + +required_params = ('emulatorbin','arch','machine','virttype',) +optional_params = {} + +QEMU_CAPS = +API_FILE = /tmp/caps_from_api.xml +CMD = rm -rf %s +OVMF = /usr/share/OVMF/OVMF_CODE.fd +IOMMU = /sys/kernel/iommu_groups/ +VFIO = /dev/vfio/vfio +KVM = /dev/kvm +KVM_CHECK_EXTENSION = 44547 +KVM_CAP_IOMMU = 18 +maxcpu = 0 + +ovmf_f = False +drive = False +drive_forma = False +drive_readonly = False +blk_sg_io = False +usb_storage = False +device = False +scsi_generic = False +vfio_pci = False + +def clean_env(logger): + + clean testing environment + +status, output = utils.exec_cmd(CMD % API_FILE, shell=True) +if status != 0: +logger.error(Can not delete %s % API_FILE) +else: +logger.debug(Deleted %s successfully % API_FILE) + +def get_hypervisor_ver(emulatorbin,logger): + + Obtain qemu-kvm's version, and return a number value of version + +RPM = rpm -qf %s +status, package = utils.exec_cmd(RPM % emulatorbin, shell=True) +if not status: +logger.debug(The package is %s % package) +else: +logger.debug(The package is %s % package) +return 0 +package = package[0].split('-') +version = +for item in package: +if not item.isalnum(): +for v in item.split(.): +version = version + v.rjust(3,0) +break +return int(version) + +def validate_caps_from_hv(emulatorbin,logger): + +Validate the relative caps between libvirt and qemu-kvm + +F1 = %s -h| grep \\-drive\ +F2 = %s -h| grep \format=\ +F3 = %s -h| grep \readonly=\ +F4 = %s -h| grep \^\\-device\ +l = [F1,F2,F3,F4] +flags = [] +for item in l: +status, temp = utils.exec_cmd(item % emulatorbin, shell=True) +if not status: +flags.append(True) +logger.debug(Got: %s from vh % temp) +else: +flags.append(False) +logger.debug(Got: %s from vh % temp) +if get_hypervisor_ver(emulatorbin,logger) = 11000: + flags.append(True) +else: + flags.append(False) +libvirt_f = [drive,drive_forma,drive_readonly,device,blk_sg_io] +if flags == libvirt_f: +return True +else: +return False + +def generate_hash(emulatorbin,logger): + + generate file name using sha256 + +global QEMU_CAPS +QEMU_CAPS = /var/cache/libvirt/qemu/capabilities/ +file_name = hashlib.sha256(emulatorbin).hexdigest() +QEMU_CAPS = QEMU_CAPS + file_name + .xml +logger.debug(Cache file is %s % QEMU_CAPS) + +def get_maxcpu(machine,logger): + + return maxcpu for given machine type from QEMU_CAPS xml + +global maxcpu +xml = minidom.parse(QEMU_CAPS) +qemu = xml.getElementsByTagName('qemuCaps')[0] +for item in qemu.getElementsByTagName('machine'): +if item.getAttribute('name') == machine: +maxcpu = int(item.getAttribute('maxCpus')) +return True + +def get_os_flags(logger): + + Read results from QEMU_CAPS file and set three flags + +global drive, drive_forma, drive_readonly +xml = minidom.parse(QEMU_CAPS) +qemu = xml.getElementsByTagName('qemuCaps')[0] +for item in qemu.getElementsByTagName('flag'): +if item.getAttribute('name') == drive: +drive = True +if item.getAttribute('name') == drive-format: +drive_forma = True +if item.getAttribute('name') == drive-readonly: +drive_readonly = True +logger.debug(drive = %s; drive_format = %s; drive_readonly = %s\ +% (drive,drive_forma,drive_readonly)) +return True + +def
Re: [libvirt] [PATCH 5/7] virsh: rename iothreadsinfo to iothreadinfo
On Wed, Mar 25, 2015 at 17:22:26 -0400, John Ferlan wrote: On 03/25/2015 02:39 PM, Ján Tomko wrote: The plural seems unnecessary. --- tools/virsh-domain.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) You would need to adjust virsh.pod too. ACK if you fix this ^^ Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: fix cannot start a vm with memory device with address
On Thu, Mar 26, 2015 at 14:30:56 +0800, Luyao Huang wrote: When start a vm which have a memory device with address, the error like this : error: Failed to start domain test3 error: internal error: early end of file from monitor: possible problem: 2015-03-26T03:45:52.338891Z qemu-kvm: -device pc-dimm,node=0,memdev=memdimm0, id=dimm0,slot=0,base=4294967296: Property '.base' not found After check the qemu code i think this 'base' should named as 'addr', you can see this mail: http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00129.html Or check the include/hw/mem/pc-dimm.h in qemu source. Also add a tests for this. Signed-off-by: Luyao Huang lhu...@redhat.com --- I didn't change this parameter's name ('base'), because i am not sure if there is some special mean in it, or it is a result after discuss. You are right, the base address has to be formatted as addr. src/qemu/qemu_command.c| 2 +- .../qemuxml2argv-memory-hotplug-dimm-addr.args | 9 + .../qemuxml2argv-memory-hotplug-dimm-addr.xml | 45 ++ tests/qemuxml2argvtest.c | 2 + 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml I've reworded the commit message and pushed this patch. Peter 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/7] Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
On Wed, Mar 25, 2015 at 19:39:06 +0100, Ján Tomko wrote: This function only frees the info for one thread. --- daemon/remote.c | 2 +- include/libvirt/libvirt-domain.h | 2 +- src/libvirt-domain.c | 6 +++--- src/libvirt_public.syms | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/remote/remote_driver.c | 2 +- tools/virsh-domain.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) ACK, Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo
On Wed, Mar 25, 2015 at 19:39:11 +0100, Ján Tomko wrote: Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; +virBitmapPtr map = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _(IOThread ID), _(CPU Affinity)); vshPrintExtra(ctl, ---\n); for (i = 0; i niothreads; i++) { +char *mapstr = NULL; +virBitmapFree(map); +map = virBitmapNewData(info[i]-cpumap, info[i]-cpumaplen); +if (!map) +goto cleanup; + +if (!(mapstr = virBitmapFormat(map))) +goto cleanup; vshPrint(ctl, %-15u , info[i]-iothread_id); -ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen, - maxcpu, 0)); +vshPrint(ctl, %-15s , mapstr); vshPrint(ctl, \n); virDomainIOThreadInfoFree(info[i]); } VIR_FREE(info); cleanup: +virBitmapFree(map); virDomainFree(dom); return niothreads = 0; } Since vshPrintPinInfo produces the same output, how about we kill the reimplementation in vshPrintPinInfo and replace it with this code? And keep the use of vshPrintPinInfo here? Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: fix cannot start a vm with memory device with address
On 03/26/2015 04:24 PM, Peter Krempa wrote: On Thu, Mar 26, 2015 at 14:30:56 +0800, Luyao Huang wrote: When start a vm which have a memory device with address, the error like this : error: Failed to start domain test3 error: internal error: early end of file from monitor: possible problem: 2015-03-26T03:45:52.338891Z qemu-kvm: -device pc-dimm,node=0,memdev=memdimm0, id=dimm0,slot=0,base=4294967296: Property '.base' not found After check the qemu code i think this 'base' should named as 'addr', you can see this mail: http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00129.html Or check the include/hw/mem/pc-dimm.h in qemu source. Also add a tests for this. Signed-off-by: Luyao Huang lhu...@redhat.com --- I didn't change this parameter's name ('base'), because i am not sure if there is some special mean in it, or it is a result after discuss. You are right, the base address has to be formatted as addr. src/qemu/qemu_command.c| 2 +- .../qemuxml2argv-memory-hotplug-dimm-addr.args | 9 + .../qemuxml2argv-memory-hotplug-dimm-addr.xml | 45 ++ tests/qemuxml2argvtest.c | 2 + 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml I've reworded the commit message and pushed this patch. Thanks for your quick review. Peter Luyao -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] Rename qemuMonitorIOThreadsInfo* to qemuMonitorIOThreadInfo*
On Wed, Mar 25, 2015 at 19:39:07 +0100, Ján Tomko wrote: It only deals with a single thread. --- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_monitor.c | 4 ++-- src/qemu/qemu_monitor.h | 10 +- src/qemu/qemu_monitor_json.c | 8 src/qemu/qemu_monitor_json.h | 2 +- src/qemu/qemu_process.c | 4 ++-- tests/qemumonitorjsontest.c | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) ACK, Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/7] Rename DomainGetIOThreadsInfo to DomainGetIOThreadInfo
On Wed, Mar 25, 2015 at 19:39:08 +0100, Ján Tomko wrote: While it returns info about multiple threads, the version without the plural is easier to read. --- daemon/remote.c | 12 ++-- include/libvirt/libvirt-domain.h | 2 +- src/driver-hypervisor.h | 4 ++-- src/libvirt-domain.c | 14 +++--- src/libvirt_public.syms | 2 +- src/qemu/qemu_driver.c | 6 +++--- src/remote/remote_driver.c | 20 ++-- src/remote/remote_protocol.x | 10 +- src/remote_protocol-structs | 6 +++--- tools/virsh-domain.c | 2 +- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index be0febb..2f4df48 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2269,12 +2269,12 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED, } static int -remoteDispatchDomainGetIOThreadsInfo(virNetServerPtr server ATTRIBUTE_UNUSED, +remoteDispatchDomainGetIOThreadInfo(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientPtr client, virNetMessagePtr msg ATTRIBUTE_UNUSED, virNetMessageErrorPtr rerr, - remote_domain_get_iothreads_info_args *args, - remote_domain_get_iothreads_info_ret *ret) + remote_domain_get_iothread_info_args *args, + remote_domain_get_iothread_info_ret *ret) The whole block is misaligned now. { int rv = -1; size_t i; @@ -2292,13 +2292,13 @@ remoteDispatchDomainGetIOThreadsInfo(virNetServerPtr server ATTRIBUTE_UNUSED, if (!(dom = get_nonnull_domain(priv-conn, args-dom))) goto cleanup; -if ((ninfo = virDomainGetIOThreadsInfo(dom, info, args-flags)) 0) +if ((ninfo = virDomainGetIOThreadInfo(dom, info, args-flags)) 0) goto cleanup; -if (ninfo REMOTE_IOTHREADS_INFO_MAX) { +if (ninfo REMOTE_IOTHREAD_INFO_MAX) { virReportError(VIR_ERR_RPC, _(Too many IOThreads in info: %d for limit %d), - ninfo, REMOTE_IOTHREADS_INFO_MAX); + ninfo, REMOTE_IOTHREAD_INFO_MAX); goto cleanup; } diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 94b55b7..7be4219 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1607,7 +1607,7 @@ struct _virDomainIOThreadInfo { void virDomainIOThreadInfoFree(virDomainIOThreadInfoPtr info); -int virDomainGetIOThreadsInfo(virDomainPtr domain, +int virDomainGetIOThreadInfo(virDomainPtr domain, virDomainIOThreadInfoPtr **info, unsigned int flags); Misaligned ... int virDomainPinIOThread(virDomainPtr domain, diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 3f9bf02..9df593d 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -381,7 +381,7 @@ typedef int (*virDrvDomainGetMaxVcpus)(virDomainPtr domain); typedef int -(*virDrvDomainGetIOThreadsInfo)(virDomainPtr domain, +(*virDrvDomainGetIOThreadInfo)(virDomainPtr domain, virDomainIOThreadInfoPtr **info, unsigned int flags); Misaligned ... @@ -1271,7 +1271,7 @@ struct _virHypervisorDriver { virDrvDomainGetEmulatorPinInfo domainGetEmulatorPinInfo; virDrvDomainGetVcpus domainGetVcpus; virDrvDomainGetMaxVcpus domainGetMaxVcpus; -virDrvDomainGetIOThreadsInfo domainGetIOThreadsInfo; +virDrvDomainGetIOThreadInfo domainGetIOThreadInfo; virDrvDomainPinIOThread domainPinIOThread; virDrvDomainGetSecurityLabel domainGetSecurityLabel; virDrvDomainGetSecurityLabelList domainGetSecurityLabelList; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 73ab56d..f1608dc 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -7894,7 +7894,7 @@ virDomainGetMaxVcpus(virDomainPtr domain) /** - * virDomainGetIOThreadsInfo: + * virDomainGetIOThreadInfo: * @dom: a domain object * @info: pointer to an array of virDomainIOThreadInfo structures (OUT) * @flags: bitwise-OR of virDomainModificationImpact @@ -7910,9 +7910,9 @@ virDomainGetMaxVcpus(virDomainPtr domain) * then calling free() on @info. On error, @info is set to NULL. */ int -virDomainGetIOThreadsInfo(virDomainPtr dom, - virDomainIOThreadInfoPtr **info, - unsigned int flags) +virDomainGetIOThreadInfo(virDomainPtr dom, +
Re: [libvirt] [PATCH 0/7] iothread api followups
On Wed, Mar 25, 2015 at 15:00:58 -0400, John Ferlan wrote: On 03/25/2015 02:39 PM, Ján Tomko wrote: Looking at the proposed SetIOThread API, I noticed that the virsh command for printing the info is named 'iothreadsinfo'. This seemed counter-intuitive for me. Since the API has not been released yet, I propose a rename of the command to: iothreadinfo (patch 5) and the API for freeing one struct to: virDomainIOThreadInfoFree (patch 1) I don't feel as strongly about renaming the virDomainGetIOThreadsInfo API (patches 3, 4) or the internal APIs (patch 2). Looking at virVcpuInfoPtr (which might not be the best inspiration), I realized including the cpu time might be a good idea. Ján Tomko (7): Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree Rename qemuMonitorIOThreadsInfo* to qemuMonitorIOThreadInfo* Rename DomainGetIOThreadsInfo to DomainGetIOThreadInfo gendispatch: remove IOThreads from name fixups virsh: rename iothreadsinfo to iothreadinfo Do not use vshPrintPinInfo in iothreadinfo add cpu time to iothreadinfo daemon/remote.c | 15 +++-- include/libvirt/libvirt-domain.h | 5 +++-- src/driver-hypervisor.h | 4 ++-- src/libvirt-domain.c | 20 - src/libvirt_public.syms | 4 ++-- src/qemu/qemu_driver.c | 24 ++-- src/qemu/qemu_monitor.c | 4 ++-- src/qemu/qemu_monitor.h | 10 - src/qemu/qemu_monitor_json.c | 8 +++ src/qemu/qemu_monitor_json.h | 2 +- src/qemu/qemu_process.c | 4 ++-- src/remote/remote_driver.c | 23 ++-- src/remote/remote_protocol.x | 11 +- src/remote_protocol-structs | 7 +++--- src/rpc/gendispatch.pl | 1 - tests/qemumonitorjsontest.c | 4 ++-- tools/virsh-domain.c | 47 17 files changed, 113 insertions(+), 80 deletions(-) Didn't dig into all the details, but use of IOThreads v IOThread was mostly an artifact of the technology name. I'm ambivalent to the naming issue. You'll have to have follow-ups in libvirt-python and libvirt-perl though. Sometimes the *s* is relevant though - as in we're returning all IOThreads found vs returning just one IOThread w/r/t virsh iothreadsinfo vs. iothreadinfo - I see the latter as displaying just one rather than multiple. w/r/t patch 6 - does the output change? IOW: The current way displays 1, 3, 0-3, etc. Does the method you're proposing change to the y---, --y-, etc. method? I prefer the former The commit message would need to list the change if there is one. The output does not change. In fact I think the virsh reimpl of virBitmapFormat should be killed and replaced with the function we already have. w/r/t patch 7 - while it's a nice to have I think its far more relevant to list the Resource(s) associated with the thread than the CPU time used. Listing the Resource was rejected in a much earlier patch Actually, the resources is a configruation option and I don't see a way to change it unless you unplug the disk while CPU time is a statistics function that changes a lot. review, so I don't see why listing the CPU time is important and failing in qemuDomainGetIOThreadsLive because we cannot get the that time, but yet deciding later on to not print it if it doesn't exist doesn't make total sense. If the VM is offline, then the CPU time is obviously not filled, while when it's live we should return it. Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo
On 03/26/2015 05:58 AM, Peter Krempa wrote: On Wed, Mar 25, 2015 at 19:39:11 +0100, Ján Tomko wrote: Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; +virBitmapPtr map = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _(IOThread ID), _(CPU Affinity)); vshPrintExtra(ctl, ---\n); for (i = 0; i niothreads; i++) { +char *mapstr = NULL; +virBitmapFree(map); +map = virBitmapNewData(info[i]-cpumap, info[i]-cpumaplen); +if (!map) +goto cleanup; + +if (!(mapstr = virBitmapFormat(map))) +goto cleanup; vshPrint(ctl, %-15u , info[i]-iothread_id); -ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen, - maxcpu, 0)); +vshPrint(ctl, %-15s , mapstr); vshPrint(ctl, \n); virDomainIOThreadInfoFree(info[i]); } VIR_FREE(info); cleanup: +virBitmapFree(map); virDomainFree(dom); return niothreads = 0; } Since vshPrintPinInfo produces the same output, how about we kill the reimplementation in vshPrintPinInfo and replace it with this code? And keep the use of vshPrintPinInfo here? So then this should also be done for cmdVcpuPin and cmdEmulatorPin since that was the model... John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo
On Thu, Mar 26, 2015 at 06:25:21 -0400, John Ferlan wrote: On 03/26/2015 05:58 AM, Peter Krempa wrote: On Wed, Mar 25, 2015 at 19:39:11 +0100, Ján Tomko wrote: Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; +virBitmapPtr map = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _(IOThread ID), _(CPU Affinity)); vshPrintExtra(ctl, ---\n); for (i = 0; i niothreads; i++) { +char *mapstr = NULL; +virBitmapFree(map); +map = virBitmapNewData(info[i]-cpumap, info[i]-cpumaplen); +if (!map) +goto cleanup; + +if (!(mapstr = virBitmapFormat(map))) +goto cleanup; vshPrint(ctl, %-15u , info[i]-iothread_id); -ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen, - maxcpu, 0)); +vshPrint(ctl, %-15s , mapstr); vshPrint(ctl, \n); virDomainIOThreadInfoFree(info[i]); } VIR_FREE(info); cleanup: +virBitmapFree(map); virDomainFree(dom); return niothreads = 0; } Since vshPrintPinInfo produces the same output, how about we kill the reimplementation in vshPrintPinInfo and replace it with this code? And keep the use of vshPrintPinInfo here? So then this should also be done for cmdVcpuPin and cmdEmulatorPin since that was the model... Or as I've said above, rewrite vshPrintPinInfo() with the internal code and leave it used in all places (here too). Peter 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/1] nodeinfo: Increase the num of CPU thread siblings to a larger value
On Thu, Mar 26, 2015 at 12:48:13AM -0400, Wei Huang wrote: Current libvirt can only handle up to 1024 thread siblings when it reads Linux sysfs topology/thread_siblings. This isn't enough for Linux distributions that support a large value. This patch fixes the problem by using VIR_ALLOC()/VIR_FREE(), instead of using a fixed-size (1024) local char array. In the meanwhile SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX is increased to 8192 which should be large enough for a foreseeable future. Signed-off-by: Wei Huang w...@redhat.com --- src/nodeinfo.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 34d27a6..66dc7ef 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -287,7 +287,7 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params, # define PROCSTAT_PATH /proc/stat # define MEMINFO_PATH /proc/meminfo # define SYSFS_MEMORY_SHARED_PATH /sys/kernel/mm/ksm -# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 1024 +# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 8192 There is thread_siblings_list, which contains a range: 22-23 and thread_siblings file has all the bits set: 00c0 For the second one, the 1024-byte buffer should be enough for 16368 possible siblings. For the first one, the results depend on the topology - if the sibling ranges are contiguous, even million CPUs should fit there. For the worst case, when every other cpu is a sibling, the second file is more space-efficient. I'm OK with using the same limit for both (8k seems sufficiently large), but I would like to know: Which one is the file that failed to parse in your case? I think both virNodeCountThreadSiblings and virNodeGetSiblingsList could be rewritten to share some code and only look at one of the sysfs files. The question is - which one? Jan 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/7] Implement public API for virDomainIOThreadsSet
On Wed, Mar 25, 2015 at 03:22:03PM -0400, John Ferlan wrote: On 03/25/2015 11:37 AM, Peter Krempa wrote: On Wed, Mar 25, 2015 at 16:29:22 +0100, Ján Tomko wrote: On Thu, Mar 19, 2015 at 01:08:22PM -0400, John Ferlan wrote: Add virDomainIOThreadsSet to allow setting the number of IOThreads for a domain. The API supports updating both the --live domain and the --config data. Signed-off-by: John Ferlan jfer...@redhat.com --- include/libvirt/libvirt-domain.h | 3 ++ src/driver-hypervisor.h | 6 src/libvirt-domain.c | 60 src/libvirt_public.syms | 1 + 4 files changed, 70 insertions(+) This one has been siting there for a while, I'll think out loud just to get a discussion going. --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -8042,6 +8042,66 @@ virDomainPinIOThread(virDomainPtr domain, /** + * virDomainSetIOThreads: + * @domain: pointer to domain object + * @niothreads: the new number of IOThreads for this domain + * @flags: bitwise-OR of virDomainModificationImpact + * + * Dynamically change the number of IOThreads used by the domain. + * Note that this call faiy fail if the underlying virtualization hypervisor + * does not support it or if growing the number is arbitrarily limited. + * This function may require privileged access to the hypervisor. + * + * @flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running + * domain (which may fail if domain is not active), or + * VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML + * description of the domain. Both flags may be set. + * If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), + * then an inactive domain modifies persistent setup, while an active domain + * is hypervisor-dependent on whether just live or both live and persistent + * state is changed. + * + * Not all hypervisors can support all flag combinations. + * + * Returns 0 in case of success, -1 in case of failure. + */ +int +virDomainSetIOThreads(virDomainPtr domain, + unsigned int niothreads, + unsigned int flags) +{ This seems ok for the use case where we just give a domain a few iothreads and all the disks will share them. But if you go for one iothread per disk, creating holes in iothread indexes could make sense - we allow unplugging disks from the middle. I can't think of a case where hotplugging a thread with id=6 would be useful if there are only 3 threads. Maybe there should be separate APIs for adding and deleting threads? I have to agree here. Separate API for adding and removing (or perhaps just a parameter to switch?) specific threads is the way to go. Why? Well this function looks like it was copied from virDomainSetVcpus which I'm currently planning to replace with specific vcpu hotplug api. The reasons there are the same as Jan pointed out just translated into the context of vCPUS. At the point where there is no other mapping or relationship of belonging the API is fine. This was true for vCPUs in the pre-NUMA era. With NUMA, (or disks IO executed by iothreads in this case) you have a relationship where a thread (or vCPU) belongs to a dis (or NUMA node) and you need to be able to select them individually. hmmm... well yes, the model is the Vcpu algorithms and specifically SetVcpus. Allowing unordered IOThread id's will require some rework of other algorithms. Talking through this ... If I start with 0 IOThreads and want 2, is it easier to SetIOThreads once or AddIOThread twice? Similarly, if I have 2 IOThreads and want 0, is it easier to SetIOThreads once or DelIOThread twice? If I start with 2 IOThreads, I add 2 IOThreads, then want to remove IOThread 3, then does that mean this has similar logic to Vcpus where I have to introduce a 'current' value. Then at (re)startup, I have to determine which IOThreads are assigned disks in order to determine which of the 3 current to start. The add iothread to disk logic would need adjustment to know that IOThread#3 doesn't exist. It's easy to start one in the middle with its own number, I just wonder the 'real world' use case (not talking the varying array of test matrix patterns that need to be validated). Hence the KISS method of managing IOThreads. Right, so holes in iothreads don't make much sense if we're specifying them in the domain XML as: iothreadsn/iothreads And if we ever need to invent an API that does that, new XML will be needed as well. It was just a thought that came to mind when looking at the iothread_id returned in the virDomainIOThreadInfo struct. Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/7] iothread api followups
w/r/t patch 7 - while it's a nice to have I think its far more relevant to list the Resource(s) associated with the thread than the CPU time used. Listing the Resource was rejected in a much earlier patch Actually, the resources is a configruation option and I don't see a way to change it unless you unplug the disk while CPU time is a statistics function that changes a lot. Correct, but I also think it's more useful to display resources in IOThreads output. If I'm a user I would rather know which resources are assigned to which IOThreads rather than how much CPU Time they're using. Since CPU Time is a statistic, perhaps it belongs in the stats output rather than the IOThreads information output. As it stands, I have to make my own map by dumping the xml, looking for the iothreads attribute in a disk element and then do the correlation. Again - don't forget to update the libvirt-python and libvirt-perl code. review, so I don't see why listing the CPU time is important and failing in qemuDomainGetIOThreadsLive because we cannot get the that time, but yet deciding later on to not print it if it doesn't exist doesn't make total sense. If the VM is offline, then the CPU time is obviously not filled, while when it's live we should return it. You missed my point - if for some reason we fail to get the CPU Time from the QEMU call - we fail the entire call now. If the time wasn't available we don't print it. So why fail the call just because the time isn't available (for whatever reason). It's not all that important, but once done I would hope the bz associated will also get updated to list the new data column so that whomever tests and documents this can do so properly. John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-python PATCH 2/2] Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
--- generator.py | 4 ++-- libvirt-override-api.xml | 2 +- libvirt-override.c | 10 +- sanitytest.py| 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generator.py b/generator.py index 05ccbc8..729daa2 100755 --- a/generator.py +++ b/generator.py @@ -435,7 +435,7 @@ skip_impl = ( 'virDomainGetVcpuPinInfo', 'virDomainGetEmulatorPinInfo', 'virDomainPinEmulator', -'virDomainGetIOThreadsInfo', +'virDomainGetIOThreadInfo', 'virDomainPinIOThread', 'virSecretGetValue', 'virSecretSetValue', @@ -1147,7 +1147,7 @@ def nameFixup(name, classe, type, file): elif name[0:20] == virDomainGetCPUStats: func = name[9:] func = func[0:1].lower() + func[1:] -elif name[0:25] == virDomainGetIOThreadsInfo: +elif name[0:24] == virDomainGetIOThreadInfo: func = name[12:] func = func[0:2].lower() + func[2:] elif name[0:18] == virDomainGetFSInfo: diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 4660c9f..cf46090 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -278,7 +278,7 @@ arg name='cpumap' type='unsigned char *' info='pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.'/ arg name='flags' type='int' info='flags to specify'/ /function -function name='virDomainGetIOThreadsInfo' file='python' +function name='virDomainGetIOThreadInfo' file='python' infoQuery the CPU affinity setting of the IOThreads of the domain/info arg name='domain' type='virDomainPtr' info='pointer to domain object, or NULL for Domain0'/ arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ diff --git a/libvirt-override.c b/libvirt-override.c index 9a72f87..0699ae3 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -1992,8 +1992,8 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self ATTRIBUTE_UNUSED, #if LIBVIR_CHECK_VERSION(1, 2, 14) static PyObject * -libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args) +libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { virDomainPtr domain; PyObject *pyobj_domain; @@ -2004,7 +2004,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, size_t pcpu, i; int niothreads, cpunum; -if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadsInfo, +if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadInfo, pyobj_domain, flags)) return NULL; domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); @@ -2013,7 +2013,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_NONE; LIBVIRT_BEGIN_ALLOW_THREADS; -niothreads = virDomainGetIOThreadsInfo(domain, iothrinfo, flags); +niothreads = virDomainGetIOThreadInfo(domain, iothrinfo, flags); LIBVIRT_END_ALLOW_THREADS; if (niothreads 0) { @@ -8640,7 +8640,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) virDomainPinEmulator, libvirt_virDomainPinEmulator, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ #if LIBVIR_CHECK_VERSION(1, 2, 14) -{(char *) virDomainGetIOThreadsInfo, libvirt_virDomainGetIOThreadsInfo, METH_VARARGS, NULL}, +{(char *) virDomainGetIOThreadInfo, libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL}, {(char *) virDomainPinIOThread, libvirt_virDomainPinIOThread, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ {(char *) virConnectListStoragePools, libvirt_virConnectListStoragePools, METH_VARARGS, NULL}, diff --git a/sanitytest.py b/sanitytest.py index cff9811..aafc487 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -279,8 +279,8 @@ for name in sorted(basicklassmap): func = nwfilter + func[8:] if func[0:8] == fSFreeze or func[0:6] == fSThaw or func[0:6] == fSInfo: func = fs + func[2:] -if func[0:13] == iOThreadsInfo: -func = ioThreadsInfo +if func[0:13] == iOThreadInfo: +func = ioThreadInfo if klass == virNetwork: func = func.replace(dHCP, DHCP) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-python PATCH 1/2] Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
--- generator.py | 2 +- libvirt-override.c | 2 +- sanitytest.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generator.py b/generator.py index df7a74d..05ccbc8 100755 --- a/generator.py +++ b/generator.py @@ -594,7 +594,7 @@ skip_function = ( 'virNetworkDHCPLeaseFree', # only useful in C, python code uses list 'virDomainStatsRecordListFree', # only useful in C, python uses dict 'virDomainFSInfoFree', # only useful in C, python code uses list -'virDomainIOThreadsInfoFree', # only useful in C, python code uses list +'virDomainIOThreadInfoFree', # only useful in C, python code uses list ) lxc_skip_function = ( diff --git a/libvirt-override.c b/libvirt-override.c index 1241305..9a72f87 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2075,7 +2075,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, cleanup: for (i = 0; i niothreads; i++) -virDomainIOThreadsInfoFree(iothrinfo[i]); +virDomainIOThreadInfoFree(iothrinfo[i]); VIR_FREE(iothrinfo); Py_XDECREF(py_iothrinfo); return py_retval; diff --git a/sanitytest.py b/sanitytest.py index 0e6e0e5..cff9811 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -142,7 +142,7 @@ for cname in wantfunctions: if name[0:19] == virDomainFSInfoFree: continue -if name[0:26] == virDomainIOThreadsInfoFree: +if name[0:26] == virDomainIOThreadInfoFree: continue if name[0:21] == virDomainListGetStats: -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [perl PATCH 2/2] Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
--- Changes | 1 + Virt.xs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 44a42f2..7a2bc51 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,7 @@ Revision history for perl module Sys::Virt - Add virDomainInterfaceAddress function constants - Add VIR_DOMAIN_PAUSED_STARTING_UP constant - Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree + - Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo 1.2.13 2015-03-05 diff --git a/Virt.xs b/Virt.xs index 5dc977a..2138530 100644 --- a/Virt.xs +++ b/Virt.xs @@ -5023,8 +5023,8 @@ get_iothread_info(dom, flags=0) int niothreads; int i; PPCODE: - if ((niothreads = virDomainGetIOThreadsInfo(dom, iothrinfo, - flags)) 0) + if ((niothreads = virDomainGetIOThreadInfo(dom, iothrinfo, + flags)) 0) _croak_error(); EXTEND(SP, niothreads); -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-python PATCH 0/2] Rename IOThreads* APIs to IOThread
These depend on the rename being pushed to libvirt.git: (first four patches of:) https://www.redhat.com/archives/libvir-list/2015-March/msg01325.html Ján Tomko (2): Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo generator.py | 6 +++--- libvirt-override-api.xml | 2 +- libvirt-override.c | 12 ++-- sanitytest.py| 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo
On 03/25/2015 02:39 PM, Ján Tomko wrote: Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; +virBitmapPtr map = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _(IOThread ID), _(CPU Affinity)); vshPrintExtra(ctl, ---\n); for (i = 0; i niothreads; i++) { +char *mapstr = NULL; Considering the other discussion about Set/Add/Del IOThread and since you're modifying the code anyway... How about adding a check for: if (info[i].iothread_id == 0) continue; That way we can prepare for a configuration that may have holes on the delete and won't have some future issue with a 1.2.14 virsh receiving something unexpected from a 1.2.15 daemon. John +virBitmapFree(map); +map = virBitmapNewData(info[i]-cpumap, info[i]-cpumaplen); +if (!map) +goto cleanup; + +if (!(mapstr = virBitmapFormat(map))) +goto cleanup; vshPrint(ctl, %-15u , info[i]-iothread_id); -ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen, - maxcpu, 0)); +vshPrint(ctl, %-15s , mapstr); vshPrint(ctl, \n); virDomainIOThreadInfoFree(info[i]); } VIR_FREE(info); cleanup: +virBitmapFree(map); virDomainFree(dom); return niothreads = 0; } -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: refact virDomainHasDiskMirror and rename it to virDomainHasBlockjob
- Original Message - | From: Peter Krempa pkre...@redhat.com | To: Shanzhi Yu s...@redhat.com | Cc: libvir-list@redhat.com | Sent: Wednesday, March 25, 2015 11:24:21 PM | Subject: Re: [libvirt] [PATCH] conf: refact virDomainHasDiskMirror and rename | it to virDomainHasBlockjob | On Tue, Mar 24, 2015 at 18:08:00 +0800, Shanzhi Yu wrote: | Create external snapshot or migrate a vm when there is a blockpull | job running should be forbidden by libvirt, otherwise qemu try to | create external snapshot and failed with error unable to execute | QEMU command 'transaction': Device 'drive-virtio-disk0' is busy: | block device is in use by block job: stream, and migration will | succeed which will lead the blockpull job failed. | | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1203628 | Signed-off-by: Shanzhi Yu s...@redhat.com | --- | src/conf/domain_conf.c | 6 +++--- | src/conf/domain_conf.h | 2 +- | src/libvirt_private.syms | 2 +- | src/qemu/qemu_driver.c | 6 +++--- | src/qemu/qemu_migration.c | 2 +- | 5 files changed, 9 insertions(+), 9 deletions(-) | | diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c | index d633f93..24445af 100644 | --- a/src/conf/domain_conf.c | +++ b/src/conf/domain_conf.c | @@ -12264,13 +12264,13 @@ virDomainDiskRemoveByName(virDomainDefPtr def, | const char *name) | } | | /* Return true if VM has at least one disk involved in a current block | - * copy/commit job (that is, with a mirror element in the disk xml). */ | + * copy/commit/pull job */ | bool | -virDomainHasDiskMirror(virDomainObjPtr vm) | +virDomainHasBlockjob(virDomainObjPtr vm) | { | size_t i; | for (i = 0; i vm-def-ndisks; i++) | - if (vm-def-disks[i]-mirror) | + if (vm-def-disks[i]-blockjob) | return true; | return false; | } | diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h | index bceb2d7..32674f3 100644 | --- a/src/conf/domain_conf.h | +++ b/src/conf/domain_conf.h | @@ -2645,7 +2645,7 @@ int virDomainDiskSourceParse(xmlNodePtr node, | xmlXPathContextPtr ctxt, | virStorageSourcePtr src); | | -bool virDomainHasDiskMirror(virDomainObjPtr vm); | +bool virDomainHasBlockjob(virDomainObjPtr vm); | | int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net); | virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char | *device); | diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms | index 33222f0..9ebaf4a 100644 | --- a/src/libvirt_private.syms | +++ b/src/libvirt_private.syms | @@ -297,7 +297,7 @@ virDomainGraphicsTypeFromString; | virDomainGraphicsTypeToString; | virDomainGraphicsVNCSharePolicyTypeFromString; | virDomainGraphicsVNCSharePolicyTypeToString; | -virDomainHasDiskMirror; | +virDomainHasBlockjob; | virDomainHasNet; | virDomainHostdevCapsTypeToString; | virDomainHostdevDefAlloc; | diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c | index 80a3d77..51e302f 100644 | --- a/src/qemu/qemu_driver.c | +++ b/src/qemu/qemu_driver.c | @@ -7398,7 +7398,7 @@ static virDomainPtr | qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml | | virObjectRef(vm); | def = NULL; | - if (virDomainHasDiskMirror(vm)) { | + if (virDomainHasBlockjob(vm)) { | virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, %s, | _(domain has active block job)); | virDomainObjAssignDef(vm, NULL, false, NULL); | This code here has two effects: | 1) if the VM is started, this is to forbid defining it back | 2) if the VM is not started it forbids defining one with a disk mirror | element | Additionally this check (in the existing form) is wrong since the active | block copy job should not interlock domain definition. | Whith this patch the check would be even more wrong as it would disallow | changes to the persistent defintion if any block job was active. Understood | This problem needs to be fixed separately, before attempting such | change. | @@ -14583,7 +14583,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, | %s, _(domain is marked for auto destroy)); | goto cleanup; | } | - if (virDomainHasDiskMirror(vm)) { | + if (virDomainHasBlockjob(vm)) { | virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, %s, | _(domain has active block job)); | goto cleanup; | I think we should reconsider whether we want to block snapshots by a | single copy job or we want to do the check in a more granular (per-disk) Yes, it's better check per disk. | fashion. | @@ -15245,7 +15245,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr | snapshot, | if (!(caps = virQEMUDriverGetCapabilities(driver, false))) | goto cleanup; | | - if (virDomainHasDiskMirror(vm)) { | + if (virDomainHasBlockjob(vm)) { | virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, %s, | _(domain has active block job)); | goto cleanup; | Here it's questionable whether combining the check for | diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c | index d34bb02..27a76ec 100644 | --- a/src/qemu/qemu_migration.c | +++
[libvirt] [perl PATCH 1/2] Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
--- Changes | 1 + Virt.xs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 017990a..44a42f2 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,7 @@ Revision history for perl module Sys::Virt - Add VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN constant - Add virDomainInterfaceAddress function constants - Add VIR_DOMAIN_PAUSED_STARTING_UP constant + - Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree 1.2.13 2015-03-05 diff --git a/Virt.xs b/Virt.xs index 35ea013..5dc977a 100644 --- a/Virt.xs +++ b/Virt.xs @@ -5039,7 +5039,7 @@ get_iothread_info(dom, flags=0) } for (i = 0 ; i niothreads ; i++) { - virDomainIOThreadsInfoFree(iothrinfo[i]); + virDomainIOThreadInfoFree(iothrinfo[i]); } free(iothrinfo); -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [perl PATCH 0/2] Rename IOThreads* APIs to IOThread
These depend on the rename being pushed to libvirt.git: (first four patches of:) https://www.redhat.com/archives/libvir-list/2015-March/msg01325.html Ján Tomko (2): Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo Changes | 2 ++ Virt.xs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/7] gendispatch: remove IOThreads from name fixups
On Thu, Mar 26, 2015 at 10:47:01AM +0100, Peter Krempa wrote: On Wed, Mar 25, 2015 at 19:39:09 +0100, Ján Tomko wrote: No more APIs have IOThreads in their name now. --- src/rpc/gendispatch.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index aa73d0c..b642d6e 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -67,7 +67,6 @@ sub fixup_name { $name =~ s/Fsfreeze$/FSFreeze/; $name =~ s/Fsthaw$/FSThaw/; $name =~ s/Fsinfo$/FSInfo/; -$name =~ s/Iothreads$/IOThreads/; $name =~ s/Iothread$/IOThread/; $name =~ s/Scsi/SCSI/; $name =~ s/Wwn$/WWN/; Squash this to the previous patch. ACK Peter I have squashed it in locally, fixed the alignment and sent patches for the python and perl bindings based on this rename (up to this patch). Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] qemu_migration: Precreate missing storage breaks with network drives
On Thu, 26 Mar 2015, Noel Burton-Krahn wrote: Hi Michal, How can we move this along as a patch to libvirt? Can we submit a patch ourselves? Hi Noel, Michal applied my patch for this as commit a1b1805155. It looks like we've been trying to solve the same problem in different threads; perhaps you didn't see my thread. Michal, thanks for the patch review! - Michael -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Entering freeze for libvirt-1.2.14
I have tagged a release candidate 1 in git and generated signed tarballs and rpms at the usual place: ftp://libvirt.org/libvirt/ This seems to work normally in my limited testing but others need to give it a serious try ! I think I will do an RC2 on Monday, and if everything look file the final release will be on April 1st. Thanks in advance for reports about it ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veill...@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-test-API][PATCH] Add connection_getDomainCapabilities test case
On 03/26/2015 05:06 PM, jiahu wrote: This case will test getDomainCapabilities API, and connection_getDomainCapabilities test case was added to test_connection.conf --- cases/test_connection.conf| 10 + repos/virconn/connection_getDomainCapabilities.py | 438 ++ 2 files changed, 448 insertions(+) create mode 100644 repos/virconn/connection_getDomainCapabilities.py diff --git a/cases/test_connection.conf b/cases/test_connection.conf index 7552024..5719937 100644 --- a/cases/test_connection.conf +++ b/cases/test_connection.conf @@ -47,3 +47,13 @@ virconn:free_pages 0 pagesize 4k,2M + +virconn:connection_getDomainCapabilities +emulatorbin +/usr/libexec/qemu-kvm +arch +x86_64 +machine +pc-i440fx-rhel7.0.0 +virttype +kvm diff --git a/repos/virconn/connection_getDomainCapabilities.py b/repos/virconn/connection_getDomainCapabilities.py new file mode 100644 index 000..f0cfa1f --- /dev/null +++ b/repos/virconn/connection_getDomainCapabilities.py @@ -0,0 +1,438 @@ +#!/usr/bin/env python +# test getDomainCapabilities() API for libvirtd + +import os +import libvirt +import hashlib +import fcntl + +from xml.dom import minidom +from libvirt import libvirtError +from src import sharedmod +from utils import utils + +required_params = ('emulatorbin','arch','machine','virttype',) +optional_params = {} + +QEMU_CAPS = +API_FILE = /tmp/caps_from_api.xml +CMD = rm -rf %s +OVMF = /usr/share/OVMF/OVMF_CODE.fd +IOMMU = /sys/kernel/iommu_groups/ +VFIO = /dev/vfio/vfio +KVM = /dev/kvm +KVM_CHECK_EXTENSION = 44547 +KVM_CAP_IOMMU = 18 +maxcpu = 0 + +ovmf_f = False +drive = False +drive_forma = False +drive_readonly = False +blk_sg_io = False +usb_storage = False +device = False +scsi_generic = False +vfio_pci = False + +def clean_env(logger): + + clean testing environment + +status, output = utils.exec_cmd(CMD % API_FILE, shell=True) +if status != 0: +logger.error(Can not delete %s % API_FILE) +else: +logger.debug(Deleted %s successfully % API_FILE) + +def get_hypervisor_ver(emulatorbin,logger): + + Obtain qemu-kvm's version, and return a number value of version + +RPM = rpm -qf %s +status, package = utils.exec_cmd(RPM % emulatorbin, shell=True) +if not status: +logger.debug(The package is %s % package) +else: +logger.debug(The package is %s % package) +return 0 +package = package[0].split('-') +version = +for item in package: +if not item.isalnum(): +for v in item.split(.): +version = version + v.rjust(3,0) +break +return int(version) + +def validate_caps_from_hv(emulatorbin,logger): + +Validate the relative caps between libvirt and qemu-kvm + +F1 = %s -h| grep \\-drive\ +F2 = %s -h| grep \format=\ +F3 = %s -h| grep \readonly=\ +F4 = %s -h| grep \^\\-device\ +l = [F1,F2,F3,F4] +flags = [] +for item in l: +status, temp = utils.exec_cmd(item % emulatorbin, shell=True) +if not status: +flags.append(True) +logger.debug(Got: %s from vh % temp) +else: +flags.append(False) +logger.debug(Got: %s from vh % temp) +if get_hypervisor_ver(emulatorbin,logger) = 11000: + flags.append(True) +else: + flags.append(False) +libvirt_f = [drive,drive_forma,drive_readonly,device,blk_sg_io] +if flags == libvirt_f: +return True +else: +return False + +def generate_hash(emulatorbin,logger): + + generate file name using sha256 + +global QEMU_CAPS +QEMU_CAPS = /var/cache/libvirt/qemu/capabilities/ +file_name = hashlib.sha256(emulatorbin).hexdigest() +QEMU_CAPS = QEMU_CAPS + file_name + .xml +logger.debug(Cache file is %s % QEMU_CAPS) + +def get_maxcpu(machine,logger): + + return maxcpu for given machine type from QEMU_CAPS xml + +global maxcpu +xml = minidom.parse(QEMU_CAPS) +qemu = xml.getElementsByTagName('qemuCaps')[0] +for item in qemu.getElementsByTagName('machine'): +if item.getAttribute('name') == machine: +maxcpu = int(item.getAttribute('maxCpus')) +return True + +def get_os_flags(logger): + + Read results from QEMU_CAPS file and set three flags + +global drive, drive_forma, drive_readonly +xml = minidom.parse(QEMU_CAPS) +qemu = xml.getElementsByTagName('qemuCaps')[0] +for item in qemu.getElementsByTagName('flag'): +if item.getAttribute('name') == drive: +drive = True +if item.getAttribute('name') == drive-format: +drive_forma = True +if item.getAttribute('name') == drive-readonly: +drive_readonly = True +logger.debug(drive = %s; drive_format = %s; drive_readonly = %s\ +%
[libvirt] connect: ssh: Shall we remove the dependency of netcat ?
1 When we connect libvirt with URI qemu+ssh, it uses 'nc' command to connect to libvirt-sock. # virsh -c qemu+ssh://root@9.61.1.74/system list Password: //ask users to input passwords here. IdName State 11pxerunning It in fact uses 'ssh' and 'nc' commands to connect to remote libvirt-sock, such as: ssh -l root 9.61.1.74 sh -c ''nc' -U /var/run/libvirt/libvirt-sock' The code path is : virConnectOpen-doRemoteOpen-virNetClientNewSSH-virNetSocketNewConnectSSH 2 However, netcat(nc) is considered as an insecure tool, because it's too powerful in controlling the network. It's abandoned by some organizations. 3 So, is there any good substitution for netcat to realize qemu+ssh? -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: fix crash in qemuProcessAutoDestroy
The destination libvirt daemon in a migration may segfault if the client disconnects immediately after the migration has begun: # virsh -c qemu+tls://remote/system list --all IdName State ... # timeout --signal KILL 1 \ virsh migrate example qemu+tls://remote/system \ --verbose --compressed --live --auto-converge \ --abort-on-error --unsafe --persistent \ --undefinesource --copy-storage-all --xml example.xml Killed # virsh -c qemu+tls://remote/system list --all error: failed to connect to the hypervisor error: unable to connect to server at 'remote:16514': Connection refused The crash is in: 1531 void 1532 qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj) 1533 { 1534 qemuDomainObjPrivatePtr priv = obj-privateData; 1535 qemuDomainJob job = priv-job.active; 1536 1537 priv-jobs_queued--; Backtrace: #0 at qemuDomainObjEndJob at qemu/qemu_domain.c:1537 #1 in qemuDomainRemoveInactive at qemu/qemu_domain.c:2497 #2 in qemuProcessAutoDestroy at qemu/qemu_process.c:5646 #3 in virCloseCallbacksRun at util/virclosecallbacks.c:350 #4 in qemuConnectClose at qemu/qemu_driver.c:1154 ... qemuDomainRemoveInactive calls virDomainObjListRemove, which in this case is holding the last remaining reference to the domain. qemuDomainRemoveInactive then calls qemuDomainObjEndJob, but the domain object has been freed and poisoned by then. This patch bumps the domain's refcount until qemuDomainRemoveInactive has completed. We also ensure qemuProcessAutoDestroy does not return the domain to virCloseCallbacksRun to be unlocked in this case. There is similar logic in bhyveProcessAutoDestroy and lxcProcessAutoDestroy (which call virDomainObjListRemove directly). Signed-off-by: Michael Chapman m...@very.puzzling.org --- src/qemu/qemu_domain.c | 5 + src/qemu/qemu_process.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 758fcd9..0ae4693 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2487,11 +2487,16 @@ qemuDomainRemoveInactive(virQEMUDriverPtr driver, VIR_WARN(unable to remove snapshot directory %s, snapDir); VIR_FREE(snapDir); } + +virObjectRef(vm); + virDomainObjListRemove(driver-domains, vm); virObjectUnref(cfg); if (haveJob) qemuDomainObjEndJob(driver, vm); + +virObjectUnref(vm); } void diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 79f763e..fe987c8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5642,8 +5642,10 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, qemuDomainObjEndJob(driver, dom); -if (!dom-persistent) +if (!dom-persistent) { qemuDomainRemoveInactive(driver, dom); +dom = NULL; +} if (event) qemuDomainEventQueue(driver, event); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] nodeinfo: Increase the num of CPU thread siblings to a larger value
On 03/26/2015 12:08 PM, Wei Huang wrote: On 03/26/2015 10:49 AM, Don Dutile wrote: On 03/26/2015 07:03 AM, Ján Tomko wrote: On Thu, Mar 26, 2015 at 12:48:13AM -0400, Wei Huang wrote: Current libvirt can only handle up to 1024 thread siblings when it reads Linux sysfs topology/thread_siblings. This isn't enough for Linux distributions that support a large value. This patch fixes the problem by using VIR_ALLOC()/VIR_FREE(), instead of using a fixed-size (1024) local char array. In the meanwhile SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX is increased to 8192 which should be large enough for a foreseeable future. Signed-off-by: Wei Huang w...@redhat.com --- src/nodeinfo.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 34d27a6..66dc7ef 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -287,7 +287,7 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params, # define PROCSTAT_PATH /proc/stat # define MEMINFO_PATH /proc/meminfo # define SYSFS_MEMORY_SHARED_PATH /sys/kernel/mm/ksm -# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 1024 +# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 8192 There is thread_siblings_list, which contains a range: 22-23 and thread_siblings file has all the bits set: 00c0 For the second one, the 1024-byte buffer should be enough for 16368 possible siblings. a 4096 siblings file will generate a (cpumask_t -based) output of : ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,0080 9(characters per 32-bit mask, including the comma)*8(masks/row)*16(rows) -1(last entry doesn't have a comma) = 1152 Other releases/arch's avoid this issue by using cpumask_var_t vs cpumask_t for siblings so it's reflective of actual cpu count a system (not operating system) could provide/support. Don, could ARM kernel use cpumask_var_t as well? Or this will require lots of change on top of existing code? Yes. Working on that (kernel) patch now. It was simple/fast to use cpumask_t b/c historically, the counts ( kernel NR_CPUS value) were low. On x86, they were ACPI-driven. On arm64, need ACPI DT-based solution, and arm64-acpi looks like it was based more on ia64 then x86, so need to create/support some new globals on arm64 that cpumask_var_t depend on, and have to roll DT to do the same. cpumask_t objects are NR_CPUS -sized. In the not so distant future, though, real systems will have 1024 cpus, so might as well accomodate for a couple years after that. So we agree that such fix would be necessary, because: i) it will fail on cpumask_t based kernel (like Red Hat ARM); ii) eventually we might need to revisit this issue when a currently working system reaches the tipping point of CPU count (1000). Yes. For the first one, the results depend on the topology - if the sibling ranges are contiguous, even million CPUs should fit there. The _list files(core_siblings_list, thread_siblings_list) have ranges; the non _list (core_siblings, thread_siblings) files have mask like above. For the worst case, when every other cpu is a sibling, the second file is more space-efficient. I'm OK with using the same limit for both (8k seems sufficiently large), but I would like to know: Which one is the file that failed to parse in your case? /sys/devices/system/cpu/cpu*/topology/thread_siblings I think both virNodeCountThreadSiblings and virNodeGetSiblingsList could be rewritten to share some code and only look at one of the sysfs files. The question is - which one? Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] Parallels disk device attach
This patchset implements disk device attachment and allows OpenStack to attach volumes to Parallels-driven instances. Parallels Cloud Server SDK supports live attachment of disk devices and virtual interfaces cards. Alexander Burluka (3): Parallels: remove disk serial number check Parallels: implement domainAttachDeviceFlags Parallels: implemented domainAttachDevice -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] Parallels: implemented domainAttachDevice
That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka aburl...@parallels.com --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 87297cf..2a2c0fa 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1048,6 +1048,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_LIVE); +} + static virHypervisorDriver parallelsDriver = { .name = Parallels, .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1082,6 +1088,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] nodeinfo: Increase the num of CPU thread siblings to a larger value
On 03/26/2015 10:49 AM, Don Dutile wrote: On 03/26/2015 07:03 AM, Ján Tomko wrote: On Thu, Mar 26, 2015 at 12:48:13AM -0400, Wei Huang wrote: Current libvirt can only handle up to 1024 thread siblings when it reads Linux sysfs topology/thread_siblings. This isn't enough for Linux distributions that support a large value. This patch fixes the problem by using VIR_ALLOC()/VIR_FREE(), instead of using a fixed-size (1024) local char array. In the meanwhile SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX is increased to 8192 which should be large enough for a foreseeable future. Signed-off-by: Wei Huang w...@redhat.com --- src/nodeinfo.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 34d27a6..66dc7ef 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -287,7 +287,7 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params, # define PROCSTAT_PATH /proc/stat # define MEMINFO_PATH /proc/meminfo # define SYSFS_MEMORY_SHARED_PATH /sys/kernel/mm/ksm -# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 1024 +# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 8192 There is thread_siblings_list, which contains a range: 22-23 and thread_siblings file has all the bits set: 00c0 For the second one, the 1024-byte buffer should be enough for 16368 possible siblings. a 4096 siblings file will generate a (cpumask_t -based) output of : ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,0080 9(characters per 32-bit mask, including the comma)*8(masks/row)*16(rows) -1(last entry doesn't have a comma) = 1152 Other releases/arch's avoid this issue by using cpumask_var_t vs cpumask_t for siblings so it's reflective of actual cpu count a system (not operating system) could provide/support. Don, could ARM kernel use cpumask_var_t as well? Or this will require lots of change on top of existing code? cpumask_t objects are NR_CPUS -sized. In the not so distant future, though, real systems will have 1024 cpus, so might as well accomodate for a couple years after that. So we agree that such fix would be necessary, because: i) it will fail on cpumask_t based kernel (like Red Hat ARM); ii) eventually we might need to revisit this issue when a currently working system reaches the tipping point of CPU count (1000). For the first one, the results depend on the topology - if the sibling ranges are contiguous, even million CPUs should fit there. The _list files(core_siblings_list, thread_siblings_list) have ranges; the non _list (core_siblings, thread_siblings) files have mask like above. For the worst case, when every other cpu is a sibling, the second file is more space-efficient. I'm OK with using the same limit for both (8k seems sufficiently large), but I would like to know: Which one is the file that failed to parse in your case? /sys/devices/system/cpu/cpu*/topology/thread_siblings I think both virNodeCountThreadSiblings and virNodeGetSiblingsList could be rewritten to share some code and only look at one of the sysfs files. The question is - which one? Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] qemu_migration: Precreate missing storage breaks with network drives
Hi Michal, How can we move this along as a patch to libvirt? Can we submit a patch ourselves? -- Noel On Tue, Mar 24, 2015 at 10:21 AM, Noel Burton-Krahn n...@pistoncloud.com wrote: In our case the network disk is available on the dest before we call migration. It's an openstack volume mounted via ceph. If we disable the copy-check in qemu_migration.c the migration works fine. On Mon, Mar 23, 2015 at 12:17 AM, Michal Privoznik mpriv...@redhat.com wrote: On 20.03.2015 20:23, Noel Burton-Krahn wrote: Hi Michal, I think issuing a libvirt migrate to a host where the network disks don't already exist would be a prequisite failure. Libvirt can never copy a network disk, but it shouldn't fail trying to migrate an existing domain that contains a network disk. If a libvirt user wishes to migrate a domain that contains a network disk, it's their responsibility to ensure the disk exists before calling migrate. That's how it was back in the old days. Then libvirt introduced storage migration, but requiring users to pre-create storage on destination themselves. And just recently I taught libvirt to automatically pre-create the storage. However, not for all disk types. If a disk on destination is missing, it's likely broken guest ABI libvirt should have not allowed migration in the first place. How come the migration was allowed? Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] Parallels: implement domainAttachDeviceFlags
Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka aburl...@parallels.com --- src/parallels/parallels_driver.c | 45 ++ src/parallels/parallels_sdk.c| 30 + src/parallels/parallels_sdk.h|4 +++ 3 files changed, 79 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..87297cf 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,50 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom-conn-privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + +privdom = virDomainObjListFindByUUID(privconn-domains, dom-uuid); +if (dom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +dev = virDomainDeviceDefParse(xml, privdom-def, privconn-caps, + privconn-xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev-type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom-conn, privdom, dev-data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, + %s, + _(disk attach failed)); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _(device type '%s' cannot be detached), + virDomainDeviceTypeToString(dev-type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = Parallels, .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1082,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..bdfd487 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,36 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn-privateData; +PRL_HANDLE sdkdom = PRL_INVALID_HANDLE; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +sdkdom = prlsdkSdkDomainLookupByUUID(privconn, dom-def-uuid); +if (sdkdom == PRL_INVALID_HANDLE) +goto cleanup; + +job = PrlVm_BeginEdit(sdkdom); +if (PRL_FAILED(waitJob(job, privconn-jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn-jobTimeout))) +goto cleanup; +} + + cleanup: +PrlHandle_Free(sdkdom); +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@ int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def); int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def); int prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom); +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk); -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] Parallels: remove disk serial number check
OpenStack needs disk serial number setup because nova boot --block-device-mapping command generates that param in libvirt xml. I took QEMU libvirt driver behavior as a base. QEMU driver skips inability to set serial and continues work. So Parallels driver will ignore this param too and let domain boot. --- src/parallels/parallels_sdk.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index c36b772..fa5c44d 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2358,10 +2358,8 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) } if (disk-serial) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, - _(Setting disk serial number is not +VIR_INFO(%s, _(Setting disk serial number is not supported by parallels driver.)); -return -1; } if (disk-wwn) { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] maint: update to latest gnulib
On 02/25/2015 06:13 AM, Daniel P. Berrange wrote: On Wed, Feb 25, 2015 at 06:09:42AM -0700, Eric Blake wrote: On 02/25/2015 12:20 AM, Martin Kletzander wrote: On Tue, Feb 24, 2015 at 09:04:00AM -0700, Eric Blake wrote: On 02/24/2015 09:00 AM, Eric Blake wrote: Needed to silence a valgrind detection of uninitialized memory: https://bugzilla.redhat.com/show_bug.cgi?id=1174147 I've missed RC1, so I'll wait for a review on this one (are we sure that RC2 will be enough time to ensure the gnulib update doesn't cause regressions, basically). From the list of changes I don't see any compelling reason to push it before release. ie, we're not waiting for any particular bug fix it includes. We deferred for 1.2.13 because I had missed RC1. But I'm in time for 1.2.14, so I'm pushing this now under the gnulib-maintenance rule. Here's the final changeset to gnulib: * .gnulib c27f1a3...106a386 (90): quotearg-simple-tests: add missing gl_FUNC_MMAP_ANON dependency yesno: make EOL optional in ENABLE_NLS case also fdopendir-tests: test it does not close its arg gitlog-to-changelog: trim trailing white space gitlog-to-changelog: new option --ignore-matching fdopendir: port better to MinGW fdopendir: fix typo in comment error: document all entry points provided autoupdate autoupdate autoupdate vasnprintf: pacify clang 3.5.0 glob, etc.: port to MSVC v18 on MS-Windows 8.1 poll: port to MSVC v18 on MS-Windows 8.1 tests: support stderr verification with returns_() passfd: avoid valgrind uninitalised data warning uniwbrk/u32-wordbreaks-tests: fix copyright dup2: doc and test for Android bug Replace dup2() on Android Android doesn't define RLIM_SAVED_* autoupdate vasnprintf-posix-tests: use consistent test printf, isinf, etc.: noncanonical != NaN fts: remove redundant close() (trivial) getdtablesize: port better for Android poll: fixes for large fds fcntl: Fix cross compiling dup2, fcntl: cross-compiler better for Android getopt: give accurate ambiguity diagnostic on mem exhaustion getopt: don't crash on memory exhaustion tempname: allow compilation with C++ (trivial) dup2, fcntl: port to AIX getdtablesize, dup2, fcntl: port to Android localename: Implement gl_locale_name_thread_unsafe for Android More changelog fixes fts: avoid crash when a cycle is added while traversing uniname/uniname: support character alias Fix ChangeLog botches in my recent commits duplocale: Fix Android build of duplocale-tests signal_h: Fix Android build net_if: Handle content-free net/if.h system headers linkat_nofollow: Add fallback case for cross compiling euidaccess: Fix Android build getugroups: Fix Android build localename: Fix Android build getdtablesize: Fix Android build Assume unbroken ungetc() on Android Fix FILE struct compatibility with Android API level = 21 tests: avoid recent -Werror=unused-variable regression in test-locale maint: various whitespace cleanups in tempname tests: provide returns_() to simplify exit status checking mountlist: only use libmount when specified uniname/unimame-tests: don't link with -lunistring fstrcmp: don't assume strlen INT_MAX diffseq: prefer ptrdiff_t to ssize_t xalloc: fix typo that suppressed warnings full-read: fix license notice typo crypto/gc: fix a -Wswitch warning autoupdate update from texinfo tempname: new try_tempname function gnulib-tool: fix handling of patch(1) diagnostics bootstrap: exit immediately upon gnulib-tool failure symlinkat: include all required header files update from texinfo update from texinfo update from texinfo localename: support Solaris 12 and illumos locale: fix tests on illumos unictype: avoid undefined left-shift behavior libunistring: bump version of unitypes dependants unictype/category-none: fix link with libunistring unitypes: fix build with installed libunistring time: port to MinGW32 3.21 update-copyright: apply to self libunistring: update to Unicode 7.0.0 libunistring: update to Unicode 6.3.0 libunistring: update to Unicode 6.2.0 libunistring: update to Unicode 6.1.0 uniwbrk/u32-wordbreaks-tests: add conformance test uniwbrk: ignore Extended/Format characters at BOL test-strstr.c: avoid a trivial leak update-copyright: recognize groff's \(co marker maint.mk: fix compatibility with OS X nm localcharset: improve charset detection on OS/2 count-leading-zeros: use 64-bit intrinsics on 32-bit Windows count-leading-zeros: fix pragma typos autoupdate count-leading-zeros: avoid 64-bit intrinsics on 32-bit Windows uniname/uniname: update to Unicode 7.0.0 -- 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
Re: [libvirt] [PATCH 2/3] Parallels: implement domainAttachDeviceFlags
On 03/26/2015 08:51 PM, Alexander Burluka wrote: Parallels Cloud Server supports block devices and virtual NIC live attachment. I implemented that function for block devices so OpenStack volume attachment is now works. Signed-off-by: Alexander Burluka aburl...@parallels.com --- src/parallels/parallels_driver.c | 45 ++ src/parallels/parallels_sdk.c| 30 + src/parallels/parallels_sdk.h|4 +++ 3 files changed, 79 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index f5e58a8..87297cf 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1004,6 +1004,50 @@ parallelsDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) return 0; } +static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +int ret = -1; +parallelsConnPtr privconn = dom-conn-privateData; +virDomainDeviceDefPtr dev = NULL; +virDomainObjPtr privdom = NULL; + +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); qemu driver forbids updating stopped domain without flag VIR_DOMAIN_AFFECT_LIVE + +privdom = virDomainObjListFindByUUID(privconn-domains, dom-uuid); +if (dom == NULL) { +parallelsDomNotFoundError(dom); +goto cleanup; +} + +dev = virDomainDeviceDefParse(xml, privdom-def, privconn-caps, + privconn-xmlopt, VIR_DOMAIN_XML_INACTIVE); +if (dev == NULL) +goto cleanup; + +switch (dev-type) { +case VIR_DOMAIN_DEVICE_DISK: +ret = prlsdkAttachVolume(dom-conn, privdom, dev-data.disk); +if (ret) { +virReportError(VIR_ERR_INTERNAL_ERROR, + %s, + _(disk attach failed)); +goto cleanup; +} +break; +default: +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _(device type '%s' cannot be detached), + virDomainDeviceTypeToString(dev-type)); +break; +} + +ret = 0; + cleanup: +return ret; +} + static virHypervisorDriver parallelsDriver = { .name = Parallels, .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1038,6 +1082,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ .connectDomainEventDeregisterAny = parallelsConnectDomainEventDeregisterAny, /* 1.2.10 */ diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fa5c44d..bdfd487 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2890,6 +2890,36 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootD return ret; } +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk) +{ +int ret = -1; +parallelsConnPtr privconn = conn-privateData; +PRL_HANDLE sdkdom = PRL_INVALID_HANDLE; +PRL_HANDLE job = PRL_INVALID_HANDLE; + +sdkdom = prlsdkSdkDomainLookupByUUID(privconn, dom-def-uuid); +if (sdkdom == PRL_INVALID_HANDLE) +goto cleanup; SDK handle is stored in virDomainObj, you can get pointer to parallelsDomObjPtr: parallelsDomObjPtr privdom = dom-privateData; and then use privdom-sdkdom + +job = PrlVm_BeginEdit(sdkdom); +if (PRL_FAILED(waitJob(job, privconn-jobTimeout))) +goto cleanup; + +ret = prlsdkAddDisk(sdkdom, disk, false); +if (ret == 0) { +job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); +if (PRL_FAILED(waitJob(job, privconn-jobTimeout))) +goto cleanup; +} + + cleanup: +PrlHandle_Free(sdkdom); +return ret; +} + static int prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) { diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h index 694c19b..d68cada 100644 --- a/src/parallels/parallels_sdk.h +++ b/src/parallels/parallels_sdk.h @@ -53,3 +53,7 @@ int prlsdkCreateVm(virConnectPtr conn, virDomainDefPtr def); int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def); int prlsdkUnregisterDomain(parallelsConnPtr privconn, virDomainObjPtr dom); +int +prlsdkAttachVolume(virConnectPtr conn, + virDomainObjPtr dom, + virDomainDiskDefPtr disk); -- Dmitry Guryanov -- libvir-list mailing list
Re: [libvirt] [PATCH] qemu: Give hint about -noTSX CPU model
On Wed, Mar 25, 2015 at 10:37:46 -0600, Eric Blake wrote: On 03/24/2015 07:20 AM, Jiri Denemark wrote: Because of the microcode update to Haswell/Broadwell CPUs, existing domains using these CPUs may fail to start even though they used to run just fine. To help users solve this issue we try to suggest switching to -noTSX variant of the CPU model: virsh # start cd error: Failed to start domain cd error: unsupported configuration: guest and host CPU are not compatible: Host CPU does not provide required features: rtm, hle; try using 'Haswell-noTSX' CPU model Definitely worth this hint, as a lot of people are being bitten by it according to bugzilla traffic. Signed-off-by: Jiri Denemark jdene...@redhat.com --- This patch depends on the previous patch which introduces the new *-noTSX models. src/qemu/qemu_command.c | 38 +- 1 file changed, 33 insertions(+), 5 deletions(-) ACK. Thanks, I pushed this and the previous patch. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] Parallels: remove disk serial number check
On 03/26/2015 08:51 PM, Alexander Burluka wrote: OpenStack needs disk serial number setup because nova boot --block-device-mapping command generates that param in libvirt xml. I took QEMU libvirt driver behavior as a base. QEMU driver skips inability to set serial and continues work. So Parallels driver will ignore this param too and let domain boot. --- src/parallels/parallels_sdk.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index c36b772..fa5c44d 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2358,10 +2358,8 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) } if (disk-serial) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, - _(Setting disk serial number is not +VIR_INFO(%s, _(Setting disk serial number is not supported by parallels driver.)); -return -1; } if (disk-wwn) { ACK -- Dmitry Guryanov -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] util: replace body of virNetDevMacVLanDelete() with virNetlinkDelLink()
On 03/24/2015 06:25 PM, John Ferlan wrote: On 03/23/2015 03:43 PM, Laine Stump wrote: These two functions are identical, so no sense in having the duplication. I resisted the temptation to replace calls to virNetDevMacVLanDelete() with calls to virNetlinkDelLink() just in case some mythical future platform has macvtap devices that aren't managed with netlink (or in case we some day need to do more than just tell the kernel to delete the device). --- src/util/virnetdevmacvlan.c | 67 ++--- 1 file changed, 2 insertions(+), 65 deletions(-) hmm interesting... Started reading the next patch and noticed something... Perhaps I was quick on the trigger finger for this one... This module was compiled with if WITH_MACVTAP, but the API being replaced/called uses #if defined(__linux__) defined(HAVE_LIBNL) thus this module never cared about linux HAVE_LIBNL, but now depends on an API that does. My reading comprehension of the Makefile in order to determine whether anything matters is limited... Of course this module has libnl calls in it already so perhaps either WITH_MACVTAP implies __linux__ and HAVE_LIBNL or perhaps that something that needs to be adjusted. configure assures that HAVE_LIBNL is true if --with-macvtap is requested, so it's not possible to have WITH_MACVTAP without HAVE_LIBNL. As for __linux__, I'm not even sure why that got in to begin with. I don't know that libnl (or netlink) is available on anything that isn't Linux. Definitely macvtap isn't on anything non-Linux though, so I'd say we're safe there as well. Not my specialty! but thankfully you weren't afraid to review it anyway. Thanks! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/4] util: use netlink to create bridge devices
On 03/24/2015 06:39 PM, John Ferlan wrote: On 03/23/2015 03:43 PM, Laine Stump wrote: Just as it is possible to delete a bridge device with the netlink RTM_DELLINK message, one can be created with the RTM_NEWLINK message. Because of differences in the format of the message, it's not as straightforward as with virNetlinkDelLink() to create a single utility function that can be used to create any type of interface, so the new netlink version of virNetDevBridgeCreate() does its own construction of the netlink message and calls virNetlinkCommand() itself. This doesn't provide any extra functionality, just provides symmetry with the previous commit. NB: We *could* alter the API of virNetDevBridgeCreate() to take a MAC address, and directly program that mac address into the bridge (by adding an IFLA_ADDRESS attribute, as is done in virNetDevMacVLanCreate()) rather than separately creating the dummy tap (e.g. virbr0-nic) to maintain a fixed mac address on the bridge, but the commit history of virnetdevbridge.c shows that the presence of this dummy tap is essential in some older versions of the kernel (between 2.6.39 and 3.1 or 3.2, possibly?) to proper operation of IPv6 DAD, and I don't want to take the chance of breaking something that I don't have the time/setup to test (my RHEL6 box is at kernel 2.6.32-544, and the next lowest kernel I have is 3.17) --- src/util/virnetdevbridge.c | 78 +- 1 file changed, 77 insertions(+), 1 deletion(-) What's here seems reasonable - I don't have history on my side to answer the older versions of the kernel query... One other difference between this and virNetDevMacVLanCreate is the error path that handles *retry if the name is already in use... Hmm. Interesting idea, but it wouldn't be useful with the current way that things work - unlike macvtap devices, which are created one per domain-interface and whose name we don't care about, by the time we get to the point that we want to create a bridge device (which is one for each network), we've already committed to the name we're going to use. Some restructuring of network startup could make that useful though. Still, I think I'll push this as it is for now (since it meets the current usage demands, and maintains the existing API for virNetDevBridgeCreate()) and think about building in EEXIST handling later (this could be especially problematic, since the same capability would need to be put into the other two implementations of virNetDevBridgeCreate(), and one of those is for a platform that I don't have setup to test on). Thanks for the reviews! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] interface: allow multiple IPv4 addresses in interface XML
An upcoming netcf release will support multiple ipv4 addresses, so let's loosen up libvirt's interface.rng to allow it. --- docs/schemas/interface.rng | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng index bf0346c..45b40cd 100644 --- a/docs/schemas/interface.rng +++ b/docs/schemas/interface.rng @@ -326,12 +326,14 @@ choice ref name=dhcp-element/ group -element name=ip - attribute name=addressref name=ipv4Addr//attribute - optional -attribute name=prefixref name=ipv4Prefix//attribute - /optional -/element +oneOrMore + element name=ip +attribute name=addressref name=ipv4Addr//attribute +optional + attribute name=prefixref name=ipv4Prefix//attribute +/optional + /element +/oneOrMore optional element name=route attribute name=gatewayref name=ipv4Addr//attribute -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/7] storage: Remove unused attribute conn from 'checkPool' callback
On Wed, Mar 25, 2015 at 12:19:18 -0400, John Ferlan wrote: On 03/24/2015 06:06 AM, Erik Skultety wrote: The checkPool callback should be used when updating states of all pools during storageStateInitialize, not storageDriverAutostart, otherwise we can't start a domain which mounts a volume after daemons restarted. This is because qemuProcessReconnect is called earlier than storageDriverAutostart which marks the pool as active, so that the domain can mount a volume from this pool successfully. In order to fix this, conn attribute has to be discarded from the callback, because storageStateInitialize doesn't have a connection yet. (it's not used anyway) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177733 This patch definitely does not resolve this^^. --- src/storage/storage_backend.h | 3 +-- src/storage/storage_backend_fs.c | 3 +-- src/storage/storage_backend_iscsi.c | 3 +-- src/storage/storage_backend_logical.c | 3 +-- src/storage/storage_backend_mpath.c | 3 +-- src/storage/storage_backend_scsi.c| 3 +-- src/storage/storage_backend_zfs.c | 3 +-- src/storage/storage_driver.c | 2 +- 8 files changed, 8 insertions(+), 15 deletions(-) I'm not convinced we can remove 'conn'. Something about backend or backward compatibility. Since it's not used by any backend anyway, there's (more or less) no harm in keeping it. The storage driver backend APIs are internal so it's okay to change Additionally I recall that it will simplify some of the further patches. ACK Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] Parallels: implemented domainAttachDevice
On 03/26/2015 08:51 PM, Alexander Burluka wrote: That function uses domainAttachDeviceFlags Signed-off-by: Alexander Burluka aburl...@parallels.com --- src/parallels/parallels_driver.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 87297cf..2a2c0fa 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1048,6 +1048,12 @@ static int parallelsDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, return ret; } +static int parallelsDomainAttachDevice(virDomainPtr dom, const char *xml) +{ +return parallelsDomainAttachDeviceFlags(dom, xml, +VIR_DOMAIN_AFFECT_LIVE); +} + static virHypervisorDriver parallelsDriver = { .name = Parallels, .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1082,6 +1088,7 @@ static virHypervisorDriver parallelsDriver = { .domainDefineXMLFlags = parallelsDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine = parallelsDomainUndefine, /* 1.2.10 */ .domainUndefineFlags = parallelsDomainUndefineFlags, /* 1.2.10 */ +.domainAttachDevice = parallelsDomainAttachDevice, /* 1.2.15 */ .domainAttachDeviceFlags = parallelsDomainAttachDeviceFlags, /* 1.2.15 */ .domainIsActive = parallelsDomainIsActive, /* 1.2.10 */ .connectDomainEventRegisterAny = parallelsConnectDomainEventRegisterAny, /* 1.2.10 */ ACK -- Dmitry Guryanov -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: Fix memory leak if pthread_create fails.
Konrad Rzeszutek Wilk wrote: If we fail to create the thread we leak the shutdown_info structure. Nice catch, thanks! ACK and pushed. Regards, Jim Signed-off-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com --- src/libxl/libxl_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 774b070..0ac5c62 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -482,7 +482,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) libxlDriverPrivatePtr driver = data; virDomainObjPtr vm = NULL; libxl_shutdown_reason xl_reason = event-u.domain_shutdown.shutdown_reason; -struct libxlShutdownThreadInfo *shutdown_info; +struct libxlShutdownThreadInfo *shutdown_info = NULL; virThread thread; libxlDriverConfigPtr cfg; @@ -535,6 +535,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) virObjectUnref(cfg); if (vm) virObjectUnlock(vm); +VIR_FREE(shutdown_info); } void -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH 2/2] Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
On Thu, Mar 26, 2015 at 11:37:28 -0400, John Ferlan wrote: On 03/26/2015 08:43 AM, Ján Tomko wrote: --- generator.py | 4 ++-- libvirt-override-api.xml | 2 +- libvirt-override.c | 10 +- sanitytest.py| 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generator.py b/generator.py index 05ccbc8..729daa2 100755 --- a/generator.py +++ b/generator.py @@ -435,7 +435,7 @@ skip_impl = ( 'virDomainGetVcpuPinInfo', 'virDomainGetEmulatorPinInfo', 'virDomainPinEmulator', -'virDomainGetIOThreadsInfo', +'virDomainGetIOThreadInfo', 'virDomainPinIOThread', 'virSecretGetValue', 'virSecretSetValue', @@ -1147,7 +1147,7 @@ def nameFixup(name, classe, type, file): elif name[0:20] == virDomainGetCPUStats: func = name[9:] func = func[0:1].lower() + func[1:] -elif name[0:25] == virDomainGetIOThreadsInfo: +elif name[0:24] == virDomainGetIOThreadInfo: func = name[12:] func = func[0:2].lower() + func[2:] elif name[0:18] == virDomainGetFSInfo: diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 4660c9f..cf46090 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -278,7 +278,7 @@ arg name='cpumap' type='unsigned char *' info='pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.'/ arg name='flags' type='int' info='flags to specify'/ /function -function name='virDomainGetIOThreadsInfo' file='python' +function name='virDomainGetIOThreadInfo' file='python' infoQuery the CPU affinity setting of the IOThreads of the domain/info arg name='domain' type='virDomainPtr' info='pointer to domain object, or NULL for Domain0'/ arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ diff --git a/libvirt-override.c b/libvirt-override.c index 9a72f87..0699ae3 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -1992,8 +1992,8 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self ATTRIBUTE_UNUSED, #if LIBVIR_CHECK_VERSION(1, 2, 14) static PyObject * -libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args) +libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { virDomainPtr domain; PyObject *pyobj_domain; @@ -2004,7 +2004,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, size_t pcpu, i; int niothreads, cpunum; -if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadsInfo, +if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadInfo, pyobj_domain, flags)) return NULL; domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); @@ -2013,7 +2013,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_NONE; LIBVIRT_BEGIN_ALLOW_THREADS; -niothreads = virDomainGetIOThreadsInfo(domain, iothrinfo, flags); +niothreads = virDomainGetIOThreadInfo(domain, iothrinfo, flags); LIBVIRT_END_ALLOW_THREADS; if (niothreads 0) { If you've added the CPU Time it needs to be handled here too John @@ -8640,7 +8640,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) virDomainPinEmulator, libvirt_virDomainPinEmulator, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ #if LIBVIR_CHECK_VERSION(1, 2, 14) -{(char *) virDomainGetIOThreadsInfo, libvirt_virDomainGetIOThreadsInfo, METH_VARARGS, NULL}, +{(char *) virDomainGetIOThreadInfo, libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL}, {(char *) virDomainPinIOThread, libvirt_virDomainPinIOThread, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ {(char *) virConnectListStoragePools, libvirt_virConnectListStoragePools, METH_VARARGS, NULL}, diff --git a/sanitytest.py b/sanitytest.py index cff9811..aafc487 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -279,8 +279,8 @@ for name in sorted(basicklassmap): func = nwfilter + func[8:] if func[0:8] == fSFreeze or func[0:6] == fSThaw or func[0:6] == fSInfo: func = fs + func[2:] -if func[0:13] == iOThreadsInfo: -func = ioThreadsInfo +if func[0:13] == iOThreadInfo: s/13/12 Actually, why don't we use something like func.startswith(iOThreadInfo) everywhere instead of this fragile [0:n] approach? Are we targeting some old versions of python which did not support that (I don't know if such versions even exist,
Re: [libvirt] [Xen-devel] [PATCH 2/3] libxl: acquire a job when destroying a domain
Konrad Rzeszutek Wilk wrote: On Wed, Mar 25, 2015 at 02:08:35PM -0600, Jim Fehlig wrote: A job should be acquired at the beginning of a domain destroy operation, not at the end when cleaning up the domain. Fix two occurances of this late job acquisition in the libxl driver. Doing so renders libxlDomainCleanup unused, so it is removed. Just noticed this should be libxlDomainCleanupJob. Signed-off-by: Jim Fehlig jfeh...@suse.com --- src/libxl/libxl_domain.c | 49 +--- src/libxl/libxl_domain.h | 4 src/libxl/libxl_driver.c | 20 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index eca1ff0..e240eae 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -371,6 +371,9 @@ libxlDomainShutdownThread(void *opaque) cfg = libxlDriverConfigGet(driver); +if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) 0) +goto cleanup; + Won't this a deadlock with 'libxlDomainAutoCoreDump' (line 410) (which also calls : 727 if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) 0) 728 goto cleanup; well, not deadlock - but spin up to 30 seconds? and then give up? Yes, another good catch! Perhaps this patch should be folded in? From 9f2bac0c28815fc51850290c4b1962881691bfca Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk konrad.w...@oracle.com Date: Wed, 25 Mar 2015 22:34:51 -0400 Subject: [PATCH] squash --- src/libxl/libxl_domain.c | 4 1 file changed, 4 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index aef0157..774b070 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -723,15 +723,11 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver, timestr) 0) goto cleanup; -if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) 0) -goto cleanup; - /* Unlock virDomainObj while dumping core */ virObjectUnlock(vm); libxl_domain_core_dump(cfg-ctx, vm-def-id, dumpfile, NULL); virObjectLock(vm); -ignore_value(libxlDomainObjEndJob(driver, vm)); I've squashed this in my branch and fixed the commit message typo. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] relaxng: allow : in /dev/disk/by-path names
On 03/26/2015 05:11 PM, Jiri Denemark wrote: On Thu, Mar 26, 2015 at 16:58:46 -0600, Eric Blake wrote: On IRC, Hydrar pointed a problem where 'virsh edit' failed on his domain created through an ISCSI pool managed by virt-manager, all because the XML included a block device with colons in the name. * docs/schemas/basictypes.rng (absFilePath): Add colon as safe. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml: New file. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args: Likewise. * tests/qemuxml2argvtest.c (mymain): Test it. Signed-off-by: Eric Blake ebl...@redhat.com --- docs/schemas/basictypes.rng| 2 +- .../qemuxml2argvdata/qemuxml2argv-disk-iscsi.args | 7 ++ tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml | 28 ++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml Hmm, I'm lucky I don't change XMLs of my iSCSI-backed domains. Otherwise I would have been beaten by this bug too. ACK Pushed 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] [Xen-devel] [PATCH 3/3] libxl: drop virDomainObj lock when destroying a domain
Ian Campbell wrote: On Wed, 2015-03-25 at 14:08 -0600, Jim Fehlig wrote: A destroy operation can take considerable time on large memory domains due to scrubbing the domain' memory. The operation is running in the context of a job, so unlocking the domain and allowing query operations is safe. Signed-off-by: Jim Fehlig jfeh...@suse.com I don't really know enough about the libvirt job/obj locking to comment on the previous patches or that aspect of this one, but in general the idea of dropping the lock before calling libxl_destroy seems reasonable to me. In principal you could use the async stuff (the final NULL to the call), but you'd still be wanting to drop the lock for that period, so it's not clear it's any better from your PoV. I tried the async approach as well, but in the end decided it was no better. In case you're interested, I pushed the async variant to libxl-dom-destroy-async branch in my github fork https://github.com/jfehlig/libvirt Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] relaxng: allow : in /dev/disk/by-path names
On IRC, Hydrar pointed a problem where 'virsh edit' failed on his domain created through an ISCSI pool managed by virt-manager, all because the XML included a block device with colons in the name. * docs/schemas/basictypes.rng (absFilePath): Add colon as safe. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml: New file. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args: Likewise. * tests/qemuxml2argvtest.c (mymain): Test it. Signed-off-by: Eric Blake ebl...@redhat.com --- docs/schemas/basictypes.rng| 2 +- .../qemuxml2argvdata/qemuxml2argv-disk-iscsi.args | 7 ++ tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml | 28 ++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 0cd1c4e..f086ad2 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -242,7 +242,7 @@ define name=absFilePath data type=string - param name=pattern/[a-zA-Z0-9_\.\+\-\\amp;quot;apos;lt;gt;/%,]+/param + param name=pattern/[a-zA-Z0-9_\.\+\-\\amp;quot;apos;lt;gt;/%,:]+/param /data /define diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args new file mode 100644 index 000..b987a38 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args @@ -0,0 +1,7 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M \ +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi -boot c -usb \ +-hda /dev/disk/by-path/ip-192.168.44.1:3260-iscsi-iqn.2011-02.lan.hdserver\ +:hydrar-desktop.win7vm-lun-0 -net none \ +-serial none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml new file mode 100644 index 000..e4d9c97 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml @@ -0,0 +1,28 @@ +domain type='qemu' + nameQEMUGuest1/name + uuidc7a5fdbd-edaf-9455-926a-d65c16db1809/uuid + memory unit='KiB'219100/memory + currentMemory unit='KiB'219100/currentMemory + vcpu placement='static'1/vcpu + os +type arch='i686' machine='pc'hvm/type +boot dev='hd'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashdestroy/on_crash + devices +emulator/usr/bin/qemu/emulator +disk type='block' device='disk' + driver name='qemu' type='raw'/ + source dev='/dev/disk/by-path/ip-192.168.44.1:3260-iscsi-iqn.2011-02.lan.hdserver:hydrar-desktop.win7vm-lun-0'/ + target dev='hda' bus='ide'/ + address type='drive' controller='0' bus='0' target='0' unit='0'/ +/disk +controller type='usb' index='0'/ +controller type='ide' index='0'/ +controller type='pci' index='0' model='pci-root'/ +memballoon model='none'/ + /devices +/domain diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3c2fbf1..57ef053 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -708,6 +708,7 @@ mymain(void) DO_TEST(hugepages-pages6, NONE); DO_TEST(nosharepages, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE); DO_TEST(disk-cdrom, NONE); +DO_TEST(disk-iscsi, NONE); DO_TEST(disk-cdrom-network-http, QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE); DO_TEST(disk-cdrom-network-https, QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] relaxng: allow : in /dev/disk/by-path names
On Thu, Mar 26, 2015 at 16:58:46 -0600, Eric Blake wrote: On IRC, Hydrar pointed a problem where 'virsh edit' failed on his domain created through an ISCSI pool managed by virt-manager, all because the XML included a block device with colons in the name. * docs/schemas/basictypes.rng (absFilePath): Add colon as safe. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml: New file. * tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args: Likewise. * tests/qemuxml2argvtest.c (mymain): Test it. Signed-off-by: Eric Blake ebl...@redhat.com --- docs/schemas/basictypes.rng| 2 +- .../qemuxml2argvdata/qemuxml2argv-disk-iscsi.args | 7 ++ tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml | 28 ++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-iscsi.xml Hmm, I'm lucky I don't change XMLs of my iSCSI-backed domains. Otherwise I would have been beaten by this bug too. ACK Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: fix cannot start a vm with memory device with address
When start a vm which have a memory device with address, the error like this : error: Failed to start domain test3 error: internal error: early end of file from monitor: possible problem: 2015-03-26T03:45:52.338891Z qemu-kvm: -device pc-dimm,node=0,memdev=memdimm0, id=dimm0,slot=0,base=4294967296: Property '.base' not found After check the qemu code i think this 'base' should named as 'addr', you can see this mail: http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00129.html Or check the include/hw/mem/pc-dimm.h in qemu source. Also add a tests for this. Signed-off-by: Luyao Huang lhu...@redhat.com --- I didn't change this parameter's name ('base'), because i am not sure if there is some special mean in it, or it is a result after discuss. src/qemu/qemu_command.c| 2 +- .../qemuxml2argv-memory-hotplug-dimm-addr.args | 9 + .../qemuxml2argv-memory-hotplug-dimm-addr.xml | 45 ++ tests/qemuxml2argvtest.c | 2 + 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 04c8df7..2941e7d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4909,7 +4909,7 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem, if (mem-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) { virBufferAsprintf(buf, ,slot=%d, mem-info.addr.dimm.slot); -virBufferAsprintf(buf, ,base=%llu, mem-info.addr.dimm.base); +virBufferAsprintf(buf, ,addr=%llu, mem-info.addr.dimm.base); } break; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args new file mode 100644 index 000..7c59454 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args @@ -0,0 +1,9 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m size=219136k,slots=16,maxmem=1099511627776k -smp 2 \ +-numa node,nodeid=0,cpus=0-1,mem=214 \ +-object memory-backend-ram,id=memdimm0,size=536870912,host-nodes=1-3,\ +policy=bind \ +-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \ +-nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml new file mode 100644 index 000..2e302c4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml @@ -0,0 +1,45 @@ +domain type='qemu' + nameQEMUGuest1/name + uuidc7a5fdbd-edaf-9455-926a-d65c16db1809/uuid + maxMemory slots='16' unit='KiB'1099511627776/maxMemory + memory unit='KiB'743423/memory + currentMemory unit='KiB'743423/currentMemory + vcpu placement='static' cpuset='0-1'2/vcpu + os +type arch='i686' machine='pc'hvm/type +boot dev='hd'/ + /os + cpu +topology sockets='2' cores='1' threads='1'/ +numa + cell id='0' cpus='0-1' memory='219136' unit='KiB'/ +/numa + /cpu + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashdestroy/on_crash + devices +emulator/usr/bin/qemu/emulator +disk type='block' device='disk' + source dev='/dev/HostVG/QEMUGuest1'/ + target dev='hda' bus='ide'/ + address type='drive' controller='0' bus='0' target='0' unit='0'/ +/disk +controller type='ide' index='0'/ +controller type='usb' index='0'/ +controller type='pci' index='0' model='pci-root'/ +memballoon model='virtio'/ +memory model='dimm' + source +nodemask1-3/nodemask +pagesize unit='KiB'4096/pagesize + /source + target +size unit='KiB'524287/size +node0/node + /target + address type='dimm' slot='0' base='0x1'/ +/memory + /devices +/domain diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 08f374e..a4cb887 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1548,6 +1548,8 @@ mymain(void) DO_TEST(memory-hotplug, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA); DO_TEST(memory-hotplug-dimm, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM); +DO_TEST(memory-hotplug-dimm-addr, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA, +QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM); virObjectUnref(driver.config); virObjectUnref(driver.caps); -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-test-API][PATCH 2/2] Add cases to basic_network.conf
ACK and Pushed Thanks Hongming On 02/15/2015 03:02 PM, Jincheng Miao wrote: Signed-off-by: Jincheng Miao jm...@redhat.com --- cases/basic_network.conf | 24 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/cases/basic_network.conf b/cases/basic_network.conf index e9abd57..18997a2 100644 --- a/cases/basic_network.conf +++ b/cases/basic_network.conf @@ -216,3 +216,27 @@ network:destroy networkname $defaultnetname +network:event_callback +networkname +$defaultnetname +action +define + +network:event_callback +networkname +$defaultnetname +action +start + +network:event_callback +networkname +$defaultnetname +action +destroy + +network:event_callback +networkname +$defaultnetname +action +undefine + -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix common misspellings
On Wed, Mar 25, 2015 at 10:44:53AM -0600, Eric Blake wrote: On 03/23/2015 02:46 AM, Martin Kletzander wrote: - In exceptional circumstances longer initial embargos may be + In exceptional circumstances longer initial embargoes may be This one is ambiguous (I've seen both spellings; zeros/zeroes is another such word), but Thunderbird's US spell-check dictionary prefers embargoes, so go for it. My en_GB.utf8 ispell only allows embargoes. What is your opinion on dependant and similar words I've left out? dependant is flagged as wrong in US dictionary (only valid in UK dictionary, and even then, it has only the financial sense and not the inter-relatedness sense that we are more prone to be wanting throughout code). There is no word 'independant' in either variant. So another patch to s/\(\(in\)\?depen\)dant/\1dent/ would be correct. Thanks for the explanation. I used it in the commit message for such patch. And s/dependan/dependen/ was enough, plus it revelaed 'dependancies' as well. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org pgpvrP7Bt7MP2.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] qemu: command: Check for empty network source when formatting drive cmd
On Wed, Mar 25, 2015 at 10:39:05 -0600, Eric Blake wrote: On 03/24/2015 09:24 AM, Peter Krempa wrote: Use the virStorageSourceIsEmpty helper to determine whether the drive source is empty rather than checking for src-path. This will fix start of VM with empty network cdrom that would not report any error. --- src/qemu/qemu_command.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) ACK. Both patches are pushed now. Thanks. Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] fix 2 bugs in virHostdevReAttachPCIDevices
Fix 1: Fix index error in loop after remove an element from the array 'virPCIDeviceList' is actually an array. Removing one element makes the rest of the element move. Use while loop, increase index only when not do 'virPCIDeviceListDel(pcidevs, dev)' Fix 2: In such a case: 1. Domain A and B xml contain the same SRIOV net hostdev(interface type='hostdev' / with same pci address). 2. virsh start A (Successfully, and configure the SRIOV net with custom mac) 3. virsh start B (Fail because of the hostdev used by domain A or other reason.) In step 3, 'virHostdevNetConfigRestore' is called for the hostdev which is still used by domain A. It makes the mac/vlan of the SRIOV net change. Code Change in this fix: 1. As the pci used by other domain have been removed from 'pcidevs' in previous loop, we only restore the nic config for the hostdev still in 'pcidevs'(used by this domain) 2. wrap a function 'virHostdevIsPCINetDevice', which detect whether the hostdev is a pci net device or not. 3. update the comments to make it more clear Huanle Han (2): hostdev: Fix index error in loop after remove an element hostdev: fix net config restore error src/util/virhostdev.c | 56 --- 1 file changed, 40 insertions(+), 16 deletions(-) -- 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] hostdev: Fix index error in loop after remove an element
'virPCIDeviceList' is actually an array. Removing one element makes the rest of the element move. Use while loop, increase index only when not virPCIDeviceListDel(pcidevs, dev) Signed-off-by: Huanle Han hanxue...@gmail.com --- src/util/virhostdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 23365a3..83f567d 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -785,7 +785,8 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, * them and reset all the devices before re-attach. * Attach mac and port profile parameters to devices */ -for (i = 0; i virPCIDeviceListCount(pcidevs); i++) { +i = 0; +while (i virPCIDeviceListCount(pcidevs)) { virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i); virPCIDevicePtr activeDev = NULL; @@ -806,6 +807,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, } virPCIDeviceListDel(hostdev_mgr-activePCIHostdevs, dev); +i++; } /* At this point, any device that had been used by the guest is in -- 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] hostdev: fix net config restore error
Fix for such a case: 1. Domain A and B xml contain the same SRIOV net hostdev(interface type='hostdev' / with same pci address). 2. virsh start A (Successfully, and configure the SRIOV net with custom mac) 3. virsh start B (Fail because of the hostdev used by domain A or other reason.) In step 3, 'virHostdevNetConfigRestore' is called for the hostdev which is still used by domain A. It makes the mac/vlan of the SRIOV net change. Code Change in this fix: 1. As the pci used by other domain have been removed from 'pcidevs' in previous loop, we only restore the nic config for the hostdev still in 'pcidevs'(used by this domain) 2. wrap a function 'virHostdevIsPCINetDevice', which detect whether the hostdev is a pci net device or not. 3. update the comments to make it more clear Signed-off-by: Huanle Han hanxue...@gmail.com --- src/util/virhostdev.c | 52 --- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 83f567d..b04bae2 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -350,6 +350,14 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev, return ret; } +static int +virHostdevIsPCINetDevice(virDomainHostdevDefPtr hostdev) +{ +return hostdev-mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS +hostdev-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI +hostdev-parent.type == VIR_DOMAIN_DEVICE_NET +hostdev-parent.data.net; +} static int virHostdevNetConfigVirtPortProfile(const char *linkdev, int vf, @@ -481,10 +489,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, /* This is only needed for PCI devices that have been defined * using interface type='hostdev'. For all others, it is a NOP. */ -if (hostdev-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || -hostdev-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI || -hostdev-parent.type != VIR_DOMAIN_DEVICE_NET || -!hostdev-parent.data.net) +if (!virHostdevIsPCINetDevice(hostdev)) return 0; isvf = virHostdevIsVirtualFunction(hostdev); @@ -781,19 +786,20 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, goto cleanup; } -/* Again 4 loops; mark all devices as inactive before reset +/* Here are 4 loops; mark all devices as inactive before reset * them and reset all the devices before re-attach. * Attach mac and port profile parameters to devices */ + +/* Loop 1: delete the copy of the dev from pcidevs if it's used by + * other domain. Or delete it from activePCIHostDevs if it had + * been used by this domain. + */ i = 0; while (i virPCIDeviceListCount(pcidevs)) { virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i); virPCIDevicePtr activeDev = NULL; -/* delete the copy of the dev from pcidevs if it's used by - * other domain. Or delete it from activePCIHostDevs if it had - * been used by this domain. - */ activeDev = virPCIDeviceListFind(hostdev_mgr-activePCIHostdevs, dev); if (activeDev) { const char *usedby_drvname; @@ -814,14 +820,27 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, * pcidevs, but has been removed from activePCIHostdevs. */ -/* - * For SRIOV net host devices, unset mac and port profile before - * reset and reattach device +/* Loop 2: before reset and reattach device, + * unset mac and port profile for SRIOV net host devices used by this domain */ -for (i = 0; i nhostdevs; i++) -virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr-stateDir, - oldStateDir); +for (i = 0; i nhostdevs; i++) { +virDomainHostdevDefPtr hostdev = hostdevs[i]; +if (virHostdevIsPCINetDevice(hostdev)) { +virDomainHostdevSubsysPCIPtr pcisrc = hostdev-source.subsys.u.pci; +virPCIDevicePtr dev = NULL; +dev = virPCIDeviceNew(pcisrc-addr.domain, pcisrc-addr.bus, + pcisrc-addr.slot, pcisrc-addr.function); + +if (virPCIDeviceListFind(pcidevs, dev)) { +virHostdevNetConfigRestore(hostdev, hostdev_mgr-stateDir, + oldStateDir); +} +virPCIDeviceFree(dev); +} +} + +/* Loop 3: reset pci device used by this domain */ for (i = 0; i virPCIDeviceListCount(pcidevs); i++) { virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i); @@ -834,6 +853,9 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, } } +/* Loop 4: reattach pci devices used by this domain + * and steal all the devices from pcidevs + */ while (virPCIDeviceListCount(pcidevs) 0) { virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs,
[libvirt] [PATCH 2/2] Rewrite vshPrintPinInfo
Use virBitmapDataToString instead of constructing the ranges bit by bit, remove the checking of parameters (that is already done by the callers). Let the callers choose the right bitmap, since there's only one that uses this helper on a matrix-in-an-array. --- tools/virsh-domain.c | 41 ++--- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 9e8d9d1..4805584 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6322,36 +6322,15 @@ static const vshCmdOptDef opts_vcpupin[] = { * Helper function to print vcpupin info. */ static bool -vshPrintPinInfo(unsigned char *cpumaps, size_t cpumaplen, -int maxcpu, int vcpuindex) +vshPrintPinInfo(unsigned char *cpumap, size_t cpumaplen) { -int cpu, lastcpu; -bool bit, lastbit, isInvert; +char *str = NULL; -if (!cpumaps || cpumaplen = 0 || maxcpu = 0 || vcpuindex 0) +if (!(str = virBitmapDataToString(cpumap, cpumaplen))) return false; -bit = lastbit = isInvert = false; -lastcpu = -1; - -for (cpu = 0; cpu maxcpu; cpu++) { -bit = VIR_CPU_USABLE(cpumaps, cpumaplen, vcpuindex, cpu); - -isInvert = (bit ^ lastbit); -if (bit isInvert) { -if (lastcpu == -1) -vshPrint(ctl, %d, cpu); -else -vshPrint(ctl, ,%d, cpu); -lastcpu = cpu; -} -if (!bit isInvert lastcpu != cpu - 1) -vshPrint(ctl, -%d, cpu - 1); -lastbit = bit; -} -if (bit !isInvert) -vshPrint(ctl, -%d, maxcpu - 1); - +vshPrint(ctl, %s, str); +VIR_FREE(str); return true; } @@ -6526,7 +6505,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) continue; vshPrint(ctl, %4zu: , i); -ret = vshPrintPinInfo(cpumap, cpumaplen, maxcpu, i); +ret = vshPrintPinInfo(VIR_GET_CPUMAP(cpumap, cpumaplen, i), + cpumaplen); vshPrint(ctl, \n); if (!ret) break; @@ -6643,12 +6623,12 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd) flags = VIR_DOMAIN_AFFECT_CURRENT; cpumaps = vshMalloc(ctl, cpumaplen); -if (virDomainGetEmulatorPinInfo(dom, cpumaps, +if (virDomainGetEmulatorPinInfo(dom, cpumap, cpumaplen, flags) = 0) { vshPrintExtra(ctl, %s %s\n, _(emulator:), _(CPU Affinity)); vshPrintExtra(ctl, --\n); vshPrintExtra(ctl,*: ); -ret = vshPrintPinInfo(cpumaps, cpumaplen, maxcpu, 0); +ret = vshPrintPinInfo(cpumap, cpumaplen); vshPrint(ctl, \n); } VIR_FREE(cpumaps); @@ -6865,8 +6845,7 @@ cmdIOThreadsInfo(vshControl *ctl, const vshCmd *cmd) for (i = 0; i niothreads; i++) { vshPrint(ctl, %-15u , info[i]-iothread_id); -ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen, - maxcpu, 0)); +ignore_value(vshPrintPinInfo(info[i]-cpumap, info[i]-cpumaplen)); vshPrint(ctl, \n); virDomainIOThreadsInfoFree(info[i]); } -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] Fix indentation in cmdVcpuPin
--- tools/virsh-domain.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1d8225c..9e8d9d1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6522,14 +6522,14 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) vshPrintExtra(ctl, %s %s\n, _(VCPU:), _(CPU Affinity)); vshPrintExtra(ctl, --\n); for (i = 0; i ncpus; i++) { - if (got_vcpu i != vcpu) - continue; - - vshPrint(ctl, %4zu: , i); - ret = vshPrintPinInfo(cpumap, cpumaplen, maxcpu, i); - vshPrint(ctl, \n); - if (!ret) - break; +if (got_vcpu i != vcpu) +continue; + +vshPrint(ctl, %4zu: , i); +ret = vshPrintPinInfo(cpumap, cpumaplen, maxcpu, i); +vshPrint(ctl, \n); +if (!ret) +break; } } } else { -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] vshPrintPinInfo cleanups
Ján Tomko (2): Fix indentation in cmdVcpuPin Rewrite vshPrintPinInfo tools/virsh-domain.c | 55 1 file changed, 17 insertions(+), 38 deletions(-) -- 2.0.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/7] Do not use vshPrintPinInfo in iothreadinfo
On Thu, Mar 26, 2015 at 08:50:24AM -0400, John Ferlan wrote: On 03/25/2015 02:39 PM, Ján Tomko wrote: Just format the bitmap via virBitmapFormat. --- tools/virsh-domain.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index afd92b1..cb9cb9d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6834,6 +6834,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) size_t i; int maxcpu; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; +virBitmapPtr map = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); @@ -6863,16 +6864,24 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) _(IOThread ID), _(CPU Affinity)); vshPrintExtra(ctl, ---\n); for (i = 0; i niothreads; i++) { +char *mapstr = NULL; Considering the other discussion about Set/Add/Del IOThread and since you're modifying the code anyway... How about adding a check for: if (info[i].iothread_id == 0) continue; That way we can prepare for a configuration that may have holes on the delete and won't have some future issue with a 1.2.14 virsh receiving something unexpected from a 1.2.15 daemon. We would not need to include empty elements in the array - the holes would be apparent from the presence of a thread with id=1, then id=3. Otherwise the thread_id element would be redundant. Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Selective block device migration implementation
Dear Libvirt Developers, I'm working to implement feature request [1]. The feature request proposes to enhance `libvirt' code so the API caller can specify which block devices are to be migrated using e.g. parameters in the `virDomainMigrateToURI3' call. There is the following issues: 1. It is obvious to identify devices to be migrated using the `device_name'. However, these need to be serialized in either 1) a comma-separated string or in 2) a set of values named like `blockdevice%d' with `blockdevice' value holding amount of block devices to migrate. What is the desired approach here? Can block device name contain commas or should I neglect this possibility? 2. `libvirt' behavior in block devices migration was copied from the `QEMU' implementation that ignores read-only devices as well. So, `libvirt' code will need to pass this list to `QEMU' `migrate' QMP command and this argument should be implemented in the `QEMU'. Is there any implementation advices from your side? Pavel [1] https://bugzilla.redhat.com/show_bug.cgi?id=1203032 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Xen-devel] [PATCH 3/3] libxl: drop virDomainObj lock when destroying a domain
On Wed, 2015-03-25 at 14:08 -0600, Jim Fehlig wrote: A destroy operation can take considerable time on large memory domains due to scrubbing the domain' memory. The operation is running in the context of a job, so unlocking the domain and allowing query operations is safe. Signed-off-by: Jim Fehlig jfeh...@suse.com I don't really know enough about the libvirt job/obj locking to comment on the previous patches or that aspect of this one, but in general the idea of dropping the lock before calling libxl_destroy seems reasonable to me. In principal you could use the async stuff (the final NULL to the call), but you'd still be wanting to drop the lock for that period, so it's not clear it's any better from your PoV. Ian. --- src/libxl/libxl_domain.c | 4 src/libxl/libxl_driver.c | 5 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index e240eae..aef0157 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -435,7 +435,9 @@ libxlDomainShutdownThread(void *opaque) libxlDomainEventQueue(driver, dom_event); dom_event = NULL; } +virObjectUnlock(vm); libxl_domain_destroy(cfg-ctx, vm-def-id, NULL); +virObjectLock(vm); libxlDomainCleanup(driver, vm, reason); if (!vm-persistent) virDomainObjListRemove(driver-domains, vm); @@ -447,7 +449,9 @@ libxlDomainShutdownThread(void *opaque) libxlDomainEventQueue(driver, dom_event); dom_event = NULL; } +virObjectUnlock(vm); libxl_domain_destroy(cfg-ctx, vm-def-id, NULL); +virObjectLock(vm); libxlDomainCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); if (libxlDomainStart(driver, vm, false, -1) 0) { virErrorPtr err = virGetLastError(); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index a1977c2..21e20bb 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1250,7 +1250,10 @@ libxlDomainDestroyFlags(virDomainPtr dom, event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); -if (libxl_domain_destroy(cfg-ctx, vm-def-id, NULL) 0) { +virObjectUnlock(vm); +ret = libxl_domain_destroy(cfg-ctx, vm-def-id, NULL); +virObjectLock(vm); +if (ret 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _(Failed to destroy domain '%d'), vm-def-id); goto endjob; -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/7] conf: Add/modify storage formatting functions
On 03/25/2015 05:21 PM, John Ferlan wrote: In a bit of bikeshedding - this patch does a couple of things and could be split into a couple of patches... Ironically you bundled things together here, but separated them for the stateDir changes (patches 2, 4, 7). first one just creates DefFormatBuf and has DefFormat call it second one creates the virStoragePoolSaveXML, has the config code use it third one creates virStoragePoolSaveStatus which use the new API's Nice ideas, I'll rework the patch. +virBufferAddLit(buf, poolstatus\n); poolstate ? +virBufferAdjustIndent(buf, 2); + +if (virStoragePoolDefFormatBuf(buf, def) 0) +goto error; + +virBufferAdjustIndent(buf, -2); +virBufferAddLit(buf, /poolstatus\n); poolstate ? Hmm, I see your point, however I had a look at the network state file and it's formatted as networkstatus. The question is if we want to stay consistent one way or another, or we don't want to care about this particular detail at all Erik -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix common misspellings
On 03/23/2015 04:46 AM, Martin Kletzander wrote: On Fri, Mar 20, 2015 at 09:51:23AM -0600, Eric Blake wrote: On 03/20/2015 06:21 AM, Martin Kletzander wrote: +++ b/docs/schemas/interface.rng @@ -4,7 +4,7 @@ xmlns:v=http://netcf.org/xml/version/1.0; datatypeLibrary=http://www.w3.org/2001/XMLSchema-datatypes; !-- Versions for this schema are simple integers that are incremented - everytime a changed (but backwards compatible) version + every time a changed (but backwards compatible) version is released. The current version is indicated with the v:serial attribute on the start element. -- Hmm - we aren't really bumping the version when we change the .rng; is that a bug in our process, or a stale comment worth deleting instead of spell-checking? But doesn't stop us from taking this hunk now. Well, this has something to do with netcf, I guess. Probably Laine (Cc'd) would be the one to answer that. That schema is likely copied directly from netcf. I vaguely recall that the first time after initial public release that lutter added something to the schema (to support ipv6 I think), he updated the version, but wondered at the time just how necessary that was. Since that time it has never been updated, and I don't really see an upside to doing so. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [perl PATCH 2/2] Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
On 03/26/2015 08:46 AM, Ján Tomko wrote: --- Changes | 1 + Virt.xs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) There's also examples/iothreadsinfo.pl that needs to be updated - not only to have the right API name, but to add the CPU Time if you added that as well John diff --git a/Changes b/Changes index 44a42f2..7a2bc51 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,7 @@ Revision history for perl module Sys::Virt - Add virDomainInterfaceAddress function constants - Add VIR_DOMAIN_PAUSED_STARTING_UP constant - Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree + - Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo 1.2.13 2015-03-05 diff --git a/Virt.xs b/Virt.xs index 5dc977a..2138530 100644 --- a/Virt.xs +++ b/Virt.xs @@ -5023,8 +5023,8 @@ get_iothread_info(dom, flags=0) int niothreads; int i; PPCODE: - if ((niothreads = virDomainGetIOThreadsInfo(dom, iothrinfo, - flags)) 0) + if ((niothreads = virDomainGetIOThreadInfo(dom, iothrinfo, + flags)) 0) _croak_error(); EXTEND(SP, niothreads); -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] nodeinfo: Increase the num of CPU thread siblings to a larger value
On 03/26/2015 07:03 AM, Ján Tomko wrote: On Thu, Mar 26, 2015 at 12:48:13AM -0400, Wei Huang wrote: Current libvirt can only handle up to 1024 thread siblings when it reads Linux sysfs topology/thread_siblings. This isn't enough for Linux distributions that support a large value. This patch fixes the problem by using VIR_ALLOC()/VIR_FREE(), instead of using a fixed-size (1024) local char array. In the meanwhile SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX is increased to 8192 which should be large enough for a foreseeable future. Signed-off-by: Wei Huang w...@redhat.com --- src/nodeinfo.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 34d27a6..66dc7ef 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -287,7 +287,7 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params, # define PROCSTAT_PATH /proc/stat # define MEMINFO_PATH /proc/meminfo # define SYSFS_MEMORY_SHARED_PATH /sys/kernel/mm/ksm -# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 1024 +# define SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX 8192 There is thread_siblings_list, which contains a range: 22-23 and thread_siblings file has all the bits set: 00c0 For the second one, the 1024-byte buffer should be enough for 16368 possible siblings. a 4096 siblings file will generate a (cpumask_t -based) output of : ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,, ,,,,,,,0080 9(characters per 32-bit mask, including the comma)*8(masks/row)*16(rows) -1(last entry doesn't have a comma) = 1152 Other releases/arch's avoid this issue by using cpumask_var_t vs cpumask_t for siblings so it's reflective of actual cpu count a system (not operating system) could provide/support. cpumask_t objects are NR_CPUS -sized. In the not so distant future, though, real systems will have 1024 cpus, so might as well accomodate for a couple years after that. For the first one, the results depend on the topology - if the sibling ranges are contiguous, even million CPUs should fit there. The _list files(core_siblings_list, thread_siblings_list) have ranges; the non _list (core_siblings, thread_siblings) files have mask like above. For the worst case, when every other cpu is a sibling, the second file is more space-efficient. I'm OK with using the same limit for both (8k seems sufficiently large), but I would like to know: Which one is the file that failed to parse in your case? /sys/devices/system/cpu/cpu*/topology/thread_siblings I think both virNodeCountThreadSiblings and virNodeGetSiblingsList could be rewritten to share some code and only look at one of the sysfs files. The question is - which one? Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH 1/2] Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree
On 03/26/2015 08:43 AM, Ján Tomko wrote: --- generator.py | 2 +- libvirt-override.c | 2 +- sanitytest.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generator.py b/generator.py index df7a74d..05ccbc8 100755 --- a/generator.py +++ b/generator.py @@ -594,7 +594,7 @@ skip_function = ( 'virNetworkDHCPLeaseFree', # only useful in C, python code uses list 'virDomainStatsRecordListFree', # only useful in C, python uses dict 'virDomainFSInfoFree', # only useful in C, python code uses list -'virDomainIOThreadsInfoFree', # only useful in C, python code uses list +'virDomainIOThreadInfoFree', # only useful in C, python code uses list ) lxc_skip_function = ( diff --git a/libvirt-override.c b/libvirt-override.c index 1241305..9a72f87 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2075,7 +2075,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, cleanup: for (i = 0; i niothreads; i++) -virDomainIOThreadsInfoFree(iothrinfo[i]); +virDomainIOThreadInfoFree(iothrinfo[i]); VIR_FREE(iothrinfo); Py_XDECREF(py_iothrinfo); return py_retval; diff --git a/sanitytest.py b/sanitytest.py index 0e6e0e5..cff9811 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -142,7 +142,7 @@ for cname in wantfunctions: if name[0:19] == virDomainFSInfoFree: continue -if name[0:26] == virDomainIOThreadsInfoFree: +if name[0:26] == virDomainIOThreadInfoFree: s/26/25 John continue if name[0:21] == virDomainListGetStats: -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-python PATCH 2/2] Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo
On 03/26/2015 08:43 AM, Ján Tomko wrote: --- generator.py | 4 ++-- libvirt-override-api.xml | 2 +- libvirt-override.c | 10 +- sanitytest.py| 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generator.py b/generator.py index 05ccbc8..729daa2 100755 --- a/generator.py +++ b/generator.py @@ -435,7 +435,7 @@ skip_impl = ( 'virDomainGetVcpuPinInfo', 'virDomainGetEmulatorPinInfo', 'virDomainPinEmulator', -'virDomainGetIOThreadsInfo', +'virDomainGetIOThreadInfo', 'virDomainPinIOThread', 'virSecretGetValue', 'virSecretSetValue', @@ -1147,7 +1147,7 @@ def nameFixup(name, classe, type, file): elif name[0:20] == virDomainGetCPUStats: func = name[9:] func = func[0:1].lower() + func[1:] -elif name[0:25] == virDomainGetIOThreadsInfo: +elif name[0:24] == virDomainGetIOThreadInfo: func = name[12:] func = func[0:2].lower() + func[2:] elif name[0:18] == virDomainGetFSInfo: diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 4660c9f..cf46090 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -278,7 +278,7 @@ arg name='cpumap' type='unsigned char *' info='pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.'/ arg name='flags' type='int' info='flags to specify'/ /function -function name='virDomainGetIOThreadsInfo' file='python' +function name='virDomainGetIOThreadInfo' file='python' infoQuery the CPU affinity setting of the IOThreads of the domain/info arg name='domain' type='virDomainPtr' info='pointer to domain object, or NULL for Domain0'/ arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ diff --git a/libvirt-override.c b/libvirt-override.c index 9a72f87..0699ae3 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -1992,8 +1992,8 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self ATTRIBUTE_UNUSED, #if LIBVIR_CHECK_VERSION(1, 2, 14) static PyObject * -libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args) +libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { virDomainPtr domain; PyObject *pyobj_domain; @@ -2004,7 +2004,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, size_t pcpu, i; int niothreads, cpunum; -if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadsInfo, +if (!PyArg_ParseTuple(args, (char *)OI:virDomainGetIOThreadInfo, pyobj_domain, flags)) return NULL; domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); @@ -2013,7 +2013,7 @@ libvirt_virDomainGetIOThreadsInfo(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_NONE; LIBVIRT_BEGIN_ALLOW_THREADS; -niothreads = virDomainGetIOThreadsInfo(domain, iothrinfo, flags); +niothreads = virDomainGetIOThreadInfo(domain, iothrinfo, flags); LIBVIRT_END_ALLOW_THREADS; if (niothreads 0) { If you've added the CPU Time it needs to be handled here too John @@ -8640,7 +8640,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) virDomainPinEmulator, libvirt_virDomainPinEmulator, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ #if LIBVIR_CHECK_VERSION(1, 2, 14) -{(char *) virDomainGetIOThreadsInfo, libvirt_virDomainGetIOThreadsInfo, METH_VARARGS, NULL}, +{(char *) virDomainGetIOThreadInfo, libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL}, {(char *) virDomainPinIOThread, libvirt_virDomainPinIOThread, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ {(char *) virConnectListStoragePools, libvirt_virConnectListStoragePools, METH_VARARGS, NULL}, diff --git a/sanitytest.py b/sanitytest.py index cff9811..aafc487 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -279,8 +279,8 @@ for name in sorted(basicklassmap): func = nwfilter + func[8:] if func[0:8] == fSFreeze or func[0:6] == fSThaw or func[0:6] == fSInfo: func = fs + func[2:] -if func[0:13] == iOThreadsInfo: -func = ioThreadsInfo +if func[0:13] == iOThreadInfo: s/13/12 +func = ioThreadInfo if klass == virNetwork: func = func.replace(dHCP, DHCP) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list