From jferlan at redhat.com Fri Apr 4 15:19:40 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 04 Apr 2014 11:19:40 -0400 Subject: [Libvirt-cim] [PATCH v3 0/8] Add Controller Device Support In-Reply-To: <1395955117-2884-1-git-send-email-jferlan@redhat.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> Message-ID: <533ECD8C.90304@redhat.com> Ping? Any thoughts on the changes? I'd like to get this off my list of things to do... Thanks John On 03/27/2014 05:18 PM, John Ferlan wrote: > I know this is a long cover letter, but it covers a lot of ground... > > I was just about done with all the merges this morning - I ran the cimtest > one more time and found that there's a couple of tests which associate > RASDs and Pools. So I jumped into the rabbit hole and wound my way through > the maze of twisty little passages. I even heard a babbling brook (it's an > old computer game reference). > > So here's where I'm at - I have cimtest completely passing again which keeps > me happy. Although I have a pile of cimtest related changes that will also > need to be made, but I have to wait to do them until I get a libvirt-cim > revision number to compare against so as to be able to add conditional code > to support controllers devices, rasds, and pools. > > For now support is only for KVM. We've already determined LXC doesn't have > the concept of a controller and I have no way to test Xen. I also don't have > the cycles to dig through the Xen source code and determine what that driver > supports. If someone wants to add that - great - have at it! > > I want to put it out there for review - knowing that I probably still have > a bit of cleanup left. I think I'm going to need to add KVM specific code > to a number of places, but I figured I needed to get everything merged first > then I could determine that. I'm also hoping it'll be pointed out to me :-). > > I kept the changes split even though I know only changes 1 & 2 can be compiled > alone and run without any new cimtest failures. Each step of changes can > compile successfully/cleanly - although once you hit change 3, you'll need > to regenerate your Makefile > > Changes 1 & 2 are more or less Xu's previous patch #1. I split it for > ease of review - there's no real reason, although you will note I > have left out the addition of CONTROLLER to the cim_res_types until > patch 4... With that patch 2 will have cimtest failures. > Change 3 adds the MOF's and adjusts the install resulting in cimtest > failures because of "missing" links between MOF and code. > Change 4 adds the bulk of the code required to fill in all the fields for > the mofs from the xml/data structures. > Change 6 adds the various associations between the new elements > Change 7 adds the MOF's and modifies install/build to include ControllerPool's > Change 8 adds the code and associations for Controller Pools. Without it > there are a few cimtest failures. > > My plan is to allow review of Changes 3->8 separately, but when it comes > time to push - 3-8 could be squashed together so that the ability to bisect > history and run cimtest without too many failures isn't lost. Although I'm > also considering combining 3-6 and 7-8 for "functionality" likeness. I'll > take suggestions from the community if it's felt strongly to keep the split > as is, then so bit it. > > The following is a list of the differences between this set of changes > and what Xu posted as his v2. All I did was pull down his changes into a > clean branch, then 'git am' those changes. Then after making all my changes > a simple 'git diff' of the branches let me know what was different. > > > Makefile.am > * Copyright date > * Add controller pool > > libvirt-cim.spec.in > * Order - kept closer to DisplayController/PointingDevice > * Add controller pool > > libxkutil/device_parsing.c > * Copyright date > * Additional CU_DEBUG messages - useful in debugging free() issues > * Merged sgio/rawio changes > * cleanup_controller_device(): > * Free new controller fields for queues, ports, vectors, address > * Changed controller 'type' from "char *" to "uint16_t", no need to free > * parse_controller_device(): > * Use controller_protocol_type_StrToID() to store type integer > * Fail in "index" is not present > * Convert/store "index" as uint64_t and free "index" > * Added controller fields for queues, ports, vectors, address > * Format id as "controller::" > > libxkutil/device_parsing.h > * Copyright date > * Add CONTROLLER_INDEX_NOT_SET as -1 > * Change type to uint16_t, add uint64_t index, and char */device_address fields > > libxkutil/xmlgen.c > * Copyright date > * Change how we store fields > * Be sure to convert the "type" to it's string representation > * Handle missing/default Index value (eg from define system from vdev) > * Print out model, ports, vectors, queues, and address if present > > schema/Controller.mof > * Remove {Xen|LXC}_Controller > > schema/Controller.registration > * Remove {Xen|LXC}_Controller > > schema/ControllerPool.mof > * Add ControllerPool mof > > schema/ControllerPool.registration > * Add ControllerPool registration > > schema/ResourceAllocationSettingData.mof > * Copyright date > * Merged rawio/sgio changes > * Remove {Xen|LXC}_ControllerResourceAllocationSettingData > * Add comments and properties we care about > > schema/ResourceAllocationSettingData.registration > * Copyright date > * Remove {Xen|LXC}_ControllerResourceAllocationSettingData > > src/Virt_Device.c > * Copyright date > * Set the Virtual Controller Logical Device properties: > * ProtocolSupported <== String from controller_device->type (pci, usb, etc.) > * ProtocolDescription <== If available, string from model > * Adjusted some debug messages > * Removed incorrect setting of "Controller" property (twice) > > src/Virt_DevicePool.c > * Add ControllerPool support > > src/Virt_ElementAllocatedFromPool.c > * Copyright date > * Remove Xen/LXC associations > * Add ControllerPool > > src/Virt_ElementCapabilities.c > * Copyright date > * Add ControllerPool > > src/Virt_ElementSettingData.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_HostedResourcePool.c > * Copyright date > * Add ControllerPool > > src/Virt_RASD.c > * Copyright date > * Merged sgio/rawio changes > * set_controller_rasd_params(): > * Set the fields properly based on defintion of structure/mof > * ResourceSubType <== String-ified type (pci, usb, etc) > * Other fields set if available in data structure > * Changed vdev_device -> type to use CIM_RES_TYPE_OTHER - this is the parent > structure to the controller_device structure > > src/Virt_ResourceAllocationFromPool.c > * Copyright date > * Controller RASD Association > * ControllerPool Association > > src/Virt_ResourcePoolConfigurationService.c > * Copyright date > * Add ControllerPool > > src/Virt_ServiceAffectsElement.c > * Copyright date > * Add "Controller" to list that use get_device_by_ref() call > * Remove Xen/LXC associations > > src/Virt_SettingsDefineState.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_SystemDevice.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_VSSDComponent.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_VirtualSystemManagementService.c > * Copyright date > * Merged sgio/rawio changes > * Fix controller_rasd_to_vdev(): > * Handle the controller_device->type properly to get 'type_str' > * Build dev->id based on Index: > NOTE: I found through debugging cimtest code that on input the dev->id > is NULL. It cannot be left that way since a subsequent call to > add_device_nodup() would core on the STREQC(ptr->id, dev->id). > Thus I formulated an InstanceID with the -1. If there's another > similarly "undefined" element, it'll go through the overriding > code and be removed. > * Set other fields if present in data > * Following Boris' earlier advice, mimic the method that disks, networks, > and graphics devices use to set things up. > * Similarly for resource_del, resource_add, and resource_mod - allow > the code to do it's magic for controller devices. > * HMM: Given what I discovered about dev->id in controller_rasd_to_vdev() > described above, I wonder if the check in resource_add could ever > happen. I guess it's "safe" to keep... > > src/svpc_types.h > * Copyright date > * Add some pointers to where to find the details we're describing > * Add CIM_controller_protocol_type enum to describe the various values > * Add controller_protocol_type_StrToID() and controller_protocol_type_IDToStr() > to handle the "supported" conversions > > > > John Ferlan (3): > Associations > Add MOFS and change install for ControllerPools > Add code and associations for ControllerPool > > Xu Wang (5): > Add virtual controller device types > Parse/Store controller XML tags > Add virtual controller object definitions to mofs > Set fields in mofs for Controller Device/RASD > VSMS: Support for domains with controller devices > > Makefile.am | 6 +- > libvirt-cim.spec.in | 4 + > libxkutil/device_parsing.c | 119 ++++++++++++++++++- > libxkutil/device_parsing.h | 17 ++- > libxkutil/xmlgen.c | 74 +++++++++++- > schema/Controller.mof | 7 ++ > schema/Controller.registration | 4 + > schema/ControllerPool.mof | 6 + > schema/ControllerPool.registration | 3 + > schema/ResourceAllocationSettingData.mof | 37 +++++- > schema/ResourceAllocationSettingData.registration | 3 +- > src/Virt_Device.c | 68 ++++++++++- > src/Virt_DevicePool.c | 55 ++++++++- > src/Virt_ElementAllocatedFromPool.c | 6 +- > src/Virt_ElementCapabilities.c | 4 +- > src/Virt_ElementSettingData.c | 3 +- > src/Virt_HostedResourcePool.c | 3 +- > src/Virt_RASD.c | 57 +++++++++- > src/Virt_ResourceAllocationFromPool.c | 2 + > src/Virt_ResourcePoolConfigurationCapabilities.c | 2 +- > src/Virt_ResourcePoolConfigurationService.c | 2 + > src/Virt_ServiceAffectsElement.c | 8 +- > src/Virt_SettingsDefineState.c | 4 +- > src/Virt_SystemDevice.c | 3 +- > src/Virt_VSSDComponent.c | 3 +- > src/Virt_VirtualSystemManagementService.c | 87 +++++++++++++- > src/svpc_types.h | 132 +++++++++++++++++++++- > 27 files changed, 695 insertions(+), 24 deletions(-) > create mode 100644 schema/Controller.mof > create mode 100644 schema/Controller.registration > create mode 100644 schema/ControllerPool.mof > create mode 100644 schema/ControllerPool.registration > From jferlan at redhat.com Fri Apr 4 15:19:45 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 04 Apr 2014 11:19:45 -0400 Subject: [Libvirt-cim] [PATCH v3 6/8] Associations In-Reply-To: <1395955117-2884-7-git-send-email-jferlan@redhat.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> <1395955117-2884-7-git-send-email-jferlan@redhat.com> Message-ID: <533ECD91.4060803@redhat.com> FYI: I adjusted the author for this to Xu Wang... And added the commit message: Controller: Add associations for KVM_Controller Add the various associations to make the KVM_Controller work John On 03/27/2014 05:18 PM, John Ferlan wrote: > Signed-off-by: John Ferlan > --- > src/Virt_ElementAllocatedFromPool.c | 4 +++- > src/Virt_ElementSettingData.c | 3 ++- > src/Virt_ServiceAffectsElement.c | 8 +++++--- > src/Virt_SettingsDefineState.c | 4 +++- > src/Virt_SystemDevice.c | 3 ++- > src/Virt_VSSDComponent.c | 3 ++- > 6 files changed, 17 insertions(+), 8 deletions(-) > > diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c > index 2c2f2d1..262c9b9 100644 > --- a/src/Virt_ElementAllocatedFromPool.c > +++ b/src/Virt_ElementAllocatedFromPool.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -275,6 +275,7 @@ static char* device[] = { > "KVM_LogicalDisk", > "KVM_DisplayController", > "KVM_PointingDevice", > + "KVM_Controller", > "LXC_Processor", > "LXC_Memory", > "LXC_NetworkPort", > @@ -297,6 +298,7 @@ static char* device_or_pool[] = { > "KVM_LogicalDisk", > "KVM_DisplayController", > "KVM_PointingDevice", > + "KVM_Controller", > "LXC_Processor", > "LXC_Memory", > "LXC_NetworkPort", > diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c > index c088e49..5845c86 100644 > --- a/src/Virt_ElementSettingData.c > +++ b/src/Virt_ElementSettingData.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Kaitlin Rupert > @@ -137,6 +137,7 @@ static char* resource_allocation_setting_data[] = { > "KVM_GraphicsResourceAllocationSettingData", > "KVM_ConsoleResourceAllocationSettingData", > "KVM_InputResourceAllocationSettingData", > + "KVM_ControllerResourceAllocationSettingData", > "LXC_DiskResourceAllocationSettingData", > "LXC_MemResourceAllocationSettingData", > "LXC_NetResourceAllocationSettingData", > diff --git a/src/Virt_ServiceAffectsElement.c b/src/Virt_ServiceAffectsElement.c > index 9810e02..d64a877 100644 > --- a/src/Virt_ServiceAffectsElement.c > +++ b/src/Virt_ServiceAffectsElement.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2008 > + * Copyright IBM Corp. 2008-2014 > * > * Authors: > * Kaitlin Rupert > @@ -101,9 +101,10 @@ static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context, > > if (STREQC(classname, "ComputerSystem")) { > s = get_domain_by_ref(_BROKER, ref, &inst); > - } else if ((STREQC(classname, "PointingDevice")) || > + } else if ((STREQC(classname, "PointingDevice")) || > + (STREQC(classname, "Controller")) || > (STREQC(classname, "DisplayController"))) { > - s = get_device_by_ref(_BROKER, ref, &inst); > + s = get_device_by_ref(_BROKER, ref, &inst); > } > > free(classname); > @@ -146,6 +147,7 @@ static char* affected_ele[] = { > "Xen_DisplayController", > "KVM_DisplayController", > "LXC_DisplayController", > + "KVM_Controller", > NULL > }; > > diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c > index c8cda97..6338d7c 100644 > --- a/src/Virt_SettingsDefineState.c > +++ b/src/Virt_SettingsDefineState.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -336,6 +336,7 @@ static char* logical_device[] = { > "KVM_DisplayController", > "KVM_ConsoleDisplayController", > "KVM_PointingDevice", > + "KVM_Controller", > "LXC_Processor", > "LXC_Memory", > "LXC_NetworkPort", > @@ -361,6 +362,7 @@ static char* resource_allocation_setting_data[] = { > "KVM_GraphicsResourceAllocationSettingData", > "KVM_InputResourceAllocationSettingData", > "KVM_ConsoleResourceAllocationSettingData", > + "KVM_ControllerResourceAllocationSettingData", > "LXC_DiskResourceAllocationSettingData", > "LXC_MemResourceAllocationSettingData", > "LXC_NetResourceAllocationSettingData", > diff --git a/src/Virt_SystemDevice.c b/src/Virt_SystemDevice.c > index d2e526d..ae13ecb 100644 > --- a/src/Virt_SystemDevice.c > +++ b/src/Virt_SystemDevice.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -144,6 +144,7 @@ static char* part_component[] = { > "KVM_DisplayController", > "KVM_ConsoleDisplayController", > "KVM_PointingDevice", > + "KVM_Controller", > "LXC_Processor", > "LXC_Memory", > "LXC_NetworkPort", > diff --git a/src/Virt_VSSDComponent.c b/src/Virt_VSSDComponent.c > index 35bffde..fc223c2 100644 > --- a/src/Virt_VSSDComponent.c > +++ b/src/Virt_VSSDComponent.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -141,6 +141,7 @@ static char* part_component[] = { > "KVM_GraphicsResourceAllocationSettingData", > "KVM_InputResourceAllocationSettingData", > "KVM_ConsoleResourceAllocationSettingData", > + "KVM_ControllerResourceAllocationSettingData", > "LXC_DiskResourceAllocationSettingData", > "LXC_MemResourceAllocationSettingData", > "LXC_NetResourceAllocationSettingData", > From jferlan at redhat.com Fri Apr 4 16:12:49 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:49 -0400 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support Message-ID: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Here's my bundle of cimtest related changes to support Controllers, Controller Pools, and libvirt upstream addition of a keyboard device. I have tested all these changes on both my upstream libvirt-cim environment and a RHEL6.5 libvirt-cim environment. The only failures I get are in the indiciations tests which I've never had working quite right. My testing process was to add each patch separately and ensure that each didn't change the RHEL6.5 results. I've used the currently posted libvirt-cim revision number sequence as the key to whether or not support for the controller and controller pool will be added/checked. The numbers 1310 and 1312 may changed base on how the libvirt-cim submit goes. I have split them up into "bundles" of changes: Patch 1: is a rebase/repost of a change I posted back in November. It's still a valid change since then. I don't think I got an ACk for it back then, so reposted Patch 2: is a change because nfs server tests were failing in my upstream environment on f19. I just added a parameter as nfs-server.service told me to do and things worked. Patch 3 Patch 4: These are infrastructure changes - Patch 3 is basically converting all code that uses Dictionaries and the Class Name as the key to the dictionary with lists of tuples that have the classname and the element formerly inserted into the dictionary key. Patch 4 is much of the same, but a bit more gnarly with respect to what it did - so I kept it separate Patch5 Patch6: Adds support for controller RASD - I can merge these later, but keeping them separate was easier for code review purposes Patch7 Patch8: Adds support for controller pools. Again, these can be merged, but for review purposes - I'll keep them separate. Patch9 Patch10: Adds support to handle the keyboard RASD as an input device. I have a set of libvirt-cim code that will go along with this, but since it's in my branch already - I just posted it anyway. It was part of my RHEL6 environment testing. These won't be pushed with the controller changes, but would be pushed eventually. John Ferlan (10): live.full_hostname: Adjust mechanism to get FQDN XenKvmLib: Adjust systemd nfs server settings cimtest: Use lists instead of dictionaries cimtest: VSSDC - 02-reverse.py - adjust iteration of association XenKvmLib: Add controller device cimtest: Add controller RASD support XenKvmLib: Add controller pool cimtest: Add controller pool support XenKvmLib: Add keyboard input RASD cimtest: Add support for keyboard input device lib/VirtLib/live.py | 11 +- .../cimtest/AllocationCapabilities/01_enum.py | 4 + .../ComputerSystem/41_cs_to_settingdefinestate.py | 57 +++++----- .../cimtest/ElementCapabilities/01_forward.py | 1 + .../cimtest/HostSystem/02_hostsystem_to_rasd.py | 25 +++-- .../cimtest/HostSystem/04_hs_to_EAPF.py | 3 + .../cimtest/HostedResourcePool/01_forward.py | 7 +- .../cimtest/RASD/01_verify_rasd_fields.py | 18 ++- .../ResourceAllocationFromPool/02_reverse.py | 12 +- .../cimtest/ServiceAffectsElement/01_forward.py | 57 +++++----- .../cimtest/ServiceAffectsElement/02_reverse.py | 22 ++-- .../cimtest/SettingsDefine/02_reverse.py | 36 +++--- .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 19 +++- suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py | 27 ++++- .../02_reverse.py | 124 ++++++++++++++------- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 4 +- suites/libvirt-cim/lib/XenKvmLib/devices.py | 6 + suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/pool.py | 6 + suites/libvirt-cim/lib/XenKvmLib/rasd.py | 47 +++++++- suites/libvirt-cim/lib/XenKvmLib/vsms.py | 24 ++++ suites/libvirt-cim/lib/XenKvmLib/vxml.py | 40 +++++-- 22 files changed, 393 insertions(+), 159 deletions(-) -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:50 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:50 -0400 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-2-git-send-email-jferlan@redhat.com> Rather than default to socket.gethostbyaddr(socket.gethostname())[0] to get full_hostname(), go through a sequence of steps to get a more correct result NOTE: See http://www.redhat.com/archives/libvirt-cim/2013-November/msg00082.html for more details and history. Signed-off-by: John Ferlan --- lib/VirtLib/live.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py index c929e71..e9cafc1 100644 --- a/lib/VirtLib/live.py +++ b/lib/VirtLib/live.py @@ -100,6 +100,11 @@ def hostname(server): return out def full_hostname(server): - """To return the fully qualifiec domain name(FQDN) of the system""" - - return socket.gethostbyaddr(socket.gethostname())[0] + """To return the fully qualified domain name(FQDN) of the system""" + + if socket.getfqdn().find('.') >= 0: + return socket.getfqdn() + elif socket.gethostname().find('.') >= 0: + return socket.gethostname() + else: + return socket.gethostbyaddr(server)[1][0] -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:51 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:51 -0400 Subject: [Libvirt-cim] [PATCH 02/10] XenKvmLib: Adjust systemd nfs server settings In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-3-git-send-email-jferlan@redhat.com> Add an "fsid=0" to the "rw" exportfs options to allow the two NFS tests to complete successfully: ResourcePoolConfigurationService 08_CreateDiskResourcePool.py 12_create_netfs_storagevolume_errs.py Signed-off-by: John Ferlan --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index fd468cb..0e3f1d6 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -538,7 +538,7 @@ def nfs_config(server, nfs_server_bin, is_systemd): else: cmd = "systemctl | grep nfs-server" rc, out = utils.run_remote(server, cmd) - # if NFS services is not found on the machine, start it.. + # if NFS services is not found on the machine, start it.. if rc != PASS : # Check if NFS server is installed ... if is_systemd == 0: @@ -638,7 +638,7 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt, is_systemd): os.remove(back_exports_file) move_file(exports_file, back_exports_file) fd = open(exports_file, "w") - line = "\n %s %s(rw)" %(src_dir_for_mnt, server) + line = "\n %s %s(rw,fsid=0)" %(src_dir_for_mnt, server) fd.write(line) fd.close() -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:52 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:52 -0400 Subject: [Libvirt-cim] [PATCH 03/10] cimtest: Use lists instead of dictionaries In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-4-git-send-email-jferlan@redhat.com> InputRASD's and an uncoming ControllerRASD object can appear multiple times in the guest XML. Currently the code uses dictionaries with the ClassName of the object as the key to the dictionary. We cannot do that as we move forward, so convert to using a list. The list will be a tuple of the ClassName and the object previously stored in the dictionary key. InputRASD's currently only have a mouse or tablet, but as of libvirt v1.2.2 there will be a keyboard device added. ControllerRASD's will be added shortly and there are usually 2 or 3 per domain. Signed-off-by: John Ferlan --- .../ComputerSystem/41_cs_to_settingdefinestate.py | 57 +++++++++++----------- .../cimtest/HostSystem/02_hostsystem_to_rasd.py | 11 +++-- .../cimtest/RASD/01_verify_rasd_fields.py | 18 +++++-- .../ResourceAllocationFromPool/02_reverse.py | 12 ++--- .../cimtest/ServiceAffectsElement/01_forward.py | 57 ++++++++++++---------- .../cimtest/ServiceAffectsElement/02_reverse.py | 22 ++++----- .../cimtest/SettingsDefine/02_reverse.py | 36 +++++++++----- 7 files changed, 121 insertions(+), 92 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py index 4733f90..74565db 100644 --- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py +++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py @@ -99,19 +99,19 @@ def get_associators_info(server, cn, an, qcn, instid): cn, InstanceID = instid) if len(assoc_info) < 1: - logger.error("%s returned %i %s objects", + logger.error("get_associators_info %s returned %i %s objects", an, len(assoc_info), qcn) status = FAIL except Exception, detail: logger.error(CIM_ERROR_ASSOCIATORS, cn) - logger.error("Exception: %s", detail) + logger.error("get_associators_info Exception: %s", detail) status = FAIL return status, assoc_info def init_rasd_list(virt, ip): - rasd_insts = {} + rasd_insts = [] rasds, status = enum_rasds(virt, ip) if status != PASS: logger.error("Enum RASDs failed") @@ -125,14 +125,14 @@ def init_rasd_list(virt, ip): return rasd_insts, FAIL if guest == test_dom: - rasd_insts[rasd.Classname] = rasd + rasd_insts.append((rasd.Classname,rasd.InstanceID)) return rasd_insts, PASS def verify_values(assoc_info, vssd_cs_values, an, qcn): if len(assoc_info) != 1: - logger.error("%s returned %i %s objects, Expected 1", an, + logger.error("verify_values %s returned %i %s objects, Expected 1", an, len(assoc_info), qcn) return FAIL @@ -140,18 +140,19 @@ def verify_values(assoc_info, vssd_cs_values, an, qcn): return compare_all_prop(vssd_cs_assoc, vssd_cs_values) def build_sd_info(sd_assoc_info, qcn, an, rasd_values): - sd_info = {} + sd_info = [] # Building the input for SettingsDefineState association. for sd_val in sd_assoc_info: if sd_val['SystemName'] == test_dom: classname_keyvalue = sd_val['CreationClassName'] deviceid = sd_val['DeviceID'] - sd_info[classname_keyvalue] = deviceid + print "system, deviceid", test_dom, deviceid + sd_info.append((classname_keyvalue, deviceid)) # Expect the SystemDevice records == len(rasd_values) entries. if len(sd_info) != len(rasd_values): - logger.error("%s returned %i %s objects, Expected %i", an, + logger.error("build_sd_info %s returned %i %s objects, Expected %i", an, len(sd_info), qcn, len(rasd_values)) return FAIL, sd_info @@ -171,7 +172,7 @@ def get_cs_sysdev_info(server, virt, qcn, rasd_val): CreationClassName=cs_class, Name=test_dom) if len(sd_assoc) < 1: - raise Exception("%s returned %d %s objects" \ + raise Exception("get_cs_sysdev_info %s returned %d %s objects" \ % (an, len(sd_assoc), qcn)) status, sd_info = build_sd_info(sd_assoc, qcn, an, rasd_val) @@ -180,18 +181,18 @@ def get_cs_sysdev_info(server, virt, qcn, rasd_val): % test_dom) except Exception, details: - logger.error("Exception details: %s", details) + logger.error("get_cs_sysdev_info Exception details: %s", details) return FAIL, dom_cs, sd_info return PASS, dom_cs, sd_info def get_sds_info(server, virt, cs_cn, rasd_values, in_setting_define_state, qcn): - sds_info = {} + sds_info = [] try: an = get_typed_class(virt,"SettingsDefineState") - for cn, devid in sorted(in_setting_define_state.items()): + for cn, devid in in_setting_define_state: assoc_info = Associators(server, an, cn, DeviceID = devid, CreationClassName = cn, SystemName = test_dom, @@ -200,29 +201,29 @@ def get_sds_info(server, virt, cs_cn, rasd_values, # we expect only one RASD record to be returned for each device # type when queried with SDS association. if len(assoc_info) != 1: - raise Exception("%s returned %d %s objects, Expected 1" \ - % (an, len(assoc_info), cn)) - + raise Exception("get_sds_info %s returned %d %s objects, " + "Expected 1" % (an, len(assoc_info), cn)) + assoc_val = assoc_info[0] CCName = assoc_val.classname - exp_rasd = rasd_values[CCName] - if assoc_val['InstanceID'] != exp_rasd.InstanceID: - raise Exception("Got %s instead of %s" \ - % (assoc_val['InstanceID'], - exp_rasd.InstanceID)) + InstanceID = assoc_val['InstanceID'] + if (CCName,InstanceID) not in rasd_values: + raise Exception("get_sds_info cannot find (%s,%s) " + "in rasd_values" % (CCName,InstanceID)) # Build the input required for VSSDC association query. vs_name = assoc_val['InstanceID'] if vs_name.find(test_dom) >= 0: instid = assoc_val['InstanceID'] - sds_info[CCName] = instid + sds_info.append((CCName,instid)) if len(sds_info) != len(rasd_values): - raise Exception("%s returned %i %s objects, Expected %i" \ - % (an, len(sds_info), qcn, len(rasd_values))) + raise Exception("get_sds_info %s returned %i %s objects, " + " Expected %i" % \ + (an, len(sds_info), qcn, len(rasd_values))) except Exception, details: - logger.error("Exception: %s", details) + logger.error("get_sds_info Exception: %s", details) return FAIL, sds_info return PASS, sds_info @@ -243,7 +244,7 @@ def get_vssd_info(server, virt, in_vssdc_list, qcn): raise Exception("Instance matching %s was not returned" % test_dom) an = get_typed_class(virt, 'VirtualSystemSettingDataComponent') - for cn, instid in sorted((in_vssdc_list.items())): + for cn, instid in in_vssdc_list: status, vssd_assoc_info = get_associators_info(server, cn, an, vssd_class, instid) @@ -255,7 +256,7 @@ def get_vssd_info(server, virt, in_vssdc_list, qcn): raise Exception("VSSD values verification error") except Exception, details: - logger.error("Exception details: %s", details) + logger.error("get_vssd_info Exception details: %s", details) return FAIL, vssd_assoc_info return PASS, vssd_assoc_info @@ -279,7 +280,7 @@ def verify_vssdc_assoc(server, virt, cs_class, vssd_assoc_info, dom_cs): status = verify_values(cs_assoc_info, dom_cs, an, cs_class) except Exception, details: - logger.error("Exception details: %s", details) + logger.error("verify_vssd_assoc Exception details: %s", details) return FAIL return status @@ -318,7 +319,7 @@ def main(): vssd_assoc_info, dom_cs) except Exception, details: - logger.error("Exception details is %s", details) + logger.error("main Exception details is %s", details) status = FAIL vsxml.cim_destroy(server) diff --git a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py index fe0f2cc..48f0d2f 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py +++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py @@ -138,14 +138,14 @@ def get_assoc_info(server, cn, an, qcn, name, vsxml): return status, assoc_info def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): - in_setting_define_state = {} + in_setting_define_state = [] status = PASS try: for i in range(len(sd_assoc_info)): if sd_assoc_info[i]['SystemName'] == test_dom: classname_keyvalue = sd_assoc_info[i]['CreationClassName'] deviceid = sd_assoc_info[i]['DeviceID'] - in_setting_define_state[classname_keyvalue] = deviceid + in_setting_define_state.append((classname_keyvalue,deviceid)) status, rasd_values, in_list = rasd_init_list(vsxml, virt, test_disk, test_dom, @@ -156,7 +156,7 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): an = get_typed_class(virt, 'SettingsDefineState') sccn = get_typed_class(virt, 'ComputerSystem') - for cn, devid in sorted(in_setting_define_state.items()): + for cn, devid in in_setting_define_state: assoc_info = Associators(server, an, cn, @@ -170,8 +170,9 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): status = FAIL break index = (len(assoc_info) - 1) + assoc_val = assoc_info[index] rasd = rasd_values[cn] - CCName = assoc_info[index].classname + CCName = assoc_val.classname if 'ProcResourceAllocationSettingData' in CCName: status = verify_procrasd_values(assoc_info[index], rasd) elif 'NetResourceAllocationSettingData' in CCName: @@ -189,7 +190,7 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): else: status = FAIL if status != PASS: - logger.error("Mistmatching association values" ) + logger.error("Mismatching association values" ) break except Exception, detail: print_err(CIM_ERROR_ASSOCIATORS, detail, an) diff --git a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py index c847781..92cdd80 100644 --- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py +++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py @@ -64,7 +64,7 @@ test_mem = 128 test_mac = "00:11:22:33:44:aa" def init_rasd_list(virt, ip): - rasd_insts = {} + rasd_insts = [] rasds, status = enum_rasds(virt, ip) if status != PASS: logger.error("Enum RASDs failed") @@ -78,7 +78,7 @@ def init_rasd_list(virt, ip): return rasd_insts, FAIL if guest == test_dom: - rasd_insts[rasd.Classname] = rasd + rasd_insts.append(rasd) return rasd_insts, PASS @@ -102,9 +102,19 @@ def verify_rasd(virt, ip, assoc_info): logger.error("VSSDC should not have returned info for dom %s", guest) return FAIL - + logger.info("Verifying: %s", rasd.classname) - exp_rasd = rasds[rasd.classname] + # Find our rasd + exp_rasd = None + for r in rasds: + if r.Classname == rasd.classname and \ + r.InstanceID == rasd['InstanceId']: + exp_rasd = r + break; + if exp_rasd is None: + logger.error("Could not find %s,%s in rasds", + rasd.classname, rasd['InstanceId']) + return FAIL status = compare_all_prop(rasd, exp_rasd) if status != PASS: return status diff --git a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py index bef114d..5c51f0f 100644 --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py @@ -67,7 +67,7 @@ def setup_env(server, virt): def init_rasd_list(virt, ip, guest_name): disk_rasd_cn = get_typed_class(virt, "DiskResourceAllocationSettingData") - rasd_insts = {} + rasd_insts = [] rasds, status = enum_rasds(virt, ip) if status != PASS: @@ -85,7 +85,7 @@ def init_rasd_list(virt, ip, guest_name): return rasd_insts, FAIL if guest == guest_name: - rasd_insts[rasd.Classname] = rasd + rasd_insts.append((rasd.Classname, rasd)) return rasd_insts, PASS @@ -171,12 +171,12 @@ def main(): if status != PASS: raise Exception("Unable to build pool instance list") - if len(rasds) != len(pools): - raise Exception("%d RASD insts != %d pool insts" % (len(rasds), - len(pools))) + # There can be more than one instance per rasd class, such as is + # the case for controllers, so we cannot compare the number of + # elements in each. an = get_typed_class(virt, "ResourceAllocationFromPool") - for rasd_cn, rasd in rasds.iteritems(): + for rasd_cn, rasd in rasds: pool = AssociatorNames(server, an, rasd_cn, diff --git a/suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py b/suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py index fc1590d..9005b67 100644 --- a/suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py +++ b/suites/libvirt-cim/cimtest/ServiceAffectsElement/01_forward.py @@ -64,11 +64,11 @@ sae_assoc_with_input_graphics_rev = 795 test_dom = "SAE_dom" def get_dom_records(an_cn, assoc_ei_info, assoc_ei_insts): - + for assoc_ei_item in assoc_ei_info: rec = None CCN = assoc_ei_item['CreationClassName'] - if 'DisplayController' in CCN or 'PointingDevice' in CCN : + if 'DisplayController' in CCN or 'PointingDevice' in CCN : guest, dev, status = parse_instance_id(assoc_ei_item['DeviceID']) if status != PASS: logger.error("Unable to parse DeviceID") @@ -84,11 +84,8 @@ def get_dom_records(an_cn, assoc_ei_info, assoc_ei_insts): "%s association", CCN, an_cn) return assoc_ei_insts, FAIL - if not CCN in assoc_ei_insts.keys() and rec != None: - assoc_ei_insts[CCN]=rec - elif rec != None and (CCN in assoc_ei_insts.keys()): - logger.error("Got more than one record for '%s'", CCN) - return assoc_ei_insts, FAIL + if rec is not None: + assoc_ei_insts.append(rec) return assoc_ei_insts, PASS @@ -100,7 +97,7 @@ def init_list_for_compare(server, virt): c_list.append('PointingDevice' ) c_list.append('DisplayController') - init_list = {} + init_list = [] for name in c_list: c_name = get_typed_class(virt, name) ei_details = EnumInstances(server, c_name, ret_cim_inst=True) @@ -110,33 +107,43 @@ def init_list_for_compare(server, virt): return init_list, PASS - def verify_assoc(server, virt, an, assoc_info): - assoc_insts = {} + assoc_insts = [] try: assoc_insts, status = get_dom_records(an, assoc_info, assoc_insts) if status != PASS or len(assoc_insts) < 1 : raise Exception("Failed to get insts for domain %s" % test_dom) in_list, status = init_list_for_compare(server, virt) - if status != PASS or len(in_list) != 3: + if status != PASS: raise Exception("Failed to get init_list") - in_list_keys = Set(in_list.keys()) - assoc_list_keys = Set(assoc_insts.keys()) - if len(in_list_keys & assoc_list_keys) < 1 : - raise Exception("Mistmatching Class Names, expected %s, got %s" \ - % (in_list_keys, assoc_list_keys)) - - for cname, prop in in_list.iteritems(): - logger.info("Verifying Values for '%s'", cname) - exp_vals = in_list[cname].items() - res_vals = assoc_insts[cname].items() - for i in range(0, len(prop)): - if exp_vals[i][1] != res_vals[i][1]: + if len(in_list) != len(assoc_insts): + raise Exception("in_list len=%d != assoc_insts len=%d", + len(in_inst), len(assoc_insts)) + + in_list_ccns = [] + assoc_insts_ccns = [] + for i in in_list: + in_list_ccns.append(i['CreationClassName']) + for a in assoc_insts: + assoc_insts_ccns.append(a['CreationClassName']) + if in_list_ccns != assoc_insts_ccns: + raise Exception("Mismatching Class Names, expected %s, got %s" \ + % (in_list_ccns, assoc_insts_ccns)) + + for exp_vals, res_vals in zip(in_list, assoc_insts): + if len(exp_vals) != len(res_vals): + raise Exception("'%s' mismatching element count exp=%d res=%d" \ + % (exp_vals['CreationClassName'], \ + len(exp_vals), len(res_vals))) + + for key in exp_vals.keys(): + if exp_vals[key] != res_vals[key]: logger.error("'%s' val mismatch for '%s': " \ - "got '%s', expected '%s'", exp_vals[i][0], - cname, res_vals[i][1], exp_vals[i][1]) + "got '%s', expected '%s'", + exp_vals['CreationClassName'], key, + res_vals[key], exp_vals[key]) return FAIL except Exception, details: diff --git a/suites/libvirt-cim/cimtest/ServiceAffectsElement/02_reverse.py b/suites/libvirt-cim/cimtest/ServiceAffectsElement/02_reverse.py index 391ad42..d8340aa 100644 --- a/suites/libvirt-cim/cimtest/ServiceAffectsElement/02_reverse.py +++ b/suites/libvirt-cim/cimtest/ServiceAffectsElement/02_reverse.py @@ -62,7 +62,7 @@ dc_dev_rev = 725 test_dom = "SAE_dom" def get_dom_records(cn, ei_info): - ei_insts = {} + ei_insts = [] for ei_item in ei_info: rec = None CCN = ei_item['CreationClassName'] @@ -82,11 +82,8 @@ def get_dom_records(cn, ei_info): "%s association", CCN, cn) return ei_insts, FAIL - if not CCN in ei_insts.keys() and rec != None: - ei_insts[CCN]=rec - elif rec != None and (CCN in ei_insts.keys()): - logger.error("Got more than one record for '%s'", CCN) - return ei_insts, FAIL + if rec is not None: + ei_insts.append((CCN, rec)) return ei_insts, PASS @@ -99,17 +96,20 @@ def init_list_for_assoc(server, virt): if curr_cim_rev >= dc_dev_rev: c_list.append('DisplayController') - key_dict = {} + in_list = [] for name in c_list: - init_list = {} c_name = get_typed_class(virt, name) ei_details = EnumNames(server, c_name) init_list, status = get_dom_records(c_name, ei_details) if status != PASS: return init_list, FAIL - key_dict[c_name] = dict(init_list[c_name].keybindings) - return key_dict, PASS + # List is returned as paired list of all bindings of the + # type ccn (or c_list). + for ccn, elem in init_list: + in_list.append((ccn, dict(elem.keybindings))) + + return in_list, PASS @do_main(sup_types) @@ -139,7 +139,7 @@ def main(): raise Exception("'%s' returned %i records, expected 1" \ % (c_name, len(crs))) - for cn, value in in_list.iteritems(): + for cn, value in in_list: logger.info("Verifying '%s' association with '%s'", an, cn) if 'ComputerSystem' in cn: assoc_info = Associators(server, an, cn, diff --git a/suites/libvirt-cim/cimtest/SettingsDefine/02_reverse.py b/suites/libvirt-cim/cimtest/SettingsDefine/02_reverse.py index 1917113..8cec0e3 100644 --- a/suites/libvirt-cim/cimtest/SettingsDefine/02_reverse.py +++ b/suites/libvirt-cim/cimtest/SettingsDefine/02_reverse.py @@ -93,7 +93,7 @@ def setup_env(server, virt): def init_rasd_list(virt, ip, guest_name): proc_rasd_cn = get_typed_class(virt, "ProcResourceAllocationSettingData") - rasd_insts = {} + rasd_insts = [] rasds, status = enum_rasds(virt, ip) if status != PASS: @@ -108,12 +108,12 @@ def init_rasd_list(virt, ip, guest_name): return rasd_insts, FAIL if guest == guest_name: - rasd_insts[rasd.Classname] = rasd + rasd_insts.append((rasd.Classname, rasd)) return rasd_insts, PASS def init_device_list(virt, ip, guest_name): - dev_insts = {} + dev_insts = [] devs, status = enum_dev(virt, ip) if status != PASS: @@ -128,7 +128,7 @@ def init_device_list(virt, ip, guest_name): return dev_insts, FAIL if guest == guest_name: - dev_insts[dev.Classname] = dev + dev_insts.append((dev.Classname, dev)) return dev_insts, PASS @@ -140,11 +140,15 @@ def verify_rasd(virt, enum_list, rasds): status = FAIL for rasd in enum_list: - exp_rasd = rasds[rasd.classname] - - if rasd['InstanceID'] != exp_rasd.InstanceID: - logger.error("Got %s instead of %s", rasd['InstanceID'], - exp_rasd.InstanceID) + exp_rasd = None + for c, r in rasds: + if r.Classname == rasd.classname and \ + r.InstanceID == rasd['InstanceId']: + exp_rasd = r + break + if exp_rasd is None: + logger.error("Could not find %s, %s in rasds", + rasd.classname, rasd['InstanceID']) return FAIL status = compare_all_prop(rasd, exp_rasd) @@ -161,10 +165,16 @@ def verify_devices(enum_list, devs): logger.error("Got %d %s devices, expected 1", len(enum_list), dev_cn) return FAIL - exp_dev = devs[dev_cn] - - if dev['DeviceID'] != exp_dev.DeviceID: - logger.error("Got %s instead of %s", dev['DeviceID'], exp_dev.DeviceID) + exp_dev = None + for c,d in devs: + if dev_cn == d.Classname and dev['DeviceID'] == d.DeviceID: + exp_dev = d + break + if exp_dev is None: + logger.error("Did not find %s, %s in passed devs list", + dev_cn, dev['DeviceID']) + for c,d in devs: + logger.error("devs class=%s id=%s", c, d.DeviceID) return FAIL status = compare_all_prop(dev, exp_dev) -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:53 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:53 -0400 Subject: [Libvirt-cim] [PATCH 04/10] cimtest: VSSDC - 02-reverse.py - adjust iteration of association In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-5-git-send-email-jferlan@redhat.com> Upcoming changes to libvirt-cim allow for multiple types of objects per class name for the Input class and a new upcoming Controller class. Adjust the logic in the code to change the iteration to handle the situation where there could be more than one type of device in the class. An innocent bystander of this change was the extra check in the code: if status == FAIL and virt == "LXC": return XFAIL_RC(bug_libvirt) Since I wasn't sure what this was testing and perhaps it's actually been fixed - I removed the check. If it's still a bug, then it needs to be fixed and there's only one way to find out! Signed-off-by: John Ferlan --- .../02_reverse.py | 102 ++++++++++++--------- 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py index 3a13b2a..1a2218b 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -63,18 +63,6 @@ test_vcpus = 1 test_mem = 128 test_mac = "00:11:22:33:44:aa" -def check_rasd_values(id, exp_id): - try: - if id != exp_id: - logger.error("Returned %s instead of %s", id, exp_id) - return FAIL - - except Exception, detail : - logger.error("Exception evaluating InstanceID: %s", detail) - return FAIL - - return PASS - def assoc_values(ip, assoc_info, virt="Xen"): """ The association info of @@ -99,8 +87,11 @@ def assoc_values(ip, assoc_info, virt="Xen"): } + expect_rasds = len(rasd_list) + try: - if len(assoc_info) <= 0: + assoc_count = len(assoc_info) + if assoc_count <= 0: logger.error("No RASD instances returned") return FAIL @@ -111,34 +102,63 @@ def assoc_values(ip, assoc_info, virt="Xen"): input_cn = get_typed_class(virt, 'InputResourceAllocationSettingData') grap_cn = get_typed_class(virt, 'GraphicsResourceAllocationSettingData') - for inst in assoc_info: - if inst.classname == proc_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['proc_rasd']) - elif inst.classname == net_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['net_rasd']) - elif inst.classname == disk_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['disk_rasd']) - elif inst.classname == mem_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['mem_rasd']) - elif inst.classname == input_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['input_rasd']) - if status == FAIL and virt == "LXC": - return XFAIL_RC(bug_libvirt) - elif inst.classname == grap_cn: - status = check_rasd_values(inst['InstanceID'], - rasd_list['grap_rasd']) - else: - logger.error("Unexpected RASD instance type" ) - status = FAIL - - if status == FAIL: - logger.error("Mistmatching association value" ) - break + rasd_cns = [proc_cn, net_cn, disk_cn, mem_cn, input_cn, grap_cn] + + # Iterate over the rasds, looking for the expected InstanceID + # listed in the rasd_list dictionary for the same classname in + # the returned assoc_info list + try: + found_rasds = 0 + # Keep track of what worked + found_list = {} + assoc_list = {} + for cn in rasd_cns: + for rasd_key, rasd_value in rasd_list.iteritems(): + for j, inst in enumerate(assoc_info): + if inst.classname == cn and \ + inst['InstanceID'] == rasd_value: + #found_list.append((rasd_key, rasd_value)) + found_list.update({rasd_key: rasd_value}) + assoc_list.update({rasd_value: cn}) + found_rasds += 1 + except Exception, detail: + logger.error("Exception evaluating InstanceID: %s", detail) + for (i,j) in found_list: + logger.error("Found cn=%s exp_id=%s", i, j) + return FAIL + + # Check for errors + if expect_rasds != found_rasds: + logger.error("RASD instances don't match expect=%d found=%d.", + expect_rasds, found_rasds) + status = FAIL + # What did we expect to find from the rasd_list, but did not + # find in the found_list (key'd by rasd name)? + # This means we're missing some device or perhaps the + # InstanceID format changed... + for k, v in rasd_list.iteritems(): + if k not in found_list: + logger.error("rasd_list ('%s','%s') not in found_list", + k , v) + # Thankfully the alternative is not possible - after all how + # could there be something in the found list that isn't in the + # rasd_list to start with... + + if assoc_count != found_rasds: + status = FAIL + logger.error("Assoc instances don't match expect=%d found=%d.", + assoc_count, found_rasds) + # What's in the assoc_info that's not in found assoc_list (key'd + # by InstanceID) + # Meaning there's a new device type that we haven't accounted for + for j, inst in enumerate(assoc_info): + if inst['InstanceID'] not in assoc_list: + logger.error("Did not find association id=%s in assoc_list", + inst['InstanceID']) + # Thankfully the alternative is not possible - after all how + # could there be something in the found list that isn't in the + # assoc_info list to start with... + except Exception, detail : logger.error("Exception in assoc_values function: %s", detail) -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:54 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:54 -0400 Subject: [Libvirt-cim] [PATCH 05/10] XenKvmLib: Add controller device In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-6-git-send-email-jferlan@redhat.com> Add support to handle a controller device variantly based up on the libvirt-cim revision value Signed-off-by: John Ferlan --- suites/libvirt-cim/lib/XenKvmLib/devices.py | 6 ++++ suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 25 ++++++++++++++ suites/libvirt-cim/lib/XenKvmLib/vsms.py | 24 +++++++++++++ suites/libvirt-cim/lib/XenKvmLib/vxml.py | 39 +++++++++++++++++----- 5 files changed, 86 insertions(+), 10 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/devices.py b/suites/libvirt-cim/lib/XenKvmLib/devices.py index 0ddccbb..5f26fa9 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py @@ -33,6 +33,7 @@ from XenKvmLib.enumclass import EnumInstances graphics_dev_rev = 725 input_dev_rev = 745 +controller_dev_rev = 1310 def get_class(classname): return eval(classname) @@ -99,6 +100,8 @@ def dev_cn_to_rasd_cn(dev_cn, virt): return get_typed_class(virt, "GraphicsResourceAllocationSettingData") elif dev_cn.find('PointingDevice') >= 0: return get_typed_class(virt, "InputResourceAllocationSettingData") + elif dev_cn.find('Controller') >= 0: + return get_typed_class(virt, "ControllerResourceAllocationSettingData") else: return None @@ -112,6 +115,9 @@ def enum_dev(virt, ip): if curr_cim_rev >= input_dev_rev: dev_list.append('PointingDevice') + if curr_cim_rev >= controller_dev_rev and virt == 'KVM': + dev_list.append('Controller') + dev_insts = {} try: diff --git a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py index 744e864..5db36ca 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py +++ b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py @@ -57,7 +57,7 @@ def spec_err(fieldvalue, field_list, fieldname): def verify_device_values(assoc_info, list_values, virt='Xen'): dev_cnames = ['LogicalDisk', 'Memory', 'NetworkPort', 'Processor', \ - 'DisplayController', 'PointingDevice'] + 'DisplayController', 'PointingDevice', 'Controller'] for i in range(len(dev_cnames)): dev_cnames[i] = get_typed_class(virt, dev_cnames[i]) diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index 4d4240a..21dd7e4 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -40,6 +40,7 @@ dasd_cn = 'DiskResourceAllocationSettingData' masd_cn = 'MemResourceAllocationSettingData' dcrasd_cn = 'GraphicsResourceAllocationSettingData' irasd_cn = 'InputResourceAllocationSettingData' +ctlrasd_cn = 'ControllerResourceAllocationSettingData' dpasd_cn = 'DiskPoolResourceAllocationSettingData' npasd_cn = 'NetPoolResourceAllocationSettingData' svrasd_cn = 'StorageVolumeResourceAllocationSettingData' @@ -51,6 +52,7 @@ netcn = 'NetworkPort' diskcn = 'LogicalDisk' dccn = 'DisplayController' pdcn = 'PointingDevice' +ctlcn = 'Controller' libvirt_rasd_storagepool_changes = 934 @@ -65,12 +67,14 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): disk_cn = get_typed_class(virt, diskcn) dc_cn = get_typed_class(virt, dccn) pd_cn = get_typed_class(virt, pdcn) + ctl_cn = get_typed_class(virt, ctlcn) in_list = { 'proc' : proc_cn, 'mem' : mem_cn, 'net' : net_cn, 'disk' : disk_cn, 'display' : dc_cn, + 'controller' : ctl_cn, 'point' : pd_cn } try: @@ -113,6 +117,18 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): dc_cn : { "InstanceID" : "%s/%s" %(t_dom, "vnc") }, + # There can be more than one controller defined for + # any system - usually there are 3, one each for usb, + # pci, and ide. The InstanceID is formatted using + # the string "controller" and the type/string of the + # controller, and the index id found. That index can + # vary. Thus our verify_controllerrasd_values will + # just ensure the "base" is valid - that is the + # guest name and "controller" string. + ctl_cn : { + "InstanceID" : "%s/%s:" \ + %(t_dom, "controller") + }, pd_cn : { "InstanceID" : point_device } @@ -143,6 +159,15 @@ def InstId_err(assoc_info, list): logger.error("Returned %s instead of %s", assoc_info['InstanceID'], list['InstanceID']) +def verify_controllerrasd_values(assoc_info, controllerrasd_list): + status = PASS + print 'assoc', assoc_info['InstanceID'] + print 'ctrlr', controllerrasd_list['InstanceID'] + if controllerrasd_list['InstanceID'] not in assoc_info['InstanceID']: + InstId_err(assoc_info, controllerrasd_list) + status = FAIL + return status + def verify_displayrasd_values(assoc_info, displayrasd_list): status = PASS if assoc_info['InstanceID'] != displayrasd_list['InstanceID']: diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms.py b/suites/libvirt-cim/lib/XenKvmLib/vsms.py index d7f33f9..3da309c 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py @@ -36,6 +36,7 @@ RASD_TYPE_DISK = 17 RASD_TYPE_GRAPHICS = 24 RASD_TYPE_INPUT = 13 RASD_TYPE_STOREVOL = 32768 +RASD_TYPE_CONTROLLER = 32771 VIRT_DISK_TYPE_DISK = 0 VIRT_DISK_TYPE_CDROM = 1 @@ -324,6 +325,29 @@ class LXC_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingD def get_iasd_class(virt): pass +class CIM_ControllerResourceAllocationSettingData(CIMClassMOF): + def __init__(self, name, ctl_sub_type=None, ctl_index=-1, ctl_model=None): + self.InstanceID = '%s/controller:' % name + self.ResourceType = RASD_TYPE_CONTROLLER + + if ctl_sub_type is not None: + self.ResourceSubType = ctl_sub_type + self.InstanceID += '%s' % ctl_sub_type + + if ctl_index >= 0: + self.Index = ctl_index + self.InstanceID += ':%d' % ctl_index + + if ctl_model is not None: + self.Model = ctl_model + +class KVM_ControllerResourceAllocationSettingData(CIM_ControllerResourceAllocationSettingData): + pass + + at eval_cls('ControllerResourceAllocationSettingData') +def get_ctlasd_class(virt): + pass + def default_vssd_rasd_str(dom_name='test_domain', disk_dev='xvda', disk_source=const.Xen_disk_path, diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index 74c4f23..ad80aae 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -53,6 +53,8 @@ from XenKvmLib.const import get_provider_version vsms_graphics_sup = 763 vsms_inputdev_sup = 771 +vsms_controller_sup = 1310 + class XMLClass: xml_string = "" @@ -598,7 +600,8 @@ class VirtCIM: def __init__(self, virt, dom_name, uuid, pae, acpi, apic, disk_dev, disk_source, net_type, net_name, net_mac, vcpus, mem, mem_allocunits, emu_type, grstype, ip, - is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd): + is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd, + ctltype, ctlindex, ctlmodel): self.virt = virt self.domain_name = dom_name self.err_rc = None @@ -629,6 +632,14 @@ class VirtCIM: self.iasd = vsms.get_iasd_class(virt)(name=dom_name, res_sub_type=irstype, bus_type=btype) + if virt == 'KVM': + self.ctlasd = vsms.get_ctlasd_class(virt)(name=dom_name, + ctl_sub_type=ctltype, + ctl_index=ctlindex, + ctl_model=ctlmodel) + else: + self.ctlasd = None + self.res_settings = [] def cim_define(self, ip, ref_conf=None): @@ -658,6 +669,9 @@ class VirtCIM: if self.iasd is not None: res_settings.append(str(self.iasd)) + if curr_cim_rev > vsms_controller_sup and self.ctlasd is not None: + res_settings.append(str(self.ctlasd)) + if ref_conf is None: ref_conf = ' ' @@ -849,7 +863,8 @@ class XenXML(VirtXML, VirtCIM): emu_type=None, grstype="vnc", address=None, is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", - btype="xen", vnc_passwd=None): + btype="xen", vnc_passwd=None, + ctltype=None, ctlindex=-1, ctlmodel=None): if not (os.path.exists(const.Xen_kernel_path) \ and os.path.exists(const.Xen_init_path)): logger.error('ERROR: Either the kernel image ' @@ -863,7 +878,7 @@ class XenXML(VirtXML, VirtCIM): disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, is_ipv6_only, port_num, keymap, irstype, btype, - vnc_passwd) + vnc_passwd, ctltype, ctlindex, ctlmodel) def _os(self, os_kernel, os_initrd): os = self.get_node('/domain/os') @@ -920,7 +935,10 @@ class KVMXML(VirtXML, VirtCIM): emu_type=None, grstype="vnc", address=None, is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", - btype="ps2", vnc_passwd=None): + btype="ps2", vnc_passwd=None, + ctltype="pci", ctlindex=0, ctlmodel="pci-root"): + # Optionally the following works too: + #ctltype="usb", ctlindex=0, ctlmodel=None): if not os.path.exists(disk_file_path): logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) @@ -929,7 +947,7 @@ class KVMXML(VirtXML, VirtCIM): disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, is_ipv6_only, port_num, keymap, irstype, btype, - vnc_passwd) + vnc_passwd, ctltype, ctlindex, ctlmodel) self._os() self._devices(const.KVM_default_emulator, ntype, disk_file_path, disk, mac, net_name) @@ -983,7 +1001,8 @@ class XenFVXML(VirtXML, VirtCIM): emu_type=None, grstype="vnc", address=None, is_ipv6_only=None, port_num='-1', keymap="en-us", - irstype="mouse", btype="ps2", vnc_passwd=None): + irstype="mouse", btype="ps2", vnc_passwd=None, + ctltype=None, ctlindex=-1, ctlmodel=None): if not os.path.exists(disk_file_path): logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) @@ -992,7 +1011,8 @@ class XenFVXML(VirtXML, VirtCIM): disk_file_path, ntype, net_name, mac, vcpus, mem, mem_allocunits, emu_type, grstype, address, is_ipv6_only, port_num, - keymap, irstype, btype, vnc_passwd) + keymap, irstype, btype, vnc_passwd, + ctltype, ctlindex, ctlmodel) self._os(const.XenFV_default_loader) self._devices(const.XenFV_default_emulator, ntype, mac, net_name, disk_file_path, disk) @@ -1036,7 +1056,8 @@ class LXCXML(VirtXML, VirtCIM): tty=const.LXC_default_tty, grstype="vnc", address=None, is_ipv6_only=None, port_num='-1', keymap="en-us", - irstype="mouse", btype="usb", vnc_passwd=None): + irstype="mouse", btype="usb", vnc_passwd=None, + ctltype=None, ctlindex=-1, ctlmodel=None): VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus) # pae, acpi and apic parameters doesn't make sense here, so we # statically set them to False (a.k.a. ignore them) @@ -1045,7 +1066,7 @@ class LXCXML(VirtXML, VirtCIM): ntype, net_name, mac, vcpus, mem, const.default_mallocunits, None, grstype, address, is_ipv6_only, port_num, keymap, irstype, - btype, vnc_passwd) + btype, vnc_passwd, ctltype, ctlindex, ctlmodel) self._os(const.LXC_init_path) self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty) self.create_lxc_file(CIM_IP, const.LXC_init_path) -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:55 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:55 -0400 Subject: [Libvirt-cim] [PATCH 06/10] cimtest: Add controller RASD support In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-7-git-send-email-jferlan@redhat.com> Add controller RASD's to various tests. Signed-off-by: John Ferlan --- .../cimtest/HostSystem/02_hostsystem_to_rasd.py | 4 +++- suites/libvirt-cim/cimtest/SystemDevice/01_forward.py | 9 ++++++++- suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py | 8 ++++++-- .../VirtualSystemSettingDataComponent/02_reverse.py | 14 +++++++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py index 48f0d2f..828dd9f 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py +++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py @@ -58,7 +58,7 @@ CIM_ERROR_ASSOCIATORS from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \ verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \ -rasd_init_list, verify_inputrasd_values +rasd_init_list, verify_inputrasd_values, verify_controllerrasd_values libvirt_bug = "00009" sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] @@ -183,6 +183,8 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): status = verify_memrasd_values(assoc_info[index], rasd) elif 'GraphicsResourceAllocationSettingData' in CCName: status = verify_displayrasd_values(assoc_info[index], rasd) + elif 'ControllerResourceAllocationSettingData' in CCName: + status = verify_controllerrasd_values(assoc_info[index], rasd) elif 'InputResourceAllocationSettingData' in CCName: status = verify_inputrasd_values(assoc_info[index], rasd) if status != PASS and virt == 'LXC': diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py index 15a4ff5..d363895 100644 --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py @@ -36,6 +36,7 @@ from CimTest.ReturnCodes import PASS, FAIL sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] input_graphics_pool_rev = 757 +controller_rev = 1310 test_dom = "test_domain" test_mac = "00:11:22:33:44:55" @@ -106,6 +107,7 @@ def main(): disk_cn = get_typed_class(virt, "LogicalDisk") exp_pllist[disk_cn] = [ '%s/%s' % (test_dom, test_disk)] + curr_cim_rev, changeset = get_provider_version(virt, server) if virt != 'LXC': net_cn = get_typed_class(virt, "NetworkPort") exp_pllist[net_cn] = ['%s/%s' % (test_dom, test_mac)] @@ -115,11 +117,16 @@ def main(): for i in range(test_cpu): exp_pllist[proc_cn].append( '%s/%s' % (test_dom, i)) - curr_cim_rev, changeset = get_provider_version(virt, server) if curr_cim_rev >= input_graphics_pool_rev: graphics_cn = get_typed_class(virt, "DisplayController") exp_pllist[graphics_cn] = ['%s/vnc' % test_dom] + # Need a version check too + if curr_cim_rev >= controller_rev and virt == 'KVM': + controller_cn = get_typed_class(virt, "Controller") + exp_pllist[controller_cn] = [] + exp_pllist[controller_cn].append('%s/controller:pci:0' % test_dom) + exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) try: res_pllist = {} diff --git a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py index 04b0b6e..bac0876 100755 --- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py +++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py @@ -54,7 +54,7 @@ from XenKvmLib.classes import get_typed_class from XenKvmLib import rasd from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \ verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \ -rasd_init_list, verify_inputrasd_values +rasd_init_list, verify_inputrasd_values, verify_controllerrasd_values from XenKvmLib.const import default_network_name libvirt_bug = "00009" @@ -172,6 +172,7 @@ def verify_rasd_values(rasd_values_info, server): diskrasd = rasd_values_list['%s' %in_list['disk']] memrasd = rasd_values_list['%s' %in_list['mem']] displayrasd = rasd_values_list['%s' %in_list['display']] + controllerrasd = rasd_values_list['%s' %in_list['controller']] inputrasd = rasd_values_list['%s' %in_list['point']] try: @@ -187,6 +188,9 @@ def verify_rasd_values(rasd_values_info, server): status = verify_memrasd_values(rasd_instance, memrasd) elif 'GraphicsResourceAllocationSettingData' in CCName : status = verify_displayrasd_values(rasd_instance, displayrasd) + elif 'ControllerResourceAllocationSettingData' in CCName : + status = verify_controllerrasd_values(rasd_instance, + controllerrasd) elif 'InputResourceAllocationSettingData' in CCName: status = verify_inputrasd_values(rasd_instance, inputrasd) if status != PASS and virt== 'LXC': @@ -194,7 +198,7 @@ def verify_rasd_values(rasd_values_info, server): else: status = FAIL if status != PASS: - logger.error("Mistmatching %s values", CCName ) + logger.error("Mismatching %s values", CCName ) break except Exception, detail : logger.error("Exception in verify_rasd_values function: %s", detail) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py index 1a2218b..2f0bdd4 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -52,7 +52,7 @@ from XenKvmLib.test_doms import destroy_and_undefine_all from XenKvmLib import vxml from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS -from XenKvmLib.const import do_main +from XenKvmLib.const import do_main, get_provider_version from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC bug_libvirt = "00009" @@ -63,6 +63,8 @@ test_vcpus = 1 test_mem = 128 test_mac = "00:11:22:33:44:aa" +controller_rev = 1310 + def assoc_values(ip, assoc_info, virt="Xen"): """ The association info of @@ -87,6 +89,12 @@ def assoc_values(ip, assoc_info, virt="Xen"): } + curr_cim_rev, changeset = get_provider_version(virt, ip) + if curr_cim_rev >= controller_rev and virt == 'KVM': + # Add controllers too ... will need a cim/cimtest version check + rasd_list.update({"pci_rasd":"%s/controller:pci:0" % test_dom}) + rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) + expect_rasds = len(rasd_list) try: @@ -101,8 +109,12 @@ def assoc_values(ip, assoc_info, virt="Xen"): mem_cn = get_typed_class(virt, 'MemResourceAllocationSettingData') input_cn = get_typed_class(virt, 'InputResourceAllocationSettingData') grap_cn = get_typed_class(virt, 'GraphicsResourceAllocationSettingData') + ctl_cn = get_typed_class(virt, 'ControllerResourceAllocationSettingData') + # REVISIT - VERSION CHECK? rasd_cns = [proc_cn, net_cn, disk_cn, mem_cn, input_cn, grap_cn] + if curr_cim_rev >= controller_rev and virt == 'KVM': + rasd_cns.append(ctl_cn) # Iterate over the rasds, looking for the expected InstanceID # listed in the rasd_list dictionary for the same classname in -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:56 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:56 -0400 Subject: [Libvirt-cim] [PATCH 07/10] XenKvmLib: Add controller pool In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-8-git-send-email-jferlan@redhat.com> Add support to have a controller pool for the controller RASD Signed-off-by: John Ferlan --- suites/libvirt-cim/lib/XenKvmLib/pool.py | 6 ++++++ suites/libvirt-cim/lib/XenKvmLib/rasd.py | 2 ++ suites/libvirt-cim/lib/XenKvmLib/vxml.py | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py index ddbe532..59555ae 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py @@ -44,6 +44,7 @@ cim_mname = "CreateChildResourcePool" input_graphics_pool_rev = 757 libvirt_cim_child_pool_rev = 837 libvirt_rasd_spool_del_changes = 971 +libvirt_controller_rev = 1312 DIR_POOL = 1L FS_POOL = 2L @@ -69,6 +70,8 @@ def pool_cn_to_rasd_cn(pool_cn, virt): return get_typed_class(virt, "GraphicsResourceAllocationSettingData") elif pool_cn.find('InputPool') >= 0: return get_typed_class(virt, "InputResourceAllocationSettingData") + elif pool_cn.find('ControllerPool') >= 0: + return get_typed_class(virt, "ControllerResourceAllocationSettingData") else: return None @@ -80,6 +83,9 @@ def enum_pools(virt, ip): pool_list.append('GraphicsPool') pool_list.append('InputPool') + if curr_cim_rev >= libvirt_controller_rev and virt == 'KVM': + pool_list.append('ControllerPool') + pool_insts = {} try: diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index 21dd7e4..e7ef4e9 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -321,6 +321,8 @@ def rasd_cn_to_pool_cn(rasd_cn, virt): return get_typed_class(virt, "GraphicsPool") elif rasd_cn.find('InputResourceAllocationSettingData') >= 0: return get_typed_class(virt, "InputPool") + elif rasd_cn.find('ControllerResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "ControllerPool") else: return None diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index ad80aae..3bea13c 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -669,7 +669,8 @@ class VirtCIM: if self.iasd is not None: res_settings.append(str(self.iasd)) - if curr_cim_rev > vsms_controller_sup and self.ctlasd is not None: + if curr_cim_rev > vsms_controller_sup and self.ctlasd is not None and \ + self.virt == 'KVM': res_settings.append(str(self.ctlasd)) if ref_conf is None: -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:57 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:57 -0400 Subject: [Libvirt-cim] [PATCH 08/10] cimtest: Add controller pool support In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-9-git-send-email-jferlan@redhat.com> Add support for controller pools Signed-off-by: John Ferlan --- suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py | 4 ++++ suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py | 1 + suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py | 3 +++ suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py | 7 ++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py index 133b8a1..6cc874a 100644 --- a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py +++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py @@ -36,6 +36,7 @@ from XenKvmLib.classes import get_typed_class sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] input_graphics_pool_rev = 757 +controller_pool_rev = 1312 def enum_pools(ip, ac_cn, virt): pt = [get_typed_class(virt, 'MemoryPool'), @@ -48,6 +49,9 @@ def enum_pools(ip, ac_cn, virt): pt.append(get_typed_class(virt, 'GraphicsPool')) pt.append(get_typed_class(virt, 'InputPool')) + if curr_rev >= controller_pool_rev and virt == 'KVM': + pt.append(get_typed_class(virt, 'ControllerPool')) + pools = {} try: diff --git a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py index 8a96677..62f3112 100644 --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py @@ -54,6 +54,7 @@ def set_pool_info(server, virt, valid_elc_id): valid_elc_id = append_to_list(server, virt, "NetworkPool", valid_elc_id) valid_elc_id = append_to_list(server, virt, "GraphicsPool", valid_elc_id) valid_elc_id = append_to_list(server, virt, "InputPool", valid_elc_id) + valid_elc_id = append_to_list(server, virt, "ControllerPool", valid_elc_id) except Exception, details: logger.error("Exception: In fn set_pool_info(): %s", details) diff --git a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py index bd9c42b..614a795 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py +++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py @@ -96,6 +96,9 @@ def pool_init_list(virt, pool_assoc, net_name, dp_InstID): exp_pllist[mpool] = 'MemoryPool/0' exp_pllist[gpool] = 'GraphicsPool/0' exp_pllist[ipool] = 'InputPool/0' + if virt == 'KVM': + cpool = get_typed_class(virt, 'ControllerPool') + exp_pllist[cpool] = 'ControllerPool/0' for p_inst in pool_assoc: CName = p_inst.classname diff --git a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py index 2c6cbaf..cf2c999 100755 --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py @@ -36,6 +36,8 @@ from XenKvmLib.const import do_main, default_pool_name from XenKvmLib.classes import get_typed_class input_graphics_pool_rev = 757 +controller_pool_rev = 1312 + sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] @do_main(sup_types) def main(): @@ -71,6 +73,7 @@ def main(): mpool = get_typed_class(virt, 'MemoryPool') exp_pllist = { mpool : ['MemoryPool/0'] } + curr_cim_rev, changeset = get_provider_version(virt, options.ip) if virt != 'LXC': npool = get_typed_class(virt, 'NetworkPool') dpool = get_typed_class(virt, 'DiskPool') @@ -79,12 +82,14 @@ def main(): exp_pllist[npool] = ['NetworkPool/%s' %default_network_name] exp_pllist[ppool] = ['ProcessorPool/0'] - curr_cim_rev, changeset = get_provider_version(virt, options.ip) if curr_cim_rev >= input_graphics_pool_rev: ipool = get_typed_class(virt, 'InputPool') gpool = get_typed_class(virt, 'GraphicsPool') exp_pllist[ipool] = ['InputPool/0'] exp_pllist[gpool] = ['GraphicsPool/0'] + if curr_cim_rev >= controller_pool_rev and virt == 'KVM': + cpool = get_typed_class(virt, 'ControllerPool') + exp_pllist[cpool] = ['ControllerPool/0'] try: res_pllist = {} -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:58 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:58 -0400 Subject: [Libvirt-cim] [PATCH 09/10] XenKvmLib: Add keyboard input RASD In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-10-git-send-email-jferlan@redhat.com> A keyboard input device has been added to libvirt 1.2.2 - adjust the code to handle that for 1.2.2 and later. Signed-off-by: John Ferlan --- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index e7ef4e9..3679678 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -53,6 +53,8 @@ diskcn = 'LogicalDisk' dccn = 'DisplayController' pdcn = 'PointingDevice' ctlcn = 'Controller' +# libvirt 1.2.2 adds a keyboard for (at least) KVM hypervisors +kybdcn = 'Keyboard' libvirt_rasd_storagepool_changes = 934 @@ -68,6 +70,7 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): dc_cn = get_typed_class(virt, dccn) pd_cn = get_typed_class(virt, pdcn) ctl_cn = get_typed_class(virt, ctlcn) + kybd_cn = get_typed_class(virt, kybdcn) in_list = { 'proc' : proc_cn, 'mem' : mem_cn, @@ -77,14 +80,20 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): 'controller' : ctl_cn, 'point' : pd_cn } + libvirt_version = virsh_version(server, virt) + # libvirt 1.2.2 adds a keyboard as an input option for KVM domains + # so we need to handle that + has_kybd = False + if virt == 'KVM' and virsh_version_cmp(libvirt_version, "1.2.2") >= 0: + in_list.update({'keyboard':kybd_cn}) + has_kybd = True + try: disk_path = vsxml.xml_get_disk_source() if virt == 'LXC': disk_path = '/var/lib/libvirt/images/lxc_files' - libvirt_version = virsh_version(server, virt) - if virt == 'LXC' or (virt == 'XenFV' and \ virsh_version_cmp(libvirt_version, "0.6.3") < 0): point_device = "%s/%s" %(t_dom, "mouse:usb") @@ -92,6 +101,7 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): point_device = "%s/%s" %(t_dom, "mouse:xen") else: point_device = "%s/%s" %(t_dom, "mouse:ps2") + keyboard_device = "%s/%s" %(t_dom, "keyboard:ps2") rasd_values = { proc_cn : { "InstanceID" : '%s/%s' %(t_dom, "proc"), @@ -133,6 +143,12 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): "InstanceID" : point_device } } + if has_kybd: + rasd_values.update({kybd_cn: + { + "InstanceID" : keyboard_device + } + }) except Exception, details: logger.error("Exception: In fn rasd_init_list %s", details) return FAIL, rasd_values, in_list -- 1.8.5.3 From jferlan at redhat.com Fri Apr 4 16:12:59 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 4 Apr 2014 12:12:59 -0400 Subject: [Libvirt-cim] [PATCH 10/10] cimtest: Add support for keyboard input device In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <1396627979-12534-11-git-send-email-jferlan@redhat.com> Modify the various tests to add support for a keyboard input device which was added to libvirt 1.2.2 for KVM Signed-off-by: John Ferlan --- .../cimtest/HostSystem/02_hostsystem_to_rasd.py | 12 ++++++++++-- .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 10 +++++++++- suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py | 19 ++++++++++++++++++- .../VirtualSystemSettingDataComponent/02_reverse.py | 20 ++++++++++++++------ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py index 828dd9f..3355f5d 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py +++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py @@ -170,9 +170,10 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): status = FAIL break index = (len(assoc_info) - 1) - assoc_val = assoc_info[index] rasd = rasd_values[cn] + assoc_val = assoc_info[index] CCName = assoc_val.classname + InstanceID = assoc_val['InstanceID'] if 'ProcResourceAllocationSettingData' in CCName: status = verify_procrasd_values(assoc_info[index], rasd) elif 'NetResourceAllocationSettingData' in CCName: @@ -185,7 +186,14 @@ def verify_RASD_values(server, sd_assoc_info, vsxml, virt="Xen"): status = verify_displayrasd_values(assoc_info[index], rasd) elif 'ControllerResourceAllocationSettingData' in CCName: status = verify_controllerrasd_values(assoc_info[index], rasd) - elif 'InputResourceAllocationSettingData' in CCName: + elif 'InputResourceAllocationSettingData' in CCName and \ + virt == 'KVM' and 'keyboard' in InstanceID : + # Force the issue - dictionary is keyed this way if + # there is a keyboard device supported + rasd = rasd_values['KVM_Keyboard'] + status = verify_inputrasd_values(assoc_info[index], rasd) + elif 'InputResourceAllocationSettingData' in CCName and \ + 'keyboard' not in InstanceID: status = verify_inputrasd_values(assoc_info[index], rasd) if status != PASS and virt == 'LXC': return XFAIL_RC(libvirt_bug) diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py index d363895..f81aff1 100644 --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py @@ -32,6 +32,7 @@ from XenKvmLib import vxml from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger from XenKvmLib.const import do_main, get_provider_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import PASS, FAIL sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] @@ -101,8 +102,15 @@ def main(): point_device = "%s/%s" %(test_dom, "mouse:xen") else: point_device = "%s/%s" %(test_dom, "mouse:ps2") + keybd_device = "%s/%s" %(test_dom, "keyboard:ps2") + libvirt_version = virsh_version(server, virt) - exp_pllist[input_cn] = [point_device] + # libvirt 1.2.2 adds a keyboard as an input option for KVM domains + # so we need to handle that + if virt == 'KVM' and virsh_version_cmp(libvirt_version, "1.2.2") >= 0: + exp_pllist[input_cn] = [point_device, keybd_device] + else: + exp_pllist[input_cn] = [point_device] disk_cn = get_typed_class(virt, "LogicalDisk") exp_pllist[disk_cn] = [ '%s/%s' % (test_dom, test_disk)] diff --git a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py index bac0876..86cd6a9 100755 --- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py +++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py @@ -51,6 +51,7 @@ from XenKvmLib.test_doms import destroy_and_undefine_all from XenKvmLib import assoc from XenKvmLib.vxml import get_class from XenKvmLib.classes import get_typed_class +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib import rasd from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \ verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \ @@ -175,9 +176,19 @@ def verify_rasd_values(rasd_values_info, server): controllerrasd = rasd_values_list['%s' %in_list['controller']] inputrasd = rasd_values_list['%s' %in_list['point']] + # libvirt 1.2.2 adds a keyboard as an input option for KVM domains + # so we need to handle that + has_keybd = False + if virt == 'KVM': + libvirt_version = virsh_version(server, virt) + if virsh_version_cmp(libvirt_version, "1.2.2") >= 0: + keybdrasd = rasd_values_list['%s' %in_list['keyboard']] + has_keybd = True + try: for rasd_instance in rasd_values_info: CCName = rasd_instance.classname + InstanceID = rasd_instance['InstanceID'] if 'ProcResourceAllocationSettingData' in CCName: status = verify_procrasd_values(rasd_instance, procrasd) elif 'NetResourceAllocationSettingData' in CCName : @@ -191,7 +202,13 @@ def verify_rasd_values(rasd_values_info, server): elif 'ControllerResourceAllocationSettingData' in CCName : status = verify_controllerrasd_values(rasd_instance, controllerrasd) - elif 'InputResourceAllocationSettingData' in CCName: + elif 'InputResourceAllocationSettingData' in CCName and \ + virt == 'KVM' and 'keyboard' in InstanceID : + # Force the issue - dictionary is keyed this way if + # there is a keyboard device supported + status = verify_displayrasd_values(rasd_instance, keybdrasd) + elif 'InputResourceAllocationSettingData' in CCName and \ + 'keyboard' not in InstanceID: status = verify_inputrasd_values(rasd_instance, inputrasd) if status != PASS and virt== 'LXC': return XFAIL_RC(libvirt_bug) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py index 2f0bdd4..a7e6c17 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -51,6 +51,7 @@ from XenKvmLib import assoc from XenKvmLib.test_doms import destroy_and_undefine_all from XenKvmLib import vxml from XenKvmLib.classes import get_typed_class +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS from XenKvmLib.const import do_main, get_provider_version from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC @@ -78,6 +79,7 @@ def assoc_values(ip, assoc_info, virt="Xen"): input_device = "mouse:xen" else: input_device = "mouse:ps2" + keybd_device = "keyboard:ps2" rasd_list = { "proc_rasd" : '%s/%s' %(test_dom, "proc"), @@ -86,14 +88,21 @@ def assoc_values(ip, assoc_info, virt="Xen"): "mem_rasd" : '%s/%s' %(test_dom, "mem"), "input_rasd": '%s/%s' %(test_dom, input_device), "grap_rasd" : '%s/%s' %(test_dom, "vnc") - } curr_cim_rev, changeset = get_provider_version(virt, ip) - if curr_cim_rev >= controller_rev and virt == 'KVM': - # Add controllers too ... will need a cim/cimtest version check - rasd_list.update({"pci_rasd":"%s/controller:pci:0" % test_dom}) - rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) + if virt == 'KVM': + # libvirt 1.2.2 adds a keyboard as an input option for KVM domains + # so we need to handle that + libvirt_version = virsh_version(ip, virt) + if virsh_version_cmp(libvirt_version, "1.2.2") >= 0: + rasd_list.update({"keybd_rasd": + '%s/%s' %(test_dom, keybd_device)}) + + if curr_cim_rev >= controller_rev: + # Add controllers too ... will need a cim/cimtest version check + rasd_list.update({"pci_rasd":"%s/controller:pci:0" % test_dom}) + rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) expect_rasds = len(rasd_list) @@ -111,7 +120,6 @@ def assoc_values(ip, assoc_info, virt="Xen"): grap_cn = get_typed_class(virt, 'GraphicsResourceAllocationSettingData') ctl_cn = get_typed_class(virt, 'ControllerResourceAllocationSettingData') - # REVISIT - VERSION CHECK? rasd_cns = [proc_cn, net_cn, disk_cn, mem_cn, input_cn, grap_cn] if curr_cim_rev >= controller_rev and virt == 'KVM': rasd_cns.append(ctl_cn) -- 1.8.5.3 From gesaint at linux.vnet.ibm.com Mon Apr 14 05:57:02 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Mon, 14 Apr 2014 13:57:02 +0800 Subject: [Libvirt-cim] [PATCH 08/10] cimtest: Add controller pool support In-Reply-To: <1396627979-12534-9-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-9-git-send-email-jferlan@redhat.com> Message-ID: <534B78AE.8080907@linux.vnet.ibm.com> ? 2014?04?05? 00:12, John Ferlan ??: > Add support for controller pools > > Signed-off-by: John Ferlan > --- > suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py | 4 ++++ > suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py | 1 + > suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py | 3 +++ > suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py | 7 ++++++- > 4 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py > index 133b8a1..6cc874a 100644 > --- a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py > +++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py > @@ -36,6 +36,7 @@ from XenKvmLib.classes import get_typed_class > > sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] > input_graphics_pool_rev = 757 > +controller_pool_rev = 1312 > > def enum_pools(ip, ac_cn, virt): > pt = [get_typed_class(virt, 'MemoryPool'), > @@ -48,6 +49,9 @@ def enum_pools(ip, ac_cn, virt): > pt.append(get_typed_class(virt, 'GraphicsPool')) > pt.append(get_typed_class(virt, 'InputPool')) > > + if curr_rev >= controller_pool_rev and virt == 'KVM': > + pt.append(get_typed_class(virt, 'ControllerPool')) > + I have applied all patches for libvirt-cim you submitted and run cimtest with these 10 patches. But here I got: curr_rev=1309, controller_pool_rev=1312, (of course that caused if missed) and virt=KVM. Could you give me some suggestion about that? What should I do to get the right answer or, if something around the code should be updated? > pools = {} > > try: > diff --git a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py > index 8a96677..62f3112 100644 > --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py > +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py > @@ -54,6 +54,7 @@ def set_pool_info(server, virt, valid_elc_id): > valid_elc_id = append_to_list(server, virt, "NetworkPool", valid_elc_id) > valid_elc_id = append_to_list(server, virt, "GraphicsPool", valid_elc_id) > valid_elc_id = append_to_list(server, virt, "InputPool", valid_elc_id) > + valid_elc_id = append_to_list(server, virt, "ControllerPool", valid_elc_id) > > except Exception, details: > logger.error("Exception: In fn set_pool_info(): %s", details) > diff --git a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py > index bd9c42b..614a795 100644 > --- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py > +++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py > @@ -96,6 +96,9 @@ def pool_init_list(virt, pool_assoc, net_name, dp_InstID): > exp_pllist[mpool] = 'MemoryPool/0' > exp_pllist[gpool] = 'GraphicsPool/0' > exp_pllist[ipool] = 'InputPool/0' > + if virt == 'KVM': > + cpool = get_typed_class(virt, 'ControllerPool') > + exp_pllist[cpool] = 'ControllerPool/0' > > for p_inst in pool_assoc: > CName = p_inst.classname > diff --git a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py > index 2c6cbaf..cf2c999 100755 > --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py > +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py > @@ -36,6 +36,8 @@ from XenKvmLib.const import do_main, default_pool_name > from XenKvmLib.classes import get_typed_class > > input_graphics_pool_rev = 757 > +controller_pool_rev = 1312 > + > sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] > @do_main(sup_types) > def main(): > @@ -71,6 +73,7 @@ def main(): > > mpool = get_typed_class(virt, 'MemoryPool') > exp_pllist = { mpool : ['MemoryPool/0'] } > + curr_cim_rev, changeset = get_provider_version(virt, options.ip) > if virt != 'LXC': > npool = get_typed_class(virt, 'NetworkPool') > dpool = get_typed_class(virt, 'DiskPool') > @@ -79,12 +82,14 @@ def main(): > exp_pllist[npool] = ['NetworkPool/%s' %default_network_name] > exp_pllist[ppool] = ['ProcessorPool/0'] > > - curr_cim_rev, changeset = get_provider_version(virt, options.ip) > if curr_cim_rev >= input_graphics_pool_rev: > ipool = get_typed_class(virt, 'InputPool') > gpool = get_typed_class(virt, 'GraphicsPool') > exp_pllist[ipool] = ['InputPool/0'] > exp_pllist[gpool] = ['GraphicsPool/0'] > + if curr_cim_rev >= controller_pool_rev and virt == 'KVM': > + cpool = get_typed_class(virt, 'ControllerPool') > + exp_pllist[cpool] = ['ControllerPool/0'] > > try: > res_pllist = {} From cngesaint at gmail.com Mon Apr 14 06:15:54 2014 From: cngesaint at gmail.com (Xu Wang) Date: Mon, 14 Apr 2014 14:15:54 +0800 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <1396627979-12534-2-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> Message-ID: <534B7D1A.2090501@gmail.com> ? 2014?04?05? 00:12, John Ferlan ??: > Rather than default to socket.gethostbyaddr(socket.gethostname())[0] to > get full_hostname(), go through a sequence of steps to get a more > correct result > > NOTE: > See http://www.redhat.com/archives/libvirt-cim/2013-November/msg00082.html > for more details and history. > > Signed-off-by: John Ferlan > --- > lib/VirtLib/live.py | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py > index c929e71..e9cafc1 100644 > --- a/lib/VirtLib/live.py > +++ b/lib/VirtLib/live.py > @@ -100,6 +100,11 @@ def hostname(server): > return out > > def full_hostname(server): > - """To return the fully qualifiec domain name(FQDN) of the system""" > - > - return socket.gethostbyaddr(socket.gethostname())[0] > + """To return the fully qualified domain name(FQDN) of the system""" > + > + if socket.getfqdn().find('.') >= 0: > + return socket.getfqdn() > + elif socket.gethostname().find('.') >= 0: > + return socket.gethostname() > + else: > + return socket.gethostbyaddr(server)[1][0] I got an error here. The content of my /etc/hosts is, # cat /etc/hosts 127.0.0.1 RH64wenchao localhost localhost.localdomain localhost4 localhost4.localdomain4 #RH64wenchao And I got an failed result, # CIM_NS=root/virt CIM_USER=root CIM_PASS=****** ./runtests libvirt-cim -i localhost -c -d -v KVM -g HostSystem -t 01_enum.py Starting test suite: libvirt-cim Cleaned log files. Testing KVM hypervisor -------------------------------------------------------------------- HostSystem - 01_enum.py: FAIL ERROR - Exp KVM_HostSystem, got KVM_HostSystem ERROR - Exp localhost.localdomain, got RH64wenchao CIM_ERR_INVALID_CLASS: Linux_ComputerSystem -------------------------------------------------------------------- It means that @host and @hs[0].Name get the different value. I think it may happened when a computer has more than one hostname. My suggestion is @host make a string match with content of every element of @hs[] to check if @host is contained in it. Thanks, Xu Wang From gesaint at linux.vnet.ibm.com Mon Apr 14 06:51:09 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Mon, 14 Apr 2014 14:51:09 +0800 Subject: [Libvirt-cim] [PATCH 05/10] XenKvmLib: Add controller device In-Reply-To: <1396627979-12534-6-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-6-git-send-email-jferlan@redhat.com> Message-ID: <534B855D.1000408@linux.vnet.ibm.com> ? 2014?04?05? 00:12, John Ferlan ??: > Add support to handle a controller device variantly based up on the > libvirt-cim revision value > > Signed-off-by: John Ferlan > --- > suites/libvirt-cim/lib/XenKvmLib/devices.py | 6 ++++ > suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py | 2 +- > suites/libvirt-cim/lib/XenKvmLib/rasd.py | 25 ++++++++++++++ > suites/libvirt-cim/lib/XenKvmLib/vsms.py | 24 +++++++++++++ > suites/libvirt-cim/lib/XenKvmLib/vxml.py | 39 +++++++++++++++++----- > 5 files changed, 86 insertions(+), 10 deletions(-) > > diff --git a/suites/libvirt-cim/lib/XenKvmLib/devices.py b/suites/libvirt-cim/lib/XenKvmLib/devices.py > index 0ddccbb..5f26fa9 100755 > --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py > @@ -33,6 +33,7 @@ from XenKvmLib.enumclass import EnumInstances > > graphics_dev_rev = 725 > input_dev_rev = 745 > +controller_dev_rev = 1310 > > def get_class(classname): > return eval(classname) > @@ -99,6 +100,8 @@ def dev_cn_to_rasd_cn(dev_cn, virt): > return get_typed_class(virt, "GraphicsResourceAllocationSettingData") > elif dev_cn.find('PointingDevice') >= 0: > return get_typed_class(virt, "InputResourceAllocationSettingData") > + elif dev_cn.find('Controller') >= 0: > + return get_typed_class(virt, "ControllerResourceAllocationSettingData") > else: > return None > > @@ -112,6 +115,9 @@ def enum_dev(virt, ip): > if curr_cim_rev >= input_dev_rev: > dev_list.append('PointingDevice') > > + if curr_cim_rev >= controller_dev_rev and virt == 'KVM': > + dev_list.append('Controller') > + > dev_insts = {} > > try: > diff --git a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py > index 744e864..5db36ca 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py > @@ -57,7 +57,7 @@ def spec_err(fieldvalue, field_list, fieldname): > > def verify_device_values(assoc_info, list_values, virt='Xen'): > dev_cnames = ['LogicalDisk', 'Memory', 'NetworkPort', 'Processor', \ > - 'DisplayController', 'PointingDevice'] > + 'DisplayController', 'PointingDevice', 'Controller'] > for i in range(len(dev_cnames)): > dev_cnames[i] = get_typed_class(virt, dev_cnames[i]) > > diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py > index 4d4240a..21dd7e4 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py > @@ -40,6 +40,7 @@ dasd_cn = 'DiskResourceAllocationSettingData' > masd_cn = 'MemResourceAllocationSettingData' > dcrasd_cn = 'GraphicsResourceAllocationSettingData' > irasd_cn = 'InputResourceAllocationSettingData' > +ctlrasd_cn = 'ControllerResourceAllocationSettingData' > dpasd_cn = 'DiskPoolResourceAllocationSettingData' > npasd_cn = 'NetPoolResourceAllocationSettingData' > svrasd_cn = 'StorageVolumeResourceAllocationSettingData' > @@ -51,6 +52,7 @@ netcn = 'NetworkPort' > diskcn = 'LogicalDisk' > dccn = 'DisplayController' > pdcn = 'PointingDevice' > +ctlcn = 'Controller' > > libvirt_rasd_storagepool_changes = 934 > > @@ -65,12 +67,14 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): > disk_cn = get_typed_class(virt, diskcn) > dc_cn = get_typed_class(virt, dccn) > pd_cn = get_typed_class(virt, pdcn) > + ctl_cn = get_typed_class(virt, ctlcn) > > in_list = { 'proc' : proc_cn, > 'mem' : mem_cn, > 'net' : net_cn, > 'disk' : disk_cn, > 'display' : dc_cn, > + 'controller' : ctl_cn, > 'point' : pd_cn > } > try: > @@ -113,6 +117,18 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): > dc_cn : { > "InstanceID" : "%s/%s" %(t_dom, "vnc") > }, > + # There can be more than one controller defined for > + # any system - usually there are 3, one each for usb, > + # pci, and ide. The InstanceID is formatted using > + # the string "controller" and the type/string of the > + # controller, and the index id found. That index can > + # vary. Thus our verify_controllerrasd_values will > + # just ensure the "base" is valid - that is the > + # guest name and "controller" string. > + ctl_cn : { > + "InstanceID" : "%s/%s:" \ > + %(t_dom, "controller") > + }, > pd_cn : { > "InstanceID" : point_device > } > @@ -143,6 +159,15 @@ def InstId_err(assoc_info, list): > logger.error("Returned %s instead of %s", > assoc_info['InstanceID'], list['InstanceID']) > > +def verify_controllerrasd_values(assoc_info, controllerrasd_list): > + status = PASS > + print 'assoc', assoc_info['InstanceID'] > + print 'ctrlr', controllerrasd_list['InstanceID'] > + if controllerrasd_list['InstanceID'] not in assoc_info['InstanceID']: > + InstId_err(assoc_info, controllerrasd_list) > + status = FAIL > + return status > + > def verify_displayrasd_values(assoc_info, displayrasd_list): > status = PASS > if assoc_info['InstanceID'] != displayrasd_list['InstanceID']: > diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms.py b/suites/libvirt-cim/lib/XenKvmLib/vsms.py > index d7f33f9..3da309c 100755 > --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py > @@ -36,6 +36,7 @@ RASD_TYPE_DISK = 17 > RASD_TYPE_GRAPHICS = 24 > RASD_TYPE_INPUT = 13 > RASD_TYPE_STOREVOL = 32768 > +RASD_TYPE_CONTROLLER = 32771 > > VIRT_DISK_TYPE_DISK = 0 > VIRT_DISK_TYPE_CDROM = 1 > @@ -324,6 +325,29 @@ class LXC_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingD > def get_iasd_class(virt): > pass > > +class CIM_ControllerResourceAllocationSettingData(CIMClassMOF): > + def __init__(self, name, ctl_sub_type=None, ctl_index=-1, ctl_model=None): > + self.InstanceID = '%s/controller:' % name > + self.ResourceType = RASD_TYPE_CONTROLLER > + > + if ctl_sub_type is not None: > + self.ResourceSubType = ctl_sub_type > + self.InstanceID += '%s' % ctl_sub_type > + > + if ctl_index >= 0: > + self.Index = ctl_index > + self.InstanceID += ':%d' % ctl_index > + > + if ctl_model is not None: > + self.Model = ctl_model > + > +class KVM_ControllerResourceAllocationSettingData(CIM_ControllerResourceAllocationSettingData): > + pass > + > + at eval_cls('ControllerResourceAllocationSettingData') > +def get_ctlasd_class(virt): > + pass > + > def default_vssd_rasd_str(dom_name='test_domain', > disk_dev='xvda', > disk_source=const.Xen_disk_path, > diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > index 74c4f23..ad80aae 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > @@ -53,6 +53,8 @@ from XenKvmLib.const import get_provider_version > > vsms_graphics_sup = 763 > vsms_inputdev_sup = 771 > +vsms_controller_sup = 1310 > + > > class XMLClass: > xml_string = "" > @@ -598,7 +600,8 @@ class VirtCIM: > def __init__(self, virt, dom_name, uuid, pae, acpi, apic, disk_dev, > disk_source, net_type, net_name, net_mac, vcpus, mem, > mem_allocunits, emu_type, grstype, ip, > - is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd): > + is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd, > + ctltype, ctlindex, ctlmodel): > self.virt = virt > self.domain_name = dom_name > self.err_rc = None > @@ -629,6 +632,14 @@ class VirtCIM: > self.iasd = vsms.get_iasd_class(virt)(name=dom_name, > res_sub_type=irstype, > bus_type=btype) > + if virt == 'KVM': > + self.ctlasd = vsms.get_ctlasd_class(virt)(name=dom_name, > + ctl_sub_type=ctltype, > + ctl_index=ctlindex, > + ctl_model=ctlmodel) > + else: > + self.ctlasd = None > + > self.res_settings = [] > > def cim_define(self, ip, ref_conf=None): > @@ -658,6 +669,9 @@ class VirtCIM: > if self.iasd is not None: > res_settings.append(str(self.iasd)) > > + if curr_cim_rev > vsms_controller_sup and self.ctlasd is not None: > + res_settings.append(str(self.ctlasd)) > + Here I got a similar error, curr_cim_rev=1309 but vsms_controller_sup=1310. Hence I got the following result, # CIM_NS=root/virt CIM_USER=root CIM_PASS=****** ./runtests libvirt-cim -i localhost -c -d -v KVM -g RASD -t 03_rasd_errs.py Starting test suite: libvirt-cim Cleaned log files. Testing KVM hypervisor -------------------------------------------------------------------- RASD - 03_rasd_errs.py: FAIL ERROR - Expected 6 RASDs, got 7 -------------------------------------------------------------------- Do I need to update value of @curren_cim_rev and how to change it? Thanks, Xu Wang > if ref_conf is None: > ref_conf = ' ' > > @@ -849,7 +863,8 @@ class XenXML(VirtXML, VirtCIM): > emu_type=None, grstype="vnc", address=None, > is_ipv6_only=None, > port_num='-1', keymap="en-us", irstype="mouse", > - btype="xen", vnc_passwd=None): > + btype="xen", vnc_passwd=None, > + ctltype=None, ctlindex=-1, ctlmodel=None): > if not (os.path.exists(const.Xen_kernel_path) \ > and os.path.exists(const.Xen_init_path)): > logger.error('ERROR: Either the kernel image ' > @@ -863,7 +878,7 @@ class XenXML(VirtXML, VirtCIM): > disk_file_path, ntype, net_name, mac, vcpus, mem, > mem_allocunits, emu_type, grstype, address, > is_ipv6_only, port_num, keymap, irstype, btype, > - vnc_passwd) > + vnc_passwd, ctltype, ctlindex, ctlmodel) > > def _os(self, os_kernel, os_initrd): > os = self.get_node('/domain/os') > @@ -920,7 +935,10 @@ class KVMXML(VirtXML, VirtCIM): > emu_type=None, grstype="vnc", address=None, > is_ipv6_only=None, > port_num='-1', keymap="en-us", irstype="mouse", > - btype="ps2", vnc_passwd=None): > + btype="ps2", vnc_passwd=None, > + ctltype="pci", ctlindex=0, ctlmodel="pci-root"): > + # Optionally the following works too: > + #ctltype="usb", ctlindex=0, ctlmodel=None): > if not os.path.exists(disk_file_path): > logger.error('Error: Disk image %s does not exist', disk_file_path) > sys.exit(1) > @@ -929,7 +947,7 @@ class KVMXML(VirtXML, VirtCIM): > disk_file_path, ntype, net_name, mac, vcpus, mem, > mem_allocunits, emu_type, grstype, address, > is_ipv6_only, port_num, keymap, irstype, btype, > - vnc_passwd) > + vnc_passwd, ctltype, ctlindex, ctlmodel) > self._os() > self._devices(const.KVM_default_emulator, ntype, > disk_file_path, disk, mac, net_name) > @@ -983,7 +1001,8 @@ class XenFVXML(VirtXML, VirtCIM): > emu_type=None, grstype="vnc", > address=None, is_ipv6_only=None, port_num='-1', > keymap="en-us", > - irstype="mouse", btype="ps2", vnc_passwd=None): > + irstype="mouse", btype="ps2", vnc_passwd=None, > + ctltype=None, ctlindex=-1, ctlmodel=None): > if not os.path.exists(disk_file_path): > logger.error('Error: Disk image %s does not exist', disk_file_path) > sys.exit(1) > @@ -992,7 +1011,8 @@ class XenFVXML(VirtXML, VirtCIM): > disk_file_path, ntype, net_name, mac, vcpus, mem, > mem_allocunits, emu_type, grstype, address, > is_ipv6_only, port_num, > - keymap, irstype, btype, vnc_passwd) > + keymap, irstype, btype, vnc_passwd, > + ctltype, ctlindex, ctlmodel) > self._os(const.XenFV_default_loader) > self._devices(const.XenFV_default_emulator, > ntype, mac, net_name, disk_file_path, disk) > @@ -1036,7 +1056,8 @@ class LXCXML(VirtXML, VirtCIM): > tty=const.LXC_default_tty, grstype="vnc", > address=None, is_ipv6_only=None, port_num='-1', > keymap="en-us", > - irstype="mouse", btype="usb", vnc_passwd=None): > + irstype="mouse", btype="usb", vnc_passwd=None, > + ctltype=None, ctlindex=-1, ctlmodel=None): > VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus) > # pae, acpi and apic parameters doesn't make sense here, so we > # statically set them to False (a.k.a. ignore them) > @@ -1045,7 +1066,7 @@ class LXCXML(VirtXML, VirtCIM): > ntype, net_name, mac, vcpus, mem, > const.default_mallocunits, None, grstype, > address, is_ipv6_only, port_num, keymap, irstype, > - btype, vnc_passwd) > + btype, vnc_passwd, ctltype, ctlindex, ctlmodel) > self._os(const.LXC_init_path) > self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty) > self.create_lxc_file(CIM_IP, const.LXC_init_path) From gesaint at linux.vnet.ibm.com Mon Apr 14 07:43:00 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Mon, 14 Apr 2014 15:43:00 +0800 Subject: [Libvirt-cim] [PATCH v3 0/8] Add Controller Device Support In-Reply-To: <1395955117-2884-1-git-send-email-jferlan@redhat.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> Message-ID: <534B9184.1070508@linux.vnet.ibm.com> ? 2014?03?28? 05:18, John Ferlan ??: > I know this is a long cover letter, but it covers a lot of ground... > > I was just about done with all the merges this morning - I ran the cimtest > one more time and found that there's a couple of tests which associate > RASDs and Pools. So I jumped into the rabbit hole and wound my way through > the maze of twisty little passages. I even heard a babbling brook (it's an > old computer game reference). > > So here's where I'm at - I have cimtest completely passing again which keeps > me happy. Although I have a pile of cimtest related changes that will also > need to be made, but I have to wait to do them until I get a libvirt-cim > revision number to compare against so as to be able to add conditional code I just wonder how to get that revision, apply it from some organization or company? Thanks, Xu Wang > to support controllers devices, rasds, and pools. > > For now support is only for KVM. We've already determined LXC doesn't have > the concept of a controller and I have no way to test Xen. I also don't have > the cycles to dig through the Xen source code and determine what that driver > supports. If someone wants to add that - great - have at it! > > I want to put it out there for review - knowing that I probably still have > a bit of cleanup left. I think I'm going to need to add KVM specific code > to a number of places, but I figured I needed to get everything merged first > then I could determine that. I'm also hoping it'll be pointed out to me :-). > > I kept the changes split even though I know only changes 1 & 2 can be compiled > alone and run without any new cimtest failures. Each step of changes can > compile successfully/cleanly - although once you hit change 3, you'll need > to regenerate your Makefile > > Changes 1 & 2 are more or less Xu's previous patch #1. I split it for > ease of review - there's no real reason, although you will note I > have left out the addition of CONTROLLER to the cim_res_types until > patch 4... With that patch 2 will have cimtest failures. > Change 3 adds the MOF's and adjusts the install resulting in cimtest > failures because of "missing" links between MOF and code. > Change 4 adds the bulk of the code required to fill in all the fields for > the mofs from the xml/data structures. > Change 6 adds the various associations between the new elements > Change 7 adds the MOF's and modifies install/build to include ControllerPool's > Change 8 adds the code and associations for Controller Pools. Without it > there are a few cimtest failures. > > My plan is to allow review of Changes 3->8 separately, but when it comes > time to push - 3-8 could be squashed together so that the ability to bisect > history and run cimtest without too many failures isn't lost. Although I'm > also considering combining 3-6 and 7-8 for "functionality" likeness. I'll > take suggestions from the community if it's felt strongly to keep the split > as is, then so bit it. > > The following is a list of the differences between this set of changes > and what Xu posted as his v2. All I did was pull down his changes into a > clean branch, then 'git am' those changes. Then after making all my changes > a simple 'git diff' of the branches let me know what was different. > > > Makefile.am > * Copyright date > * Add controller pool > > libvirt-cim.spec.in > * Order - kept closer to DisplayController/PointingDevice > * Add controller pool > > libxkutil/device_parsing.c > * Copyright date > * Additional CU_DEBUG messages - useful in debugging free() issues > * Merged sgio/rawio changes > * cleanup_controller_device(): > * Free new controller fields for queues, ports, vectors, address > * Changed controller 'type' from "char *" to "uint16_t", no need to free > * parse_controller_device(): > * Use controller_protocol_type_StrToID() to store type integer > * Fail in "index" is not present > * Convert/store "index" as uint64_t and free "index" > * Added controller fields for queues, ports, vectors, address > * Format id as "controller::" > > libxkutil/device_parsing.h > * Copyright date > * Add CONTROLLER_INDEX_NOT_SET as -1 > * Change type to uint16_t, add uint64_t index, and char */device_address fields > > libxkutil/xmlgen.c > * Copyright date > * Change how we store fields > * Be sure to convert the "type" to it's string representation > * Handle missing/default Index value (eg from define system from vdev) > * Print out model, ports, vectors, queues, and address if present > > schema/Controller.mof > * Remove {Xen|LXC}_Controller > > schema/Controller.registration > * Remove {Xen|LXC}_Controller > > schema/ControllerPool.mof > * Add ControllerPool mof > > schema/ControllerPool.registration > * Add ControllerPool registration > > schema/ResourceAllocationSettingData.mof > * Copyright date > * Merged rawio/sgio changes > * Remove {Xen|LXC}_ControllerResourceAllocationSettingData > * Add comments and properties we care about > > schema/ResourceAllocationSettingData.registration > * Copyright date > * Remove {Xen|LXC}_ControllerResourceAllocationSettingData > > src/Virt_Device.c > * Copyright date > * Set the Virtual Controller Logical Device properties: > * ProtocolSupported <== String from controller_device->type (pci, usb, etc.) > * ProtocolDescription <== If available, string from model > * Adjusted some debug messages > * Removed incorrect setting of "Controller" property (twice) > > src/Virt_DevicePool.c > * Add ControllerPool support > > src/Virt_ElementAllocatedFromPool.c > * Copyright date > * Remove Xen/LXC associations > * Add ControllerPool > > src/Virt_ElementCapabilities.c > * Copyright date > * Add ControllerPool > > src/Virt_ElementSettingData.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_HostedResourcePool.c > * Copyright date > * Add ControllerPool > > src/Virt_RASD.c > * Copyright date > * Merged sgio/rawio changes > * set_controller_rasd_params(): > * Set the fields properly based on defintion of structure/mof > * ResourceSubType <== String-ified type (pci, usb, etc) > * Other fields set if available in data structure > * Changed vdev_device -> type to use CIM_RES_TYPE_OTHER - this is the parent > structure to the controller_device structure > > src/Virt_ResourceAllocationFromPool.c > * Copyright date > * Controller RASD Association > * ControllerPool Association > > src/Virt_ResourcePoolConfigurationService.c > * Copyright date > * Add ControllerPool > > src/Virt_ServiceAffectsElement.c > * Copyright date > * Add "Controller" to list that use get_device_by_ref() call > * Remove Xen/LXC associations > > src/Virt_SettingsDefineState.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_SystemDevice.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_VSSDComponent.c > * Copyright date > * Remove Xen/LXC associations > > src/Virt_VirtualSystemManagementService.c > * Copyright date > * Merged sgio/rawio changes > * Fix controller_rasd_to_vdev(): > * Handle the controller_device->type properly to get 'type_str' > * Build dev->id based on Index: > NOTE: I found through debugging cimtest code that on input the dev->id > is NULL. It cannot be left that way since a subsequent call to > add_device_nodup() would core on the STREQC(ptr->id, dev->id). > Thus I formulated an InstanceID with the -1. If there's another > similarly "undefined" element, it'll go through the overriding > code and be removed. > * Set other fields if present in data > * Following Boris' earlier advice, mimic the method that disks, networks, > and graphics devices use to set things up. > * Similarly for resource_del, resource_add, and resource_mod - allow > the code to do it's magic for controller devices. > * HMM: Given what I discovered about dev->id in controller_rasd_to_vdev() > described above, I wonder if the check in resource_add could ever > happen. I guess it's "safe" to keep... > > src/svpc_types.h > * Copyright date > * Add some pointers to where to find the details we're describing > * Add CIM_controller_protocol_type enum to describe the various values > * Add controller_protocol_type_StrToID() and controller_protocol_type_IDToStr() > to handle the "supported" conversions > > > > John Ferlan (3): > Associations > Add MOFS and change install for ControllerPools > Add code and associations for ControllerPool > > Xu Wang (5): > Add virtual controller device types > Parse/Store controller XML tags > Add virtual controller object definitions to mofs > Set fields in mofs for Controller Device/RASD > VSMS: Support for domains with controller devices > > Makefile.am | 6 +- > libvirt-cim.spec.in | 4 + > libxkutil/device_parsing.c | 119 ++++++++++++++++++- > libxkutil/device_parsing.h | 17 ++- > libxkutil/xmlgen.c | 74 +++++++++++- > schema/Controller.mof | 7 ++ > schema/Controller.registration | 4 + > schema/ControllerPool.mof | 6 + > schema/ControllerPool.registration | 3 + > schema/ResourceAllocationSettingData.mof | 37 +++++- > schema/ResourceAllocationSettingData.registration | 3 +- > src/Virt_Device.c | 68 ++++++++++- > src/Virt_DevicePool.c | 55 ++++++++- > src/Virt_ElementAllocatedFromPool.c | 6 +- > src/Virt_ElementCapabilities.c | 4 +- > src/Virt_ElementSettingData.c | 3 +- > src/Virt_HostedResourcePool.c | 3 +- > src/Virt_RASD.c | 57 +++++++++- > src/Virt_ResourceAllocationFromPool.c | 2 + > src/Virt_ResourcePoolConfigurationCapabilities.c | 2 +- > src/Virt_ResourcePoolConfigurationService.c | 2 + > src/Virt_ServiceAffectsElement.c | 8 +- > src/Virt_SettingsDefineState.c | 4 +- > src/Virt_SystemDevice.c | 3 +- > src/Virt_VSSDComponent.c | 3 +- > src/Virt_VirtualSystemManagementService.c | 87 +++++++++++++- > src/svpc_types.h | 132 +++++++++++++++++++++- > 27 files changed, 695 insertions(+), 24 deletions(-) > create mode 100644 schema/Controller.mof > create mode 100644 schema/Controller.registration > create mode 100644 schema/ControllerPool.mof > create mode 100644 schema/ControllerPool.registration > From gesaint at linux.vnet.ibm.com Mon Apr 14 08:19:54 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Mon, 14 Apr 2014 16:19:54 +0800 Subject: [Libvirt-cim] [PATCH v3 4/8] Set fields in mofs for Controller Device/RASD In-Reply-To: <1395955117-2884-5-git-send-email-jferlan@redhat.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> <1395955117-2884-5-git-send-email-jferlan@redhat.com> Message-ID: <534B9A2A.6050100@linux.vnet.ibm.com> ? 2014?03?28? 05:18, John Ferlan ??: > From: Xu Wang > > Set basic fields for the KVM_Controller instance based on the read XML > from the virtual controller device structure. > > Set the various KVM_ControllerRASD fields based on the read XML from > the virtual controller device structure > > Signed-off-by: John Ferlan > --- > src/Virt_Device.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- > src/Virt_RASD.c | 57 +++++++++++++++++++++++++++++++++++++++++++++- > src/svpc_types.h | 3 ++- > 3 files changed, 124 insertions(+), 4 deletions(-) > > diff --git a/src/Virt_Device.c b/src/Virt_Device.c > index 12ae6bd..60465b7 100644 > --- a/src/Virt_Device.c > +++ b/src/Virt_Device.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -366,6 +366,61 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, > return inst; > } > > +static int controller_set_attr(const CMPIBroker *broker, > + CMPIInstance *instance, > + struct controller_device *dev) > +{ > + const char *type_str; > + > + type_str = controller_protocol_type_IDToStr(dev->type); > + if (type_str == NULL) { > + CU_DEBUG("controller type=%d fails to return string", dev->type); > + return 0; > + } > + > + CMSetProperty(instance, "ProtocolSupported", > + (CMPIValue *)&dev->type, > + CMPI_uint16); > + > + if (dev->model) > + CMSetProperty(instance, "ProtocolDescription", > + (CMPIValue *)dev->model, > + CMPI_chars); > + > + return 1; > +} > + > +static CMPIInstance *controller_instance(const CMPIBroker *broker, > + struct controller_device *dev, > + const virDomainPtr dom, > + const char *ns) > +{ > + CMPIInstance *inst; > + virConnectPtr conn; > + > + CU_DEBUG("controller_instance"); > + > + conn = virDomainGetConnect(dom); > + inst = get_typed_instance(broker, > + pfx_from_conn(conn), > + "Controller", > + ns, > + true); > + if (inst == NULL) { > + CU_DEBUG("Failed to get instance of %s_Controller", > + pfx_from_conn(conn)); > + return NULL; > + } > + > + > + if (!controller_set_attr(broker, inst, dev)) { > + CU_DEBUG("Failed to set contoller attributes of %s_Controller", > + pfx_from_conn(conn)); > + return NULL; > + } > + > + return inst; > +} > static int device_set_devid(CMPIInstance *instance, > struct virt_device *dev, > const virDomainPtr dom) > @@ -488,6 +543,8 @@ static bool device_instances(const CMPIBroker *broker, > for (i = 0; i < count; i++) { > struct virt_device *dev = &devs[i]; > > + CU_DEBUG("device_instance dev->type=%d", dev->type); > + > if (dev->type == CIM_RES_TYPE_NET) > instance = net_instance(broker, > &dev->dev.net, > @@ -516,11 +573,16 @@ static bool device_instances(const CMPIBroker *broker, > &dev->dev.console, > dom, > ns); > - else if (dev->type == CIM_RES_TYPE_INPUT) > + else if (dev->type == CIM_RES_TYPE_INPUT) > instance = input_instance(broker, > &dev->dev.input, > dom, > ns); > + else if (dev->type == CIM_RES_TYPE_CONTROLLER) > + instance = controller_instance(broker, > + &dev->dev.controller, > + dom, > + ns); > else > return false; > > @@ -555,6 +617,8 @@ uint16_t res_type_from_device_classname(const char *classname) > return CIM_RES_TYPE_GRAPHICS; > else if (strstr(classname, "PointingDevice")) > return CIM_RES_TYPE_INPUT; > + else if (strstr(classname, "Controller")) > + return CIM_RES_TYPE_CONTROLLER; > else > return CIM_RES_TYPE_UNKNOWN; > } > diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c > index abfb09f..3c62c2d 100644 > --- a/src/Virt_RASD.c > +++ b/src/Virt_RASD.c > @@ -1,5 +1,5 @@ > /* > - * Copyright IBM Corp. 2007, 2013 > + * Copyright IBM Corp. 2007-2014 > * > * Authors: > * Dan Smith > @@ -915,6 +915,51 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, > return s; > } > > +static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, > + const CMPIObjectPath *ref, > + const struct virt_device *dev, > + CMPIInstance *inst) > +{ > + const char *type_str; > + CMPIStatus s = {CMPI_RC_OK, NULL}; > + > + type_str = controller_protocol_type_IDToStr(dev->dev.controller.type); > + if (type_str == NULL) { > + CU_DEBUG("controller type=%d fails to return string", > + dev->type); > + return s; > + } > + CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); > + CMSetProperty(inst, "ResourceSubType", > + (CMPIValue *)type_str, CMPI_chars); > + CMSetProperty(inst, "Index", > + (CMPIValue *)&(dev->dev.controller.index), CMPI_uint64); > + > + if (dev->dev.controller.model) > + CMSetProperty(inst, "Model", > + (CMPIValue *)dev->dev.controller.model, CMPI_chars); > + > + if (dev->dev.controller.ports) > + CMSetProperty(inst, "Ports", > + (CMPIValue *)dev->dev.controller.ports, CMPI_chars); > + > + if (dev->dev.controller.vectors) > + CMSetProperty(inst, "Vectors", > + (CMPIValue *)dev->dev.controller.vectors, CMPI_chars); > + > + if (dev->dev.controller.queues) > + CMSetProperty(inst, "Queues", > + (CMPIValue *)dev->dev.controller.queues, CMPI_chars); > + > + if (dev->dev.controller.address.ct > 0) > + set_rasd_device_address(broker, > + ref, > + &dev->dev.controller.address, > + inst); > + > + return s; > +} > + > CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, > struct virt_device *dev, > const char *host, > @@ -949,6 +994,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, > } else if (dev->type == CIM_RES_TYPE_INPUT) { > type = CIM_RES_TYPE_INPUT; > base = "InputResourceAllocationSettingData"; > + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { > + type = CIM_RES_TYPE_OTHER; I noticed that only type of controller and console device are set into CIM_RES_TYPE_OTHER. And I found only two places in this function use that macro. Why not type is CIM_RES_TYPE_CONTROLLER/CONSOLE? Thanks, Xu Wang > + base = "ControllerResourceAllocationSettingData"; > } else { > return NULL; > } > @@ -1004,6 +1052,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, > s = set_input_rasd_params(dev, inst); > } else if (dev->type == CIM_RES_TYPE_CONSOLE) { > s = set_console_rasd_params(dev, inst); > + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { > + s = set_controller_rasd_params(broker, ref, dev, inst); > } > > /* FIXME: Put the HostResource in place */ > @@ -1138,6 +1188,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) > *type = CIM_RES_TYPE_IMAGE; > else if (STREQ(base, "ConsoleResourceAllocationSettingData")) > *type = CIM_RES_TYPE_CONSOLE; > + else if (STREQ(base, "ControllerResourceAllocationSettingData")) > + *type = CIM_RES_TYPE_CONTROLLER; > else > goto out; > > @@ -1175,6 +1227,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) > case CIM_RES_TYPE_INPUT: > *classname = "InputResourceAllocationSettingData"; > break; > + case CIM_RES_TYPE_CONTROLLER: > + *classname = "ControllerResourceAllocationSettingData"; > + break; > default: > rc = CMPI_RC_ERR_FAILED; > } > diff --git a/src/svpc_types.h b/src/svpc_types.h > index d9f8032..6270233 100644 > --- a/src/svpc_types.h > +++ b/src/svpc_types.h > @@ -42,7 +42,7 @@ > #define CIM_RES_TYPE_EMU 32770 > #define CIM_RES_TYPE_CONTROLLER 32771 > > -#define CIM_RES_TYPE_COUNT 7 > +#define CIM_RES_TYPE_COUNT 8 > const static int cim_res_types[CIM_RES_TYPE_COUNT] = > {CIM_RES_TYPE_NET, > CIM_RES_TYPE_DISK, > @@ -51,6 +51,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = > CIM_RES_TYPE_GRAPHICS, > CIM_RES_TYPE_INPUT, > CIM_RES_TYPE_CONSOLE, > + CIM_RES_TYPE_CONTROLLER, > }; > > #define CIM_VSSD_RECOVERY_NONE 2 From jferlan at redhat.com Mon Apr 14 14:14:54 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 14 Apr 2014 10:14:54 -0400 Subject: [Libvirt-cim] [PATCH v3 4/8] Set fields in mofs for Controller Device/RASD In-Reply-To: <534B9A2A.6050100@linux.vnet.ibm.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> <1395955117-2884-5-git-send-email-jferlan@redhat.com> <534B9A2A.6050100@linux.vnet.ibm.com> Message-ID: <534BED5E.7040407@redhat.com> On 04/14/2014 04:19 AM, Xu Wang wrote: > > ? 2014?03?28? 05:18, John Ferlan ??: >> From: Xu Wang >> >> Set basic fields for the KVM_Controller instance based on the read XML >> from the virtual controller device structure. >> >> Set the various KVM_ControllerRASD fields based on the read XML from >> the virtual controller device structure >> >> Signed-off-by: John Ferlan >> --- >> src/Virt_Device.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- >> src/Virt_RASD.c | 57 +++++++++++++++++++++++++++++++++++++++++++++- >> src/svpc_types.h | 3 ++- >> 3 files changed, 124 insertions(+), 4 deletions(-) >> >> diff --git a/src/Virt_Device.c b/src/Virt_Device.c >> index 12ae6bd..60465b7 100644 >> --- a/src/Virt_Device.c >> +++ b/src/Virt_Device.c >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright IBM Corp. 2007 >> + * Copyright IBM Corp. 2007-2014 >> * >> * Authors: >> * Dan Smith >> @@ -366,6 +366,61 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, >> return inst; >> } >> >> +static int controller_set_attr(const CMPIBroker *broker, >> + CMPIInstance *instance, >> + struct controller_device *dev) >> +{ >> + const char *type_str; >> + >> + type_str = controller_protocol_type_IDToStr(dev->type); >> + if (type_str == NULL) { >> + CU_DEBUG("controller type=%d fails to return string", dev->type); >> + return 0; >> + } >> + >> + CMSetProperty(instance, "ProtocolSupported", >> + (CMPIValue *)&dev->type, >> + CMPI_uint16); >> + >> + if (dev->model) >> + CMSetProperty(instance, "ProtocolDescription", >> + (CMPIValue *)dev->model, >> + CMPI_chars); >> + >> + return 1; >> +} >> + >> +static CMPIInstance *controller_instance(const CMPIBroker *broker, >> + struct controller_device *dev, >> + const virDomainPtr dom, >> + const char *ns) >> +{ >> + CMPIInstance *inst; >> + virConnectPtr conn; >> + >> + CU_DEBUG("controller_instance"); >> + >> + conn = virDomainGetConnect(dom); >> + inst = get_typed_instance(broker, >> + pfx_from_conn(conn), >> + "Controller", >> + ns, >> + true); >> + if (inst == NULL) { >> + CU_DEBUG("Failed to get instance of %s_Controller", >> + pfx_from_conn(conn)); >> + return NULL; >> + } >> + >> + >> + if (!controller_set_attr(broker, inst, dev)) { >> + CU_DEBUG("Failed to set contoller attributes of %s_Controller", >> + pfx_from_conn(conn)); >> + return NULL; >> + } >> + >> + return inst; >> +} >> static int device_set_devid(CMPIInstance *instance, >> struct virt_device *dev, >> const virDomainPtr dom) >> @@ -488,6 +543,8 @@ static bool device_instances(const CMPIBroker *broker, >> for (i = 0; i < count; i++) { >> struct virt_device *dev = &devs[i]; >> >> + CU_DEBUG("device_instance dev->type=%d", dev->type); >> + >> if (dev->type == CIM_RES_TYPE_NET) >> instance = net_instance(broker, >> &dev->dev.net, >> @@ -516,11 +573,16 @@ static bool device_instances(const CMPIBroker *broker, >> &dev->dev.console, >> dom, >> ns); >> - else if (dev->type == CIM_RES_TYPE_INPUT) >> + else if (dev->type == CIM_RES_TYPE_INPUT) >> instance = input_instance(broker, >> &dev->dev.input, >> dom, >> ns); >> + else if (dev->type == CIM_RES_TYPE_CONTROLLER) >> + instance = controller_instance(broker, >> + &dev->dev.controller, >> + dom, >> + ns); >> else >> return false; >> >> @@ -555,6 +617,8 @@ uint16_t res_type_from_device_classname(const char *classname) >> return CIM_RES_TYPE_GRAPHICS; >> else if (strstr(classname, "PointingDevice")) >> return CIM_RES_TYPE_INPUT; >> + else if (strstr(classname, "Controller")) >> + return CIM_RES_TYPE_CONTROLLER; >> else >> return CIM_RES_TYPE_UNKNOWN; >> } >> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c >> index abfb09f..3c62c2d 100644 >> --- a/src/Virt_RASD.c >> +++ b/src/Virt_RASD.c >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright IBM Corp. 2007, 2013 >> + * Copyright IBM Corp. 2007-2014 >> * >> * Authors: >> * Dan Smith >> @@ -915,6 +915,51 @@ static CMPIStatus set_input_rasd_params(const struct virt_device *dev, >> return s; >> } >> >> +static CMPIStatus set_controller_rasd_params(const CMPIBroker *broker, >> + const CMPIObjectPath *ref, >> + const struct virt_device *dev, >> + CMPIInstance *inst) >> +{ >> + const char *type_str; >> + CMPIStatus s = {CMPI_RC_OK, NULL}; >> + >> + type_str = controller_protocol_type_IDToStr(dev->dev.controller.type); >> + if (type_str == NULL) { >> + CU_DEBUG("controller type=%d fails to return string", >> + dev->type); >> + return s; >> + } >> + CMSetProperty(inst, "OtherResourceType", "controller", CMPI_chars); >> + CMSetProperty(inst, "ResourceSubType", >> + (CMPIValue *)type_str, CMPI_chars); >> + CMSetProperty(inst, "Index", >> + (CMPIValue *)&(dev->dev.controller.index), CMPI_uint64); >> + >> + if (dev->dev.controller.model) >> + CMSetProperty(inst, "Model", >> + (CMPIValue *)dev->dev.controller.model, CMPI_chars); >> + >> + if (dev->dev.controller.ports) >> + CMSetProperty(inst, "Ports", >> + (CMPIValue *)dev->dev.controller.ports, CMPI_chars); >> + >> + if (dev->dev.controller.vectors) >> + CMSetProperty(inst, "Vectors", >> + (CMPIValue *)dev->dev.controller.vectors, CMPI_chars); >> + >> + if (dev->dev.controller.queues) >> + CMSetProperty(inst, "Queues", >> + (CMPIValue *)dev->dev.controller.queues, CMPI_chars); >> + >> + if (dev->dev.controller.address.ct > 0) >> + set_rasd_device_address(broker, >> + ref, >> + &dev->dev.controller.address, >> + inst); >> + >> + return s; >> +} >> + >> CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, >> struct virt_device *dev, >> const char *host, >> @@ -949,6 +994,9 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> type = CIM_RES_TYPE_INPUT; >> base = "InputResourceAllocationSettingData"; >> + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { >> + type = CIM_RES_TYPE_OTHER; > I noticed that only type of controller and console device are set into > CIM_RES_TYPE_OTHER. > And I found only two places in this function use that macro. Why not > type is > CIM_RES_TYPE_CONTROLLER/CONSOLE? > > Thanks, > Xu Wang I'm following the advice of Boris on this one... Essentially, by defining it to OTHER, the use of the OtherResourceType and ResourceSubType fields come into play. Go back to the original code review and see/read the following: http://www.redhat.com/archives/libvirt-cim/2014-March/msg00012.html then http://www.redhat.com/archives/libvirt-cim/2014-March/msg00018.html >> + base = "ControllerResourceAllocationSettingData"; >> } else { >> return NULL; >> } >> @@ -1004,6 +1052,8 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, >> s = set_input_rasd_params(dev, inst); >> } else if (dev->type == CIM_RES_TYPE_CONSOLE) { >> s = set_console_rasd_params(dev, inst); >> + } else if (dev->type == CIM_RES_TYPE_CONTROLLER) { >> + s = set_controller_rasd_params(broker, ref, dev, inst); >> } >> >> /* FIXME: Put the HostResource in place */ >> @@ -1138,6 +1188,8 @@ CMPIrc res_type_from_rasd_classname(const char *cn, uint16_t *type) >> *type = CIM_RES_TYPE_IMAGE; >> else if (STREQ(base, "ConsoleResourceAllocationSettingData")) >> *type = CIM_RES_TYPE_CONSOLE; >> + else if (STREQ(base, "ControllerResourceAllocationSettingData")) >> + *type = CIM_RES_TYPE_CONTROLLER; >> else >> goto out; >> >> @@ -1175,6 +1227,9 @@ CMPIrc rasd_classname_from_type(uint16_t type, const char **classname) >> case CIM_RES_TYPE_INPUT: >> *classname = "InputResourceAllocationSettingData"; >> break; >> + case CIM_RES_TYPE_CONTROLLER: >> + *classname = "ControllerResourceAllocationSettingData"; >> + break; >> default: >> rc = CMPI_RC_ERR_FAILED; >> } >> diff --git a/src/svpc_types.h b/src/svpc_types.h >> index d9f8032..6270233 100644 >> --- a/src/svpc_types.h >> +++ b/src/svpc_types.h >> @@ -42,7 +42,7 @@ >> #define CIM_RES_TYPE_EMU 32770 >> #define CIM_RES_TYPE_CONTROLLER 32771 >> >> -#define CIM_RES_TYPE_COUNT 7 >> +#define CIM_RES_TYPE_COUNT 8 >> const static int cim_res_types[CIM_RES_TYPE_COUNT] = >> {CIM_RES_TYPE_NET, >> CIM_RES_TYPE_DISK, >> @@ -51,6 +51,7 @@ const static int cim_res_types[CIM_RES_TYPE_COUNT] = >> CIM_RES_TYPE_GRAPHICS, >> CIM_RES_TYPE_INPUT, >> CIM_RES_TYPE_CONSOLE, >> + CIM_RES_TYPE_CONTROLLER, >> }; >> >> #define CIM_VSSD_RECOVERY_NONE 2 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > From jferlan at redhat.com Mon Apr 14 14:19:29 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 14 Apr 2014 10:19:29 -0400 Subject: [Libvirt-cim] [PATCH v3 0/8] Add Controller Device Support In-Reply-To: <534B9184.1070508@linux.vnet.ibm.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> <534B9184.1070508@linux.vnet.ibm.com> Message-ID: <534BEE71.3020200@redhat.com> On 04/14/2014 03:43 AM, Xu Wang wrote: > > ? 2014?03?28? 05:18, John Ferlan ??: >> I know this is a long cover letter, but it covers a lot of ground... >> >> I was just about done with all the merges this morning - I ran the cimtest >> one more time and found that there's a couple of tests which associate >> RASDs and Pools. So I jumped into the rabbit hole and wound my way through >> the maze of twisty little passages. I even heard a babbling brook (it's an >> old computer game reference). >> >> So here's where I'm at - I have cimtest completely passing again which keeps >> me happy. Although I have a pile of cimtest related changes that will also >> need to be made, but I have to wait to do them until I get a libvirt-cim >> revision number to compare against so as to be able to add conditional code > I just wonder how to get that revision, apply it from some organization > or company? > > Thanks, > Xu Wang Not sure I understand the question, but I think you're asking where/how the value is generated.... Well it's generated if/when you run "autoconfiscate.sh"... It'll do the following: if test -x $(which git); then git rev-parse --short HEAD > .changeset git rev-list HEAD | wc -l > .revision else echo "Unknown" > .changeset echo "0" > .revision fi What I *really* wish is someone could write a patch to have a "make" or "make rpm" do that as well. My build environment understanding is weak and I'm not sure exactly the best way to do it. John From jferlan at redhat.com Mon Apr 14 15:05:57 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 14 Apr 2014 11:05:57 -0400 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <534B7D1A.2090501@gmail.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> <534B7D1A.2090501@gmail.com> Message-ID: <534BF955.2030201@redhat.com> On 04/14/2014 02:15 AM, Xu Wang wrote: > > ? 2014?04?05? 00:12, John Ferlan ??: >> Rather than default to socket.gethostbyaddr(socket.gethostname())[0] to >> get full_hostname(), go through a sequence of steps to get a more >> correct result >> >> NOTE: >> See http://www.redhat.com/archives/libvirt-cim/2013-November/msg00082.html >> for more details and history. >> >> Signed-off-by: John Ferlan >> --- >> lib/VirtLib/live.py | 11 ++++++++--- >> 1 file changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py >> index c929e71..e9cafc1 100644 >> --- a/lib/VirtLib/live.py >> +++ b/lib/VirtLib/live.py >> @@ -100,6 +100,11 @@ def hostname(server): >> return out >> >> def full_hostname(server): >> - """To return the fully qualifiec domain name(FQDN) of the system""" >> - >> - return socket.gethostbyaddr(socket.gethostname())[0] >> + """To return the fully qualified domain name(FQDN) of the system""" >> + >> + if socket.getfqdn().find('.') >= 0: >> + return socket.getfqdn() >> + elif socket.gethostname().find('.') >= 0: >> + return socket.gethostname() >> + else: >> + return socket.gethostbyaddr(server)[1][0] > I got an error here. The content of my /etc/hosts is, > > # cat /etc/hosts > 127.0.0.1 RH64wenchao localhost localhost.localdomain localhost4 > localhost4.localdomain4 #RH64wenchao > I don't see the same results if I add a different name to /etc/hosts. I didn't restart my network and that may make a difference. I did restart my tog-pegasus, but that shouldn't make a difference, but who knows at this point. There's 3 places that use the returned data. I'll play with this some more and see what happens John > And I got an failed result, > > # CIM_NS=root/virt CIM_USER=root CIM_PASS=****** ./runtests libvirt-cim > -i localhost -c -d -v KVM -g HostSystem -t 01_enum.py > Starting test suite: libvirt-cim > Cleaned log files. > > Testing KVM hypervisor > -------------------------------------------------------------------- > HostSystem - 01_enum.py: FAIL > ERROR - Exp KVM_HostSystem, got KVM_HostSystem > ERROR - Exp localhost.localdomain, got RH64wenchao > CIM_ERR_INVALID_CLASS: Linux_ComputerSystem > -------------------------------------------------------------------- > > It means that @host and @hs[0].Name get the different value. I think it > may happened when a computer > has more than one hostname. My suggestion is @host make a string match > with content of every element > of @hs[] to check if @host is contained in it. > > Thanks, > Xu Wang > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > From jferlan at redhat.com Mon Apr 14 15:08:06 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 14 Apr 2014 11:08:06 -0400 Subject: [Libvirt-cim] [PATCH 05/10] XenKvmLib: Add controller device In-Reply-To: <534B855D.1000408@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-6-git-send-email-jferlan@redhat.com> <534B855D.1000408@linux.vnet.ibm.com> Message-ID: <534BF9D6.9090806@redhat.com> On 04/14/2014 02:51 AM, Xu Wang wrote: > > ? 2014?04?05? 00:12, John Ferlan ??: >> Add support to handle a controller device variantly based up on the >> libvirt-cim revision value >> >> Signed-off-by: John Ferlan >> --- >> suites/libvirt-cim/lib/XenKvmLib/devices.py | 6 ++++ >> suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py | 2 +- >> suites/libvirt-cim/lib/XenKvmLib/rasd.py | 25 ++++++++++++++ >> suites/libvirt-cim/lib/XenKvmLib/vsms.py | 24 +++++++++++++ >> suites/libvirt-cim/lib/XenKvmLib/vxml.py | 39 +++++++++++++++++----- >> 5 files changed, 86 insertions(+), 10 deletions(-) >> >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/devices.py b/suites/libvirt-cim/lib/XenKvmLib/devices.py >> index 0ddccbb..5f26fa9 100755 >> --- a/suites/libvirt-cim/lib/XenKvmLib/devices.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/devices.py >> @@ -33,6 +33,7 @@ from XenKvmLib.enumclass import EnumInstances >> >> graphics_dev_rev = 725 >> input_dev_rev = 745 >> +controller_dev_rev = 1310 >> >> def get_class(classname): >> return eval(classname) >> @@ -99,6 +100,8 @@ def dev_cn_to_rasd_cn(dev_cn, virt): >> return get_typed_class(virt, "GraphicsResourceAllocationSettingData") >> elif dev_cn.find('PointingDevice') >= 0: >> return get_typed_class(virt, "InputResourceAllocationSettingData") >> + elif dev_cn.find('Controller') >= 0: >> + return get_typed_class(virt, "ControllerResourceAllocationSettingData") >> else: >> return None >> >> @@ -112,6 +115,9 @@ def enum_dev(virt, ip): >> if curr_cim_rev >= input_dev_rev: >> dev_list.append('PointingDevice') >> >> + if curr_cim_rev >= controller_dev_rev and virt == 'KVM': >> + dev_list.append('Controller') >> + >> dev_insts = {} >> >> try: >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py >> index 744e864..5db36ca 100644 >> --- a/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/logicaldevices.py >> @@ -57,7 +57,7 @@ def spec_err(fieldvalue, field_list, fieldname): >> >> def verify_device_values(assoc_info, list_values, virt='Xen'): >> dev_cnames = ['LogicalDisk', 'Memory', 'NetworkPort', 'Processor', \ >> - 'DisplayController', 'PointingDevice'] >> + 'DisplayController', 'PointingDevice', 'Controller'] >> for i in range(len(dev_cnames)): >> dev_cnames[i] = get_typed_class(virt, dev_cnames[i]) >> >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py >> index 4d4240a..21dd7e4 100644 >> --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py >> @@ -40,6 +40,7 @@ dasd_cn = 'DiskResourceAllocationSettingData' >> masd_cn = 'MemResourceAllocationSettingData' >> dcrasd_cn = 'GraphicsResourceAllocationSettingData' >> irasd_cn = 'InputResourceAllocationSettingData' >> +ctlrasd_cn = 'ControllerResourceAllocationSettingData' >> dpasd_cn = 'DiskPoolResourceAllocationSettingData' >> npasd_cn = 'NetPoolResourceAllocationSettingData' >> svrasd_cn = 'StorageVolumeResourceAllocationSettingData' >> @@ -51,6 +52,7 @@ netcn = 'NetworkPort' >> diskcn = 'LogicalDisk' >> dccn = 'DisplayController' >> pdcn = 'PointingDevice' >> +ctlcn = 'Controller' >> >> libvirt_rasd_storagepool_changes = 934 >> >> @@ -65,12 +67,14 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): >> disk_cn = get_typed_class(virt, diskcn) >> dc_cn = get_typed_class(virt, dccn) >> pd_cn = get_typed_class(virt, pdcn) >> + ctl_cn = get_typed_class(virt, ctlcn) >> >> in_list = { 'proc' : proc_cn, >> 'mem' : mem_cn, >> 'net' : net_cn, >> 'disk' : disk_cn, >> 'display' : dc_cn, >> + 'controller' : ctl_cn, >> 'point' : pd_cn >> } >> try: >> @@ -113,6 +117,18 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): >> dc_cn : { >> "InstanceID" : "%s/%s" %(t_dom, "vnc") >> }, >> + # There can be more than one controller defined for >> + # any system - usually there are 3, one each for usb, >> + # pci, and ide. The InstanceID is formatted using >> + # the string "controller" and the type/string of the >> + # controller, and the index id found. That index can >> + # vary. Thus our verify_controllerrasd_values will >> + # just ensure the "base" is valid - that is the >> + # guest name and "controller" string. >> + ctl_cn : { >> + "InstanceID" : "%s/%s:" \ >> + %(t_dom, "controller") >> + }, >> pd_cn : { >> "InstanceID" : point_device >> } >> @@ -143,6 +159,15 @@ def InstId_err(assoc_info, list): >> logger.error("Returned %s instead of %s", >> assoc_info['InstanceID'], list['InstanceID']) >> >> +def verify_controllerrasd_values(assoc_info, controllerrasd_list): >> + status = PASS >> + print 'assoc', assoc_info['InstanceID'] >> + print 'ctrlr', controllerrasd_list['InstanceID'] >> + if controllerrasd_list['InstanceID'] not in assoc_info['InstanceID']: >> + InstId_err(assoc_info, controllerrasd_list) >> + status = FAIL >> + return status >> + >> def verify_displayrasd_values(assoc_info, displayrasd_list): >> status = PASS >> if assoc_info['InstanceID'] != displayrasd_list['InstanceID']: >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms.py b/suites/libvirt-cim/lib/XenKvmLib/vsms.py >> index d7f33f9..3da309c 100755 >> --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py >> @@ -36,6 +36,7 @@ RASD_TYPE_DISK = 17 >> RASD_TYPE_GRAPHICS = 24 >> RASD_TYPE_INPUT = 13 >> RASD_TYPE_STOREVOL = 32768 >> +RASD_TYPE_CONTROLLER = 32771 >> >> VIRT_DISK_TYPE_DISK = 0 >> VIRT_DISK_TYPE_CDROM = 1 >> @@ -324,6 +325,29 @@ class LXC_InputResourceAllocationSettingData(CIM_InputResourceAllocationSettingD >> def get_iasd_class(virt): >> pass >> >> +class CIM_ControllerResourceAllocationSettingData(CIMClassMOF): >> + def __init__(self, name, ctl_sub_type=None, ctl_index=-1, ctl_model=None): >> + self.InstanceID = '%s/controller:' % name >> + self.ResourceType = RASD_TYPE_CONTROLLER >> + >> + if ctl_sub_type is not None: >> + self.ResourceSubType = ctl_sub_type >> + self.InstanceID += '%s' % ctl_sub_type >> + >> + if ctl_index >= 0: >> + self.Index = ctl_index >> + self.InstanceID += ':%d' % ctl_index >> + >> + if ctl_model is not None: >> + self.Model = ctl_model >> + >> +class KVM_ControllerResourceAllocationSettingData(CIM_ControllerResourceAllocationSettingData): >> + pass >> + >> + at eval_cls('ControllerResourceAllocationSettingData') >> +def get_ctlasd_class(virt): >> + pass >> + >> def default_vssd_rasd_str(dom_name='test_domain', >> disk_dev='xvda', >> disk_source=const.Xen_disk_path, >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> index 74c4f23..ad80aae 100644 >> --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> @@ -53,6 +53,8 @@ from XenKvmLib.const import get_provider_version >> >> vsms_graphics_sup = 763 >> vsms_inputdev_sup = 771 >> +vsms_controller_sup = 1310 >> + >> >> class XMLClass: >> xml_string = "" >> @@ -598,7 +600,8 @@ class VirtCIM: >> def __init__(self, virt, dom_name, uuid, pae, acpi, apic, disk_dev, >> disk_source, net_type, net_name, net_mac, vcpus, mem, >> mem_allocunits, emu_type, grstype, ip, >> - is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd): >> + is_ipv6_only, port_num, kmap, irstype, btype, vnc_passwd, >> + ctltype, ctlindex, ctlmodel): >> self.virt = virt >> self.domain_name = dom_name >> self.err_rc = None >> @@ -629,6 +632,14 @@ class VirtCIM: >> self.iasd = vsms.get_iasd_class(virt)(name=dom_name, >> res_sub_type=irstype, >> bus_type=btype) >> + if virt == 'KVM': >> + self.ctlasd = vsms.get_ctlasd_class(virt)(name=dom_name, >> + ctl_sub_type=ctltype, >> + ctl_index=ctlindex, >> + ctl_model=ctlmodel) >> + else: >> + self.ctlasd = None >> + >> self.res_settings = [] >> >> def cim_define(self, ip, ref_conf=None): >> @@ -658,6 +669,9 @@ class VirtCIM: >> if self.iasd is not None: >> res_settings.append(str(self.iasd)) >> >> + if curr_cim_rev > vsms_controller_sup and self.ctlasd is not None: >> + res_settings.append(str(self.ctlasd)) >> + > Here I got a similar error, curr_cim_rev=1309 but > vsms_controller_sup=1310. Hence > I got the following result, > # CIM_NS=root/virt CIM_USER=root CIM_PASS=****** ./runtests libvirt-cim > -i localhost -c -d -v KVM -g RASD -t 03_rasd_errs.py > Starting test suite: libvirt-cim > Cleaned log files. > > Testing KVM hypervisor > -------------------------------------------------------------------- > RASD - 03_rasd_errs.py: FAIL > ERROR - Expected 6 RASDs, got 7 > -------------------------------------------------------------------- > > Do I need to update value of @curren_cim_rev and how to change it? > > Thanks, > Xu Wang That's probably the cause - my response in the controller patches stream should help - but essentially it's running autoconfiscate.sh and then rebuilding/reinstalling the repo John >> if ref_conf is None: >> ref_conf = ' ' >> >> @@ -849,7 +863,8 @@ class XenXML(VirtXML, VirtCIM): >> emu_type=None, grstype="vnc", address=None, >> is_ipv6_only=None, >> port_num='-1', keymap="en-us", irstype="mouse", >> - btype="xen", vnc_passwd=None): >> + btype="xen", vnc_passwd=None, >> + ctltype=None, ctlindex=-1, ctlmodel=None): >> if not (os.path.exists(const.Xen_kernel_path) \ >> and os.path.exists(const.Xen_init_path)): >> logger.error('ERROR: Either the kernel image ' >> @@ -863,7 +878,7 @@ class XenXML(VirtXML, VirtCIM): >> disk_file_path, ntype, net_name, mac, vcpus, mem, >> mem_allocunits, emu_type, grstype, address, >> is_ipv6_only, port_num, keymap, irstype, btype, >> - vnc_passwd) >> + vnc_passwd, ctltype, ctlindex, ctlmodel) >> >> def _os(self, os_kernel, os_initrd): >> os = self.get_node('/domain/os') >> @@ -920,7 +935,10 @@ class KVMXML(VirtXML, VirtCIM): >> emu_type=None, grstype="vnc", address=None, >> is_ipv6_only=None, >> port_num='-1', keymap="en-us", irstype="mouse", >> - btype="ps2", vnc_passwd=None): >> + btype="ps2", vnc_passwd=None, >> + ctltype="pci", ctlindex=0, ctlmodel="pci-root"): >> + # Optionally the following works too: >> + #ctltype="usb", ctlindex=0, ctlmodel=None): >> if not os.path.exists(disk_file_path): >> logger.error('Error: Disk image %s does not exist', disk_file_path) >> sys.exit(1) >> @@ -929,7 +947,7 @@ class KVMXML(VirtXML, VirtCIM): >> disk_file_path, ntype, net_name, mac, vcpus, mem, >> mem_allocunits, emu_type, grstype, address, >> is_ipv6_only, port_num, keymap, irstype, btype, >> - vnc_passwd) >> + vnc_passwd, ctltype, ctlindex, ctlmodel) >> self._os() >> self._devices(const.KVM_default_emulator, ntype, >> disk_file_path, disk, mac, net_name) >> @@ -983,7 +1001,8 @@ class XenFVXML(VirtXML, VirtCIM): >> emu_type=None, grstype="vnc", >> address=None, is_ipv6_only=None, port_num='-1', >> keymap="en-us", >> - irstype="mouse", btype="ps2", vnc_passwd=None): >> + irstype="mouse", btype="ps2", vnc_passwd=None, >> + ctltype=None, ctlindex=-1, ctlmodel=None): >> if not os.path.exists(disk_file_path): >> logger.error('Error: Disk image %s does not exist', disk_file_path) >> sys.exit(1) >> @@ -992,7 +1011,8 @@ class XenFVXML(VirtXML, VirtCIM): >> disk_file_path, ntype, net_name, mac, vcpus, mem, >> mem_allocunits, emu_type, grstype, address, >> is_ipv6_only, port_num, >> - keymap, irstype, btype, vnc_passwd) >> + keymap, irstype, btype, vnc_passwd, >> + ctltype, ctlindex, ctlmodel) >> self._os(const.XenFV_default_loader) >> self._devices(const.XenFV_default_emulator, >> ntype, mac, net_name, disk_file_path, disk) >> @@ -1036,7 +1056,8 @@ class LXCXML(VirtXML, VirtCIM): >> tty=const.LXC_default_tty, grstype="vnc", >> address=None, is_ipv6_only=None, port_num='-1', >> keymap="en-us", >> - irstype="mouse", btype="usb", vnc_passwd=None): >> + irstype="mouse", btype="usb", vnc_passwd=None, >> + ctltype=None, ctlindex=-1, ctlmodel=None): >> VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus) >> # pae, acpi and apic parameters doesn't make sense here, so we >> # statically set them to False (a.k.a. ignore them) >> @@ -1045,7 +1066,7 @@ class LXCXML(VirtXML, VirtCIM): >> ntype, net_name, mac, vcpus, mem, >> const.default_mallocunits, None, grstype, >> address, is_ipv6_only, port_num, keymap, irstype, >> - btype, vnc_passwd) >> + btype, vnc_passwd, ctltype, ctlindex, ctlmodel) >> self._os(const.LXC_init_path) >> self._devices(const.LXC_default_emulator, mac, ntype, net_name, const.LXC_default_tty) >> self.create_lxc_file(CIM_IP, const.LXC_init_path) > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > From jferlan at redhat.com Mon Apr 14 15:12:16 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 14 Apr 2014 11:12:16 -0400 Subject: [Libvirt-cim] [PATCH 08/10] cimtest: Add controller pool support In-Reply-To: <534B78AE.8080907@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-9-git-send-email-jferlan@redhat.com> <534B78AE.8080907@linux.vnet.ibm.com> Message-ID: <534BFAD0.1000503@redhat.com> On 04/14/2014 01:57 AM, Xu Wang wrote: > > ? 2014?04?05? 00:12, John Ferlan ??: >> Add support for controller pools >> >> Signed-off-by: John Ferlan >> --- >> suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py | 4 ++++ >> suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py | 1 + >> suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py | 3 +++ >> suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py | 7 ++++++- >> 4 files changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py >> index 133b8a1..6cc874a 100644 >> --- a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py >> +++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py >> @@ -36,6 +36,7 @@ from XenKvmLib.classes import get_typed_class >> >> sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] >> input_graphics_pool_rev = 757 >> +controller_pool_rev = 1312 >> >> def enum_pools(ip, ac_cn, virt): >> pt = [get_typed_class(virt, 'MemoryPool'), >> @@ -48,6 +49,9 @@ def enum_pools(ip, ac_cn, virt): >> pt.append(get_typed_class(virt, 'GraphicsPool')) >> pt.append(get_typed_class(virt, 'InputPool')) >> >> + if curr_rev >= controller_pool_rev and virt == 'KVM': >> + pt.append(get_typed_class(virt, 'ControllerPool')) >> + > I have applied all patches for libvirt-cim you submitted and run cimtest > with these 10 patches. > But here I got: curr_rev=1309, controller_pool_rev=1312, (of course that > caused if missed) > and virt=KVM. Could you give me some suggestion about that? What should > I do to get the > right answer or, if something around the code should be updated? Again I think this host to do with running autoconfiscate.sh. I'd be very happy if someone proposed a way to run that command for every build Be sure your environment has been updated with the top of the upstream pool (git pull --rebase on master and on your test branch afterwards). Once the libvirt-cim changes are pushed upstream - I'll be sure that the number of the revision matches the number for cimtest. John >> pools = {} >> >> try: >> diff --git a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py >> index 8a96677..62f3112 100644 >> --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py >> +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py >> @@ -54,6 +54,7 @@ def set_pool_info(server, virt, valid_elc_id): >> valid_elc_id = append_to_list(server, virt, "NetworkPool", valid_elc_id) >> valid_elc_id = append_to_list(server, virt, "GraphicsPool", valid_elc_id) >> valid_elc_id = append_to_list(server, virt, "InputPool", valid_elc_id) >> + valid_elc_id = append_to_list(server, virt, "ControllerPool", valid_elc_id) >> >> except Exception, details: >> logger.error("Exception: In fn set_pool_info(): %s", details) >> diff --git a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py >> index bd9c42b..614a795 100644 >> --- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py >> +++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py >> @@ -96,6 +96,9 @@ def pool_init_list(virt, pool_assoc, net_name, dp_InstID): >> exp_pllist[mpool] = 'MemoryPool/0' >> exp_pllist[gpool] = 'GraphicsPool/0' >> exp_pllist[ipool] = 'InputPool/0' >> + if virt == 'KVM': >> + cpool = get_typed_class(virt, 'ControllerPool') >> + exp_pllist[cpool] = 'ControllerPool/0' >> >> for p_inst in pool_assoc: >> CName = p_inst.classname >> diff --git a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py >> index 2c6cbaf..cf2c999 100755 >> --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py >> +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py >> @@ -36,6 +36,8 @@ from XenKvmLib.const import do_main, default_pool_name >> from XenKvmLib.classes import get_typed_class >> >> input_graphics_pool_rev = 757 >> +controller_pool_rev = 1312 >> + >> sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] >> @do_main(sup_types) >> def main(): >> @@ -71,6 +73,7 @@ def main(): >> >> mpool = get_typed_class(virt, 'MemoryPool') >> exp_pllist = { mpool : ['MemoryPool/0'] } >> + curr_cim_rev, changeset = get_provider_version(virt, options.ip) >> if virt != 'LXC': >> npool = get_typed_class(virt, 'NetworkPool') >> dpool = get_typed_class(virt, 'DiskPool') >> @@ -79,12 +82,14 @@ def main(): >> exp_pllist[npool] = ['NetworkPool/%s' %default_network_name] >> exp_pllist[ppool] = ['ProcessorPool/0'] >> >> - curr_cim_rev, changeset = get_provider_version(virt, options.ip) >> if curr_cim_rev >= input_graphics_pool_rev: >> ipool = get_typed_class(virt, 'InputPool') >> gpool = get_typed_class(virt, 'GraphicsPool') >> exp_pllist[ipool] = ['InputPool/0'] >> exp_pllist[gpool] = ['GraphicsPool/0'] >> + if curr_cim_rev >= controller_pool_rev and virt == 'KVM': >> + cpool = get_typed_class(virt, 'ControllerPool') >> + exp_pllist[cpool] = ['ControllerPool/0'] >> >> try: >> res_pllist = {} > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > From jferlan at redhat.com Mon Apr 21 16:18:41 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 21 Apr 2014 12:18:41 -0400 Subject: [Libvirt-cim] [PATCH v3 0/8] Add Controller Device Support In-Reply-To: <534B9184.1070508@linux.vnet.ibm.com> References: <1395955117-2884-1-git-send-email-jferlan@redhat.com> <534B9184.1070508@linux.vnet.ibm.com> Message-ID: <535544E1.2070503@redhat.com> Are inquiries on this series of changes satisfied? Can the series be pushed? I'd like to get this off my todo list. Thanks John From jferlan at redhat.com Mon Apr 21 16:21:33 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 21 Apr 2014 12:21:33 -0400 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <1396627979-12534-1-git-send-email-jferlan@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> Message-ID: <5355458D.7030704@redhat.com> Do you feel outside of patch 1/10 that this series can be pushed once the controller series is pushed? With of course any "adjustments" to the numbers based on the libvirt-cim commit numbers. I can hold off on 1/10 and rework it later as there's just other things going on and I don't have the same issue since I don't use aliases on my localhost. Thanks, John From gesaint at linux.vnet.ibm.com Tue Apr 22 02:59:16 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 22 Apr 2014 10:59:16 +0800 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <5355458D.7030704@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> Message-ID: <5355DB04.403@linux.vnet.ibm.com> Dear John, I just found an issue on RHEL-6.5. The reproduce steps, 1. Install a pure RHEL-6.5 system and just use rhn updates from RedHat. 2. Install and config libvirt-cim/cimtest just like before. 3. Run cimtest, you will find lots of testcases failed like this, InvodeMethod(DefineSystem): CIM_ERR_FAILED: Failed to define domain: internal error Unknown controller type 'pci' with return code 1 The root cause of error is, default version of qemu-kvm from RHEL-6.5 is 0.12.1.2-2, too old for (got that conclusion from link http://libvirt.org /formatdomain.html#elementsControllers). In my opinion, we should take it into consideration, or things like that will happen to the users who installed system like that because not everyone will update qemu to the newer version. My suggestion is, shall we adjust cimtest a little? Add a version checking into cimtest or just use another parameter replace it (type='pci')? Thanks, Xu Wang ? 2014?04?22? 00:21, John Ferlan ??: > > Do you feel outside of patch 1/10 that this series can be pushed once > the controller series is pushed? With of course any "adjustments" to > the numbers based on the libvirt-cim commit numbers. > > I can hold off on 1/10 and rework it later as there's just other things > going on and I don't have the same issue since I don't use aliases on my > localhost. > > Thanks, > > John > From gesaint at linux.vnet.ibm.com Tue Apr 22 03:22:41 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 22 Apr 2014 11:22:41 +0800 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <5355DB04.403@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> <5355DB04.403@linux.vnet.ibm.com> Message-ID: <5355E081.1050904@linux.vnet.ibm.com> I am sorry it may not be caused by the version of qemu-kvm. But I still have not found the real reason. If you know it please let me know. Thanks, Xu Wang ? 2014?04?22? 10:59, Xu Wang ??: > Dear John, > I just found an issue on RHEL-6.5. The reproduce steps, > 1. Install a pure RHEL-6.5 system and just use rhn updates from RedHat. > 2. Install and config libvirt-cim/cimtest just like before. > 3. Run cimtest, you will find lots of testcases failed like this, > InvodeMethod(DefineSystem): CIM_ERR_FAILED: Failed to define domain: > internal error Unknown controller type 'pci' with return code 1 > > The root cause of error is, default version of qemu-kvm from RHEL-6.5 > is 0.12.1.2-2, > too old for (got that conclusion from link > http://libvirt.org > /formatdomain.html#elementsControllers). In my opinion, we should take > it into consideration, > or things like that will happen to the users who installed system like > that because not everyone > will update qemu to the newer version. My suggestion is, shall we > adjust cimtest a little? > Add a version checking into cimtest or just use another parameter > replace it (type='pci')? > > Thanks, > Xu Wang > ? 2014?04?22? 00:21, John Ferlan ??: >> >> Do you feel outside of patch 1/10 that this series can be pushed once >> the controller series is pushed? With of course any "adjustments" to >> the numbers based on the libvirt-cim commit numbers. >> >> I can hold off on 1/10 and rework it later as there's just other things >> going on and I don't have the same issue since I don't use aliases on my >> localhost. >> >> Thanks, >> >> John >> > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From gesaint at linux.vnet.ibm.com Tue Apr 22 08:41:35 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 22 Apr 2014 16:41:35 +0800 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <5355E081.1050904@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> <5355DB04.403@linux.vnet.ibm.com> <5355E081.1050904@linux.vnet.ibm.com> Message-ID: <53562B3F.3090702@linux.vnet.ibm.com> FYI. Maybe my original guess is right... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PCI controllers have an optional|model|attribute with possible values|pci-root|,|pcie-root|,|pci-bridge|, or|dmi-to-pci-bridge|. The root controllers (|pci-root|and|pcie-root|) have an optional|pcihole64|element specifying how big (in kilobytes, or in the unit specified by|pcihole64|'s|unit|attribute) the 64-bit PCI hole should be. Some guests (like Windows XP or Windows Server 2003) might crash when QEMU and Seabios are recent enough to support 64-bit PCI holes, unless this is disabled (set to 0).Since 1.1.2 (QEMU only) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The description above is from http://libvirt.org /formatdomain.html#elementsControllers. Thanks, Xu Wang ? 2014?04?22? 11:22, Xu Wang ??: > I am sorry it may not be caused by the version of qemu-kvm. But I > still have not found the real reason. If you know it please let me know. > > Thanks, > Xu Wang > ? 2014?04?22? 10:59, Xu Wang ??: >> Dear John, >> I just found an issue on RHEL-6.5. The reproduce steps, >> 1. Install a pure RHEL-6.5 system and just use rhn updates from RedHat. >> 2. Install and config libvirt-cim/cimtest just like before. >> 3. Run cimtest, you will find lots of testcases failed like this, >> InvodeMethod(DefineSystem): CIM_ERR_FAILED: Failed to define domain: >> internal error Unknown controller type 'pci' with return code 1 >> >> The root cause of error is, default version of qemu-kvm from RHEL-6.5 >> is 0.12.1.2-2, >> too old for (got that conclusion from >> link http://libvirt.org >> /formatdomain.html#elementsControllers). In my opinion, we should >> take it into consideration, >> or things like that will happen to the users who installed system >> like that because not everyone >> will update qemu to the newer version. My suggestion is, shall we >> adjust cimtest a little? >> Add a version checking into cimtest or just use another parameter >> replace it (type='pci')? >> >> Thanks, >> Xu Wang >> ? 2014?04?22? 00:21, John Ferlan ??: >>> >>> Do you feel outside of patch 1/10 that this series can be pushed once >>> the controller series is pushed? With of course any "adjustments" to >>> the numbers based on the libvirt-cim commit numbers. >>> >>> I can hold off on 1/10 and rework it later as there's just other things >>> going on and I don't have the same issue since I don't use aliases >>> on my >>> localhost. >>> >>> Thanks, >>> >>> John >>> >> >> _______________________________________________ >> Libvirt-cim mailing list >> Libvirt-cim at redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-cim > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From gesaint at linux.vnet.ibm.com Tue Apr 22 08:55:51 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 22 Apr 2014 16:55:51 +0800 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <53562B3F.3090702@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> <5355DB04.403@linux.vnet.ibm.com> <5355E081.1050904@linux.vnet.ibm.com> <53562B3F.3090702@linux.vnet.ibm.com> Message-ID: <53562E97.7080100@linux.vnet.ibm.com> If I updates code in the suits/libvirt-cim/lib/XenKvmLib/vxml.py, uncomment ctltype="usb", ctlindex=0, ctlmodel=None): and comment ctltype="pci", ctlindex=0, ctlmodel="pci-root"): (Because you said that it's optional), some other failed testcases appeared. It's obvious that these two testcases are caused by that change. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ VirtualSystemSettingDataComponent - 02_reverse.py: FAIL ERROR - RASD instances don't match expect=8 found=7. ERROR - rasd_list ('pci_rasd','VSSDC_dom/controller:pci:0') not in found_list SystemDevice - 01_forward.py: FAIL 01_forward.py:29: DeprecationWarning: the sets module is deprecated from sets import Set ERROR - DeviceID mismatch ERROR - Exception Expected DeviceID: ['test_domain/controller:pci:0', 'test_domain/controller:usb:0'] Got: [u'test_domain/controller:usb:0'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is another failed testcase, VirtualSystemManagementService - 09_procrasd_persist.py: FAIL ERROR - Limit is None, expected 512 ERROR - Exception: details CPU scheduling not set properly for defined dom: procrasd_persist_dom Limit field was missed, from the new patches introduced. I'll continue to debug and update my status at any time. Thanks, Xu Wang ? 2014?04?22? 16:41, Xu Wang ??: > FYI. Maybe my original guess is right... > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > PCI controllers have an optional|model|attribute with possible > values|pci-root|,|pcie-root|,|pci-bridge|, or|dmi-to-pci-bridge|. The > root controllers (|pci-root|and|pcie-root|) have an > optional|pcihole64|element specifying how big (in kilobytes, or in the > unit specified by|pcihole64|'s|unit|attribute) the 64-bit PCI hole > should be. Some guests (like Windows XP or Windows Server 2003) might > crash when QEMU and Seabios are recent enough to support 64-bit PCI > holes, unless this is disabled (set to 0).Since 1.1.2 (QEMU only) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > The description above is from http://libvirt.org > /formatdomain.html#elementsControllers. > > Thanks, > Xu Wang > ? 2014?04?22? 11:22, Xu Wang ??: >> I am sorry it may not be caused by the version of qemu-kvm. But I >> still have not found the real reason. If you know it please let me know. >> >> Thanks, >> Xu Wang >> ? 2014?04?22? 10:59, Xu Wang ??: >>> Dear John, >>> I just found an issue on RHEL-6.5. The reproduce steps, >>> 1. Install a pure RHEL-6.5 system and just use rhn updates from RedHat. >>> 2. Install and config libvirt-cim/cimtest just like before. >>> 3. Run cimtest, you will find lots of testcases failed like this, >>> InvodeMethod(DefineSystem): CIM_ERR_FAILED: Failed to define domain: >>> internal error Unknown controller type 'pci' with return code 1 >>> >>> The root cause of error is, default version of qemu-kvm from >>> RHEL-6.5 is 0.12.1.2-2, >>> too old for (got that conclusion from >>> link http://libvirt.org >>> /formatdomain.html#elementsControllers). In my opinion, we should >>> take it into consideration, >>> or things like that will happen to the users who installed system >>> like that because not everyone >>> will update qemu to the newer version. My suggestion is, shall we >>> adjust cimtest a little? >>> Add a version checking into cimtest or just use another parameter >>> replace it (type='pci')? >>> >>> Thanks, >>> Xu Wang >>> ? 2014?04?22? 00:21, John Ferlan ??: >>>> >>>> Do you feel outside of patch 1/10 that this series can be pushed once >>>> the controller series is pushed? With of course any "adjustments" to >>>> the numbers based on the libvirt-cim commit numbers. >>>> >>>> I can hold off on 1/10 and rework it later as there's just other >>>> things >>>> going on and I don't have the same issue since I don't use aliases >>>> on my >>>> localhost. >>>> >>>> Thanks, >>>> >>>> John >>>> >>> >>> _______________________________________________ >>> Libvirt-cim mailing list >>> Libvirt-cim at redhat.com >>> https://www.redhat.com/mailman/listinfo/libvirt-cim >> >> _______________________________________________ >> Libvirt-cim mailing list >> Libvirt-cim at redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From jferlan at redhat.com Tue Apr 22 10:49:21 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 22 Apr 2014 06:49:21 -0400 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <5355DB04.403@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> <5355DB04.403@linux.vnet.ibm.com> Message-ID: <53564931.90704@redhat.com> On 04/21/2014 10:59 PM, Xu Wang wrote: > Dear John, > I just found an issue on RHEL-6.5. The reproduce steps, > 1. Install a pure RHEL-6.5 system and just use rhn updates from RedHat. > 2. Install and config libvirt-cim/cimtest just like before. > 3. Run cimtest, you will find lots of testcases failed like this, > InvodeMethod(DefineSystem): CIM_ERR_FAILED: Failed to define domain: > internal error Unknown controller type 'pci' with return code 1 > > The root cause of error is, default version of qemu-kvm from RHEL-6.5 is > 0.12.1.2-2, > too old for (got that conclusion from link > http://libvirt.org > /formatdomain.html#elementsControllers). In my opinion, we should take > it into consideration, > or things like that will happen to the users who installed system like > that because not everyone > will update qemu to the newer version. My suggestion is, shall we adjust > cimtest a little? > Add a version checking into cimtest or just use another parameter > replace it (type='pci')? > > Thanks, > Xu Wang I'm assuming your step 2 is - you are attempting to compile and install the top of the libvirt-cim tree on your RHEL6.5 box - if not then you need to elaborate on what you mean by "just like before". Personally, this just says to me this code doesn't get back ported to RHEL6.5 - not that it would have been without a business justification anyway. I see this as a non issue as this is upstream only at this point. In general - if someone takes upstream code and tries to compile/run on downstream RHEL releases - they are on their own. It's cumbersome to keep track of what changes are applicable and when. If libvirt has have some sort of reliance on a specific qemu feature/release - it would use/check the capabilities of the qemu that exists on the machine and then provide the feature. I believe libvirt capability parsing was only recently added to the upstream libvirt-cim - see commit id '3e6f1489', which I'm fairly certain is not in the downstream code since I don't remember backporting it. John > ? 2014?04?22? 00:21, John Ferlan ??: >> >> Do you feel outside of patch 1/10 that this series can be pushed once >> the controller series is pushed? With of course any "adjustments" to >> the numbers based on the libvirt-cim commit numbers. >> >> I can hold off on 1/10 and rework it later as there's just other things >> going on and I don't have the same issue since I don't use aliases on my >> localhost. >> >> Thanks, >> >> John >> >