From gesaint at linux.vnet.ibm.com Tue May 6 06:26:21 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 06 May 2014 14:26:21 +0800 Subject: [Libvirt-cim] [PATCH 00/10] cimtest: changes for controller and upstream support In-Reply-To: <53564931.90704@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <5355458D.7030704@redhat.com> <5355DB04.403@linux.vnet.ibm.com> <53564931.90704@redhat.com> Message-ID: <5368808D.5060601@linux.vnet.ibm.com> Dear John, I agree to merge these patches (libvirt-cim & cimtest) into upstream. Do you have any plans on time? I want to make some patches to fix issues with RHEL-6.5 based on the upstream after they merged. So if you did that I'll start my work soon. Thanks, Xu Wang ? 2014?04?22? 18:49, John Ferlan ??: > > 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 >>> > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From jferlan at redhat.com Tue May 6 12:16:19 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 06 May 2014 08:16:19 -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: <5368D293.9010706@redhat.com> I have pushed these changes as is to master. We may want to consider generating a "release" since the last one was 0.6.3 in July 2013. I would not expect any of these changes to make a RHEL6 based release. In fact, as upstream diverges further from what RHEL downstream has - it becomes more difficult to merge or cherry-pick changes from upstream. Any changes added to upstream for RHEL6 need to be easily picked and need to have a way to test easily. Tks, John From jferlan at redhat.com Tue May 6 12:22:13 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 06 May 2014 08:22:13 -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: <5368D3F5.9080005@redhat.com> I have now pushed changes 02/10 -> 10/10 to master. I will rework 01 (the hostname change) and repost at a later date. John From jferlan at redhat.com Wed May 7 00:05:04 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 6 May 2014 20:05:04 -0400 Subject: [Libvirt-cim] [PATCH 0/2] Fix bug on buildVol error path Message-ID: <1399421106-24042-1-git-send-email-jferlan@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=1092882 Changes as a result of commit id '0c2305b3', see: http://www.redhat.com/archives/libvir-list/2014-April/msg00375.html Resulted in a regression when there was a failure to buildVol the volume wasn't removed from the storage driver list because the wrong local storage pointer was passed to the DeleteInternal routine. Additionally a preexisting condition where if deleteVol didn't exist or failed, the volume would not be removed from volumes.objs[] even though it doesn't exist. This results in virsh vol-list and vol-info not finding the volume and emitting error messages. John Ferlan (2): storage: Need to ensure removal of voldef from driver list storage: Resolve issues in failure path src/storage/storage_driver.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 1.9.0 From jferlan at redhat.com Wed May 7 00:05:05 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 6 May 2014 20:05:05 -0400 Subject: [Libvirt-cim] [PATCH 1/2] storage: Need to ensure removal of voldef from driver list In-Reply-To: <1399421106-24042-1-git-send-email-jferlan@redhat.com> References: <1399421106-24042-1-git-send-email-jferlan@redhat.com> Message-ID: <1399421106-24042-2-git-send-email-jferlan@redhat.com> If for some reason a volume cannot be built in the pool (eg, the buildVol call fails), then the error code may or may not properly remove the volume from the pool->volumes.objs[] list. Removal from the list is dependent on the 'deleteVol()' being present in the backend *and* calling it returning success. If either failed, then the volobj would never be removed from the list until a pool refresh was done (or libvirtd restarted). Note: This is true prior to commit id '0c2305b3' as well where the cleanup would have been called prior to removal, but removal never occurred due to various goto statements. Since the volume would have been added to the list prior to the attempt to build the volume, modify the storageVolDeleteInternal() to perform removal during cleanup. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 542b382..789744f 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1581,6 +1581,9 @@ storageVolDeleteInternal(virStorageVolPtr obj, pool->def->available += vol->target.allocation; } + ret = 0; + + cleanup: for (i = 0; i < pool->volumes.count; i++) { if (pool->volumes.objs[i] == vol) { VIR_INFO("Deleting volume '%s' from storage pool '%s'", @@ -1591,9 +1594,6 @@ storageVolDeleteInternal(virStorageVolPtr obj, break; } } - ret = 0; - - cleanup: return ret; } -- 1.9.0 From jferlan at redhat.com Wed May 7 00:05:06 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 6 May 2014 20:05:06 -0400 Subject: [Libvirt-cim] [PATCH 2/2] storage: Resolve issues in failure path In-Reply-To: <1399421106-24042-1-git-send-email-jferlan@redhat.com> References: <1399421106-24042-1-git-send-email-jferlan@redhat.com> Message-ID: <1399421106-24042-3-git-send-email-jferlan@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=1092882 Refactoring in commit id '0c2305b3' resulted in the wrong storage volume object being passed to the new storageVolDeleteInternal(). It should have passed 'voldef' which is the address found in the pool->volumes.objs[i] array. By passing 'voldef', the DeleteInternal code will find and remove the voldef from the volumes.objs[] list. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 789744f..8299824 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1766,12 +1766,11 @@ storageVolCreateXML(virStoragePoolPtr obj, voldef->building = 0; pool->asyncjobs--; - voldef = NULL; - if (buildret < 0) { - storageVolDeleteInternal(volobj, backend, pool, buildvoldef, + VIR_FREE(buildvoldef); + storageVolDeleteInternal(volobj, backend, pool, voldef, 0, false); - buildvoldef = NULL; + voldef = NULL; goto cleanup; } -- 1.9.0 From jferlan at redhat.com Wed May 7 00:08:15 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 06 May 2014 20:08:15 -0400 Subject: [Libvirt-cim] [PATCH 0/2] Fix bug on buildVol error path In-Reply-To: <1399421106-24042-1-git-send-email-jferlan@redhat.com> References: <1399421106-24042-1-git-send-email-jferlan@redhat.com> Message-ID: <5369796F.5040207@redhat.com> Ignore - once again bitten by cut-n-paste buffers... Sigh - gotta stop trying to switching between too many windows. From phrdina at redhat.com Wed May 7 10:52:15 2014 From: phrdina at redhat.com (Pavel Hrdina) Date: Wed, 7 May 2014 12:52:15 +0200 Subject: [Libvirt-cim] [PATCH] xmlgen: fix build issue Message-ID: Function controller_protocol_type_IDToStr() returns a const char and we should abide that. Signed-off-by: Pavel Hrdina --- libxkutil/xmlgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c index 3174ca9..a9a672d 100644 --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -807,7 +807,7 @@ static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) for (i = 0; i < dominfo->dev_controller_ct; i++) { xmlNodePtr ctlr; xmlNodePtr tmp; - char *type_str; + const char *type_str; struct virt_device *_dev = &dominfo->dev_controller[i]; if (_dev->type == CIM_RES_TYPE_UNKNOWN) -- 1.8.3.2 From jferlan at redhat.com Wed May 7 13:54:44 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 07 May 2014 09:54:44 -0400 Subject: [Libvirt-cim] [PATCH] xmlgen: fix build issue In-Reply-To: References: Message-ID: <536A3B24.3070600@redhat.com> On 05/07/2014 06:52 AM, Pavel Hrdina wrote: > Function controller_protocol_type_IDToStr() returns a const char > and we should abide that. > > Signed-off-by: Pavel Hrdina > --- > libxkutil/xmlgen.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > ACK and pushed. Sorry about that. John > diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c > index 3174ca9..a9a672d 100644 > --- a/libxkutil/xmlgen.c > +++ b/libxkutil/xmlgen.c > @@ -807,7 +807,7 @@ static const char *controller_xml(xmlNodePtr root, struct domain *dominfo) > for (i = 0; i < dominfo->dev_controller_ct; i++) { > xmlNodePtr ctlr; > xmlNodePtr tmp; > - char *type_str; > + const char *type_str; > > struct virt_device *_dev = &dominfo->dev_controller[i]; > if (_dev->type == CIM_RES_TYPE_UNKNOWN) > From gesaint at linux.vnet.ibm.com Thu May 8 09:01:00 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Thu, 08 May 2014 17:01:00 +0800 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <534BF955.2030201@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> <534B7D1A.2090501@gmail.com> <534BF955.2030201@redhat.com> Message-ID: <536B47CC.7010901@linux.vnet.ibm.com> ? 2014?04?14? 23:05, John Ferlan ??: > > 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 Dear John, I installed several absolutely new systems to test it, and got different results. I have a question here. Why don't we use socket.gethostname() directly? It seems work well on my systems. Is there any other situation it could not handle? Thanks, Xu Wang >> 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 >> > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From gesaint at linux.vnet.ibm.com Thu May 8 09:25:42 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Thu, 8 May 2014 17:25:42 +0800 Subject: [Libvirt-cim] [PATCH] cimtest: Update controller type from pci to scsi Message-ID: <1399541142-3391-1-git-send-email-gesaint@linux.vnet.ibm.com> To test controller device new element was introduced into domain xml. But it was not supported until libvirt-1.0.5. Now RHEL-6.5 is using libvirt-0.10.2-29. It could involve regression issue. Hence here I updated it to to test fields of this device. Signed-off-by: Xu Wang --- .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 2 +- .../02_reverse.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py index f81aff1..052efc1 100644 --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py @@ -133,7 +133,7 @@ def main(): 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:scsi:0' % test_dom) exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) try: diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py index a7e6c17..9060ae4 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -101,7 +101,7 @@ def assoc_values(ip, assoc_info, virt="Xen"): 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({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) expect_rasds = len(rasd_list) diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index 3bea13c..9ea46e4 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -937,7 +937,7 @@ class KVMXML(VirtXML, VirtCIM): is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None, - ctltype="pci", ctlindex=0, ctlmodel="pci-root"): + ctltype="scsi", ctlindex=0, ctlmodel="virtio-scsi"): # Optionally the following works too: #ctltype="usb", ctlindex=0, ctlmodel=None): if not os.path.exists(disk_file_path): -- 1.7.1 From jferlan at redhat.com Thu May 8 11:37:12 2014 From: jferlan at redhat.com (John Ferlan) Date: Thu, 08 May 2014 07:37:12 -0400 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <536B47CC.7010901@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> <534B7D1A.2090501@gmail.com> <534BF955.2030201@redhat.com> <536B47CC.7010901@linux.vnet.ibm.com> Message-ID: <536B6C68.5040703@redhat.com> On 05/08/2014 05:01 AM, Xu Wang wrote: > > ? 2014?04?14? 23:05, John Ferlan ??: >> >> 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 > Dear John, > I installed several absolutely new systems to test it, and got > different results. > I have a question here. Why don't we use socket.gethostname() directly? > It seems > work well on my systems. Is there any other situation it could not handle? > > Thanks, > Xu Wang The code currently does the following def full_hostname(server): """To return the fully qualifiec domain name(FQDN) of the system""" return socket.gethostbyaddr(socket.gethostname())[0] $ python >>> import socket >>> help(socket.getfqdn) Help on function getfqdn in module socket: getfqdn(name='') Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname from gethostname() is returned. >>> help(socket.gethostbyaddr) Help on built-in function gethostbyaddr in module _socket: gethostbyaddr(...) gethostbyaddr(host) -> (name, aliaslist, addresslist) Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. Thus the byaddr probably does what you asked for before in returning the aliaslist (e.g. the [1] entry) and then being able to do some sort of "if myname in aliaslist:" test. I still content getfqdn() is the proper action for the full_hostname() method. A new method could be added "aliaslist" which could return all names in order to be checked. It's just a matter of taking the time to do the code, check all the callers, etc. Time that I haven't had lately. FWIW: My host (f20) returns: >>> print socket.getfqdn() localhost.localdomain >>> print socket.gethostname() localhost.localdomain >>> print socket.gethostbyaddr(socket.gethostname()) ('localhost', ['localhost.localdomain', 'localhost6', 'localhost6.localdomain6'], ['::1']) >>> print socket.getfqdn() localhost.localdomain I've done no manipulation of my /etc/hosts John From gesaint at linux.vnet.ibm.com Fri May 9 07:17:26 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Fri, 09 May 2014 15:17:26 +0800 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <536B6C68.5040703@redhat.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> <534B7D1A.2090501@gmail.com> <534BF955.2030201@redhat.com> <536B47CC.7010901@linux.vnet.ibm.com> <536B6C68.5040703@redhat.com> Message-ID: <536C8106.2030903@linux.vnet.ibm.com> ? 2014?05?08? 19:37, John Ferlan ??: > On 05/08/2014 05:01 AM, Xu Wang wrote: >> ? 2014?04?14? 23:05, John Ferlan ??: >>> 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: >>>>> Seehttp://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 >> Dear John, >> I installed several absolutely new systems to test it, and got >> different results. >> I have a question here. Why don't we use socket.gethostname() directly? >> It seems >> work well on my systems. Is there any other situation it could not handle? >> >> Thanks, >> Xu Wang > The code currently does the following > > def full_hostname(server): > """To return the fully qualifiec domain name(FQDN) of the system""" > > return socket.gethostbyaddr(socket.gethostname())[0] > > > $ python >>>> import socket >>>> help(socket.getfqdn) > Help on function getfqdn in module socket: > > getfqdn(name='') > Get fully qualified domain name from name. > > An empty argument is interpreted as meaning the local host. > > First the hostname returned by gethostbyaddr() is checked, then > possibly existing aliases. In case no FQDN is available, hostname > from gethostname() is returned. Dear John, This is the description I got from https://docs.python.org/2/library/socket.html socket.getfqdn([name]) Return a fully qualified domain name for name. If name is omitted or empty, it is interpreted as the local host. To find the fully qualified name, the hostname returned by gethostbyaddr() is checked, followed by aliases for the host, if available. The first name which includes a period is selected. In case no fully qualified domain name is available, the hostname as returned by gethostname() is returned. New in version 2.0. and socket.gethostname() Return a string containing the hostname of the machine where the Python interpreter is currently executing. If you want to know the current machine?s IP address, you may want to use gethostbyname(gethostname()). This operation assumes that there is a valid address-to-host mapping for the host, and the assumption does not always hold. Note: gethostname() doesn?t always return the fully qualified domain name; use getfqdn() (see above). I think socket.gethostname() returns the hostname of the machine where the Python interpreter is currently executing contains potential issue. That is if cimtest runs on different system with libvirt-cim, hostname maybe different. Another point, gethostname() doesn't always return the fully qualified domain name (Note mentioned, maybe different from getfqdn(). libvirt-cim set hostname by calling get_fqdn(), in set_host_system_properties()). Hence, I agree with you about the getfqdn() is a proper choice. >>>> help(socket.gethostbyaddr) > Help on built-in function gethostbyaddr in module _socket: > > gethostbyaddr(...) > gethostbyaddr(host) -> (name, aliaslist, addresslist) > > Return the true host name, a list of aliases, and a list of IP addresses, > for a host. The host argument is a string giving a host name or IP number. > > > Thus the byaddr probably does what you asked for before in returning > the aliaslist (e.g. the [1] entry) and then being able to do some sort of > "if myname in aliaslist:" test. > > I still content getfqdn() is the proper action for the full_hostname() > method. A new method could be added "aliaslist" which could return all > names in order to be checked. It's just a matter of taking the time to > do the code, check all the callers, etc. Time that I haven't had lately. > > FWIW: > My host (f20) returns: > >>>> print socket.getfqdn() > localhost.localdomain >>>> print socket.gethostname() > localhost.localdomain >>>> print socket.gethostbyaddr(socket.gethostname()) > ('localhost', ['localhost.localdomain', 'localhost6', 'localhost6.localdomain6'], ['::1']) I got an interesting result if I changed the hostname when system starting the first time. >>> import socket >>> print socket.getfqdn() zBX.testing >>> print socket.gethostname() zBX.testing >>> print socket.gethostbyaddr(socket.gethostname()) Traceback (most recent call last): File "", line 1, in socket.gaierror: [Errno -2] Name or service not known But my /etc/hosts was not changed (just as default), # cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 Just the system with default hostname was changed from localhost.localdomain into others could happened that. If we use getfqdn() that situation would not occur. But I still don't know the reason why the error happened. Thanks, Xu Wang >>>> print socket.getfqdn() > localhost.localdomain > > > I've done no manipulation of my /etc/hosts > > John > > _______________________________________________ > 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 Fri May 9 10:26:37 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 09 May 2014 06:26:37 -0400 Subject: [Libvirt-cim] [PATCH 01/10] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <536C8106.2030903@linux.vnet.ibm.com> References: <1396627979-12534-1-git-send-email-jferlan@redhat.com> <1396627979-12534-2-git-send-email-jferlan@redhat.com> <534B7D1A.2090501@gmail.com> <534BF955.2030201@redhat.com> <536B47CC.7010901@linux.vnet.ibm.com> <536B6C68.5040703@redhat.com> <536C8106.2030903@linux.vnet.ibm.com> Message-ID: <536CAD5D.3030505@redhat.com> <...snip...> > I got an interesting result if I changed the hostname when system > starting the first time. > >>>> import socket >>>> print socket.getfqdn() > zBX.testing >>>> print socket.gethostname() > zBX.testing >>>> print socket.gethostbyaddr(socket.gethostname()) > Traceback (most recent call last): > File "", line 1, in > socket.gaierror: [Errno -2] Name or service not known > gethostbyaddr() (and byname) need to do name server lookups - see the name service switch configuration (nsswitch.conf). How/where did you set "zBX.testing" as the hostname? I would get the same result if I use: >>> print socket.gethostbyaddr("zBX.testing") Traceback (most recent call last): File "", line 1, in socket.gaierror: [Errno -2] Name or service not known >>> John > But my /etc/hosts was not changed (just as default), > > # cat /etc/hosts > 127.0.0.1 localhost localhost.localdomain localhost4 > localhost4.localdomain4 > ::1 localhost localhost.localdomain localhost6 > localhost6.localdomain6 > > Just the system with default hostname was changed from > localhost.localdomain into > others could happened that. If we use getfqdn() that situation would not > occur. But > I still don't know the reason why the error happened. > > Thanks, > Xu Wang From gesaint at linux.vnet.ibm.com Fri May 16 07:40:46 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Fri, 16 May 2014 15:40:46 +0800 Subject: [Libvirt-cim] [PATCH] Add disk device='lun' support Message-ID: <1400226046-27170-1-git-send-email-gesaint@linux.vnet.ibm.com> Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one more value 'lun' should be supported by value of device field in the disk device. So this patch adds it into libvirt-cim. Now device like could be operated by class. Signed-off-by: Xu Wang --- schema/ResourceAllocationSettingData.mof | 8 ++++---- src/Virt_RASD.c | 3 +++ src/Virt_RASD.h | 1 + src/Virt_SettingsDefineCapabilities.c | 2 ++ src/Virt_VirtualSystemManagementService.c | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 9c387f0..f78d423 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData string VirtualDevice; [Description ("Device emulation type"), - ValueMap {"0", "1", "2"}, - Values {"Disk", "CDROM", "floppy"}] + ValueMap {"0", "1", "2", "4"}, + Values {"Disk", "CDROM", "floppy", "lun"}] uint16 EmulatedType; [Description ("Bus type of the device")] @@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData string VirtualDevice; [Description ("Device emulation type"), - ValueMap {"0", "1", "2", "3"}, - Values {"Disk", "CDROM", "floppy", "filesystem"}] + ValueMap {"0", "1", "2", "3", "4"}, + Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}] uint16 EmulatedType; [Description ("Bus type of the device")] diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index 3c62c2d..761d053 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, else if ((dev->dev.disk.device != NULL) && STREQ(dev->dev.disk.device, "floppy")) type = VIRT_DISK_TYPE_FLOPPY; + else if ((dev->dev.disk.device != NULL) && + STREQ(dev->dev.disk.device, "lun")) + type = VIRT_DISK_TYPE_LUN; else type = VIRT_DISK_TYPE_DISK; diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h index 400143f..49d7195 100644 --- a/src/Virt_RASD.h +++ b/src/Virt_RASD.h @@ -27,6 +27,7 @@ #define VIRT_DISK_TYPE_CDROM 1 #define VIRT_DISK_TYPE_FLOPPY 2 #define VIRT_DISK_TYPE_FS 3 +#define VIRT_DISK_TYPE_LUN 4 char *rasd_to_xml(CMPIInstance *rasd); diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c index 756e46b..714153e 100644 --- a/src/Virt_SettingsDefineCapabilities.c +++ b/src/Virt_SettingsDefineCapabilities.c @@ -1078,6 +1078,8 @@ static CMPIStatus set_disk_props(int type, dev = "hdc"; } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) { dev = "fda"; + } else if (emu_type == VIRT_DISK_TYPE_LUN) { + dev = "sda"; } CMSetProperty(inst, "VirtualDevice", diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index f673c38..28a9a5f 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1149,6 +1149,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, dev->dev.disk.device = strdup("floppy"); else if (type == VIRT_DISK_TYPE_FS) dev->dev.disk.device = strdup("filesystem"); + else if (type == VIRT_DISK_TYPE_LUN) + dev->dev.disk.device = strdup("lun"); else return "Invalid value for EmulatedType"; -- 1.7.1 From jferlan at redhat.com Mon May 19 13:54:35 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 19 May 2014 09:54:35 -0400 Subject: [Libvirt-cim] [PATCH] cimtest: Update controller type from pci to scsi In-Reply-To: <1399541142-3391-1-git-send-email-gesaint@linux.vnet.ibm.com> References: <1399541142-3391-1-git-send-email-gesaint@linux.vnet.ibm.com> Message-ID: <537A0D1B.9010308@redhat.com> On 05/08/2014 05:25 AM, Xu Wang wrote: > To test controller device new element model='pci-root'> was introduced into domain xml. But it was not supported > until libvirt-1.0.5. Now RHEL-6.5 is using libvirt-0.10.2-29. It could > involve regression issue. Hence here I updated it to index='0' model='virtio-scsi'> to test fields of this device. > > Signed-off-by: Xu Wang > --- > .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 2 +- > .../02_reverse.py | 2 +- > suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > The patch fails for me in the upstream environment... Testing KVM hypervisor -------------------------------------------------------------------- SystemDevice - 01_forward.py: FAIL ERROR - DeviceID mismatch ERROR - Exception Expected DeviceID: ['test_domain/controller:scsi:0', 'test_domain/controller:usb:0'] Got: [u'test_domain/controller:pci:0', u'test_domain/controller:scsi:0', u'test_domain/controller:usb:0'] -------------------------------------------------------------------- ... -------------------------------------------------------------------- VirtualSystemSettingDataComponent - 02_reverse.py: FAIL ERROR - Assoc instances don't match expect=10 found=9. ERROR - Did not find association id=VSSDC_dom/controller:pci:0 in assoc_list -------------------------------------------------------------------- What were the failures you saw in the 6.5 environment? I'm sure we can come to some sort of "middle ground"... How about the following squashed in (does it work in your environment)?: diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libv index 052efc1..b2a4bfa 100644 --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py @@ -134,6 +134,10 @@ def main(): controller_cn = get_typed_class(virt, "Controller") exp_pllist[controller_cn] = [] exp_pllist[controller_cn].append('%s/controller:scsi:0' % test_dom) + # pci-root gets added automagically for us since scsi has to + # hang somewhere + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: + exp_pllist[controller_cn].append('%s/controller:pci:0' % test_dom) exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) try: and diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_rev index 9060ae4..33877bf 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -102,6 +102,10 @@ def assoc_values(ip, assoc_info, virt="Xen"): if curr_cim_rev >= controller_rev: # Add controllers too ... will need a cim/cimtest version check rasd_list.update({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) + # pci-root gets added automagically for us since scsi has to + # hang somewhere + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: + 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) BTW: I use 1.0.5 only because of your note... John > diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py > index f81aff1..052efc1 100644 > --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py > +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py > @@ -133,7 +133,7 @@ def main(): > 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:scsi:0' % test_dom) > exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) > > try: > diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py > index a7e6c17..9060ae4 100644 > --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py > +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py > @@ -101,7 +101,7 @@ def assoc_values(ip, assoc_info, virt="Xen"): > > 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({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) > rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) > > expect_rasds = len(rasd_list) > diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > index 3bea13c..9ea46e4 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > @@ -937,7 +937,7 @@ class KVMXML(VirtXML, VirtCIM): > is_ipv6_only=None, > port_num='-1', keymap="en-us", irstype="mouse", > btype="ps2", vnc_passwd=None, > - ctltype="pci", ctlindex=0, ctlmodel="pci-root"): > + ctltype="scsi", ctlindex=0, ctlmodel="virtio-scsi"): > # Optionally the following works too: > #ctltype="usb", ctlindex=0, ctlmodel=None): > if not os.path.exists(disk_file_path): > From jferlan at redhat.com Tue May 20 18:18:09 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:18:09 -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: <537B9C61.9000603@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 > > 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 > -------------------------------------------------------------------- > Took some time and I dug in a bit more on this today... the last exception you see comes from the call to 'check_sblim()' which is used to determine whether to go through the 'ret == PASS' or "else" clauses. Digging into that finds another caller common_util.py/get_host_info() which had commented out the call as part of commit id 'd669e64e' "as libvirt-cim is not supporting sblim any more". Makes me wonder why this particular code decides to still call it and why it did in the first place. Regardless of whether we keep that check_sblim() call in going forward - the enumerate instance of a "KVM_HostSystem" will return in the "Name" field the result of a "Virt_HostSystem.c"/get_fqdn() call. That name is designed to be the fqdn; however, the code has a "prejudice" to not using "localhost" and thus it seems possible to return something that's not a fqdn. That will be 1. gethostname() "if" it returns a name with a "." in it 2. Search gethostbyname() alias entries for an entry with "." in it and that is not "localhost" 3. The value in hostentry->h_name field as long as it's not localhost 4. The gethostbyname() value as long as it's not localhost Step 3 & 4 are after a "FIXME" comment about an ugly hack. I have to assume that RH64wenchao perhaps fell into case 3 or 4. I was able to reserve a test box and found that an "hent = gethostbyname(hptr);" would return hent->aliases[0] == NULL. This would cause the libvirt-cim code to fall into the code after "FIXME" returning "h_name". In my test, that would be the hostname of the box. Why it returned RH64wenchao for you I have no idea. On my Fedora box, I get a list of localhost aliases returned. So my assumption is the issue has more to do with proper network configuration. After all that - I will re-post the code to adjust the full_hostname() call. Additionally, I will post code to remove the check_sblim() usage. I ran the full_hostname() on a RH65 box before/after and had no difference in results. John > 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 Tue May 20 18:26:25 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:26:25 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest: Changes for live.full_hostname Message-ID: <1400610388-907-1-git-send-email-jferlan@redhat.com> Series of patches to close the loop on prior set of cimtest changes: http://www.redhat.com/archives/libvirt-cim/2014-April/msg00002.html Based primarily on feedback/investigation done as part of a prior cimtest commit: http://www.redhat.com/archives/libvirt-cim/2014-May/msg00012.html Patch 1 of 3 modifies the full_hostname() call to use getfqdn() only. A prior patch would attempt the gethostname() if something failed, but as seen through the documentation of the in the above link - thats also a fallback for getfqdn(). Patches 2&3 remove the check_sblim() usage. See the commit messages for details. John Ferlan (3): live.full_hostname: Adjust mechanism to get FQDN HostSystem: Remove call to check_sblim XenKvmLib: Remove check_sblim() lib/VirtLib/live.py | 6 +-- .../cimtest/ElementConforms/04_ectp_rev_errs.py | 2 +- suites/libvirt-cim/cimtest/HostSystem/01_enum.py | 56 +++++++--------------- .../cimtest/HostSystem/03_hs_to_settdefcap.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 28 ----------- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- 6 files changed, 24 insertions(+), 72 deletions(-) -- 1.9.0 From jferlan at redhat.com Tue May 20 18:26:26 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:26:26 -0400 Subject: [Libvirt-cim] [PATCH 1/3] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <1400610388-907-1-git-send-email-jferlan@redhat.com> References: <1400610388-907-1-git-send-email-jferlan@redhat.com> Message-ID: <1400610388-907-2-git-send-email-jferlan@redhat.com> Use socket.getfqdn() rather than socket.gethostbyaddr(socket.gethostname())[0] to return the fully qualified domain name. Also, since the input parameter 'server' was never used - just remove it Signed-off-by: John Ferlan --- lib/VirtLib/live.py | 6 +++--- suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py | 2 +- suites/libvirt-cim/cimtest/HostSystem/01_enum.py | 4 ++-- suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py index c929e71..45a6713 100644 --- a/lib/VirtLib/live.py +++ b/lib/VirtLib/live.py @@ -99,7 +99,7 @@ def hostname(server): return out -def full_hostname(server): - """To return the fully qualifiec domain name(FQDN) of the system""" +def full_hostname(): + """To return the fully qualified domain name(FQDN) of the system""" - return socket.gethostbyaddr(socket.gethostname())[0] + return socket.getfqdn() diff --git a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py index fa92176..b724815 100644 --- a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py +++ b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py @@ -155,7 +155,7 @@ def main(): hs = get_typed_class(options.virt, "HostSystem") cs = get_typed_class(options.virt, "ComputerSystem") - host_name = full_hostname(options.ip) + host_name = full_hostname() host_name_val = [ 'CreationClassName', hs, 'Name', host_name diff --git a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py index fd44b8b..75d6f5d 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py +++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py @@ -40,8 +40,8 @@ SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC'] @do_main(SUPPORTED_TYPES) def main(): options = main.options - host = full_hostname(options.ip) - + host = full_hostname() + status = FAIL keys = ['Name', 'CreationClassName'] name = get_typed_class(options.virt, 'HostSystem') diff --git a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py index f960911..8bbe8c1 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py +++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py @@ -100,7 +100,7 @@ def get_inst_from_list(cn, qcn, list, filter, exp_val): def get_hostsys(server, virt="Xen"): status = PASS - host = full_hostname(server) + host = full_hostname() try: status, host_inst = get_host_info(server, virt) diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index 3bea13c..c38b4dd 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -1109,7 +1109,7 @@ def get_class(virt): def set_default(server): dict = {} - dict['default_sysname'] = live.full_hostname(server) + dict['default_sysname'] = live.full_hostname() dict['default_port'] = CIM_PORT dict['default_url'] = "%s:%s" % (dict['default_sysname'], dict['default_port']) -- 1.9.0 From jferlan at redhat.com Tue May 20 18:26:27 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:26:27 -0400 Subject: [Libvirt-cim] [PATCH 2/3] HostSystem: Remove call to check_sblim In-Reply-To: <1400610388-907-1-git-send-email-jferlan@redhat.com> References: <1400610388-907-1-git-send-email-jferlan@redhat.com> Message-ID: <1400610388-907-3-git-send-email-jferlan@redhat.com> Following the lead of commit id 'd669e64e', remove the check_sblim(). Then rework the remaining code to remove the "ret == PASS" section which was only done when check_sblim() was a valid function. Also removed spurious whitespace and reworked failure checks to check and message each condition separately - otherwise it was possible to get a message where expected and got values were the same if either failed. Signed-off-by: John Ferlan --- suites/libvirt-cim/cimtest/HostSystem/01_enum.py | 52 ++++++++---------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py index 75d6f5d..8ddc8b2 100644 --- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py +++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py @@ -28,9 +28,8 @@ import sys from XenKvmLib import enumclass from XenKvmLib.classes import get_typed_class -from VirtLib.live import full_hostname +from VirtLib.live import full_hostname from VirtLib import utils -from XenKvmLib.common_util import check_sblim from CimTest.Globals import logger, CIM_ERROR_ENUMERATE from XenKvmLib.const import do_main from CimTest.ReturnCodes import PASS, FAIL @@ -42,48 +41,29 @@ def main(): options = main.options host = full_hostname() - status = FAIL keys = ['Name', 'CreationClassName'] name = get_typed_class(options.virt, 'HostSystem') - - ret, linux_cs = check_sblim(options.ip, options.virt) + try: hs = enumclass.EnumInstances(options.ip, name) except Exception, details: logger.error("%s %s: %s", CIM_ERROR_ENUMERATE, name, details) - status = FAIL + return FAIL + + if len(hs) != 1: + logger.error("Expected 1 %s instance returned got %d", name, len(hs)) + return FAIL - if ret == PASS: - if len(hs) != 0: - if hs[0].CreationClassName != name or hs[0].Name != host: - logger.error("Exp %s, got %s", name, hs[0].CreationClassName) - logger.error("Exp %s, got %s", host, hs[0].Name) - return FAIL - else: - return PASS - else: - if linux_cs.CreationClassName != 'Linux_ComputerSystem'\ - or linux_cs.Name != host: - logger.error("Exp Linux_ComputerSystem, got %s", - linux_cs.CreationClassName) - logger.error("Exp %s, got %s", host, system.Name) - return FAIL - else: - return PASS - else: - if len(hs) != 1: - logger.error("Expected 1 %s instance returned", name) - return FAIL - - system = hs[0] + system = hs[0] - if system.CreationClassName != name or system.Name != host: - logger.error("Exp %s, got %s", name, system.CreationClassName) - logger.error("Exp %s, got %s", host, system.Name) - status = FAIL - else: - logger.info("%s is %s", name, host) - status = PASS + status = PASS + logger.info("%s is %s", name, host) + if system.CreationClassName != name: + status = FAIL + logger.error("Exp %s, got %s", name, system.CreationClassName) + if system.Name != host: + logger.error("Exp %s, got %s", host, system.Name) + status = FAIL return status -- 1.9.0 From jferlan at redhat.com Tue May 20 18:26:28 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:26:28 -0400 Subject: [Libvirt-cim] [PATCH 3/3] XenKvmLib: Remove check_sblim() In-Reply-To: <1400610388-907-1-git-send-email-jferlan@redhat.com> References: <1400610388-907-1-git-send-email-jferlan@redhat.com> Message-ID: <1400610388-907-4-git-send-email-jferlan@redhat.com> Seeing as "some day" has never come - just remove the check_sblim() function so as to not have unused code lying around to wonder about. Signed-off-by: John Ferlan --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 28 ------------------------- 1 file changed, 28 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index 0e3f1d6..3b35167 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -154,13 +154,6 @@ def poll_for_state_change(server, virt, dom, exp_state, timeout=30): def get_host_info(server, virt): try: - # Commenting out sblim check as libvirt-cim is not supporting it anymore. - # Leaving them commented, in case we add support for sblim at later time. - - # status, linux_cs = check_sblim(server) - # if status == PASS: - # return status, linux_cs - hs_class = get_typed_class(virt, 'HostSystem') host_info = enumclass.EnumInstances(server, hs_class) if len(host_info) == 1: @@ -458,27 +451,6 @@ def libvirt_cached_data_poll(ip, virt, dom_name): return cs -def check_sblim(server, virt='Xen'): - status = FAIL - prev_namespace = Globals.CIM_NS - Globals.CIM_NS = 'root/cimv2' - keys = ['Name', 'CreationClassName'] - linux_cs = None - cs = 'Linux_ComputerSystem' - try: - linux = enumclass.EnumInstances(server, cs) - if len(linux) == 1: - status = PASS - linux_cs = linux[0] - else: - logger.info("Enumerate of Linux_ComputerSystem return NULL") - except Exception, detail: - logger.error(CIM_ERROR_ENUMERATE, 'Linux_ComputerSystem') - logger.error("Exception: %s", detail) - - Globals.CIM_NS = prev_namespace - return status, linux_cs - def parse_instance_id(instid): str_arr = instid.split("/") if len(str_arr) < 2: -- 1.9.0 From jferlan at redhat.com Tue May 20 18:55:57 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 20 May 2014 14:55:57 -0400 Subject: [Libvirt-cim] [PATCH] Add disk device='lun' support In-Reply-To: <1400226046-27170-1-git-send-email-gesaint@linux.vnet.ibm.com> References: <1400226046-27170-1-git-send-email-gesaint@linux.vnet.ibm.com> Message-ID: <537BA53D.3050809@redhat.com> On 05/16/2014 03:40 AM, Xu Wang wrote: > Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one > more value 'lun' should be supported by value of device field in > the disk device. So this patch adds it into libvirt-cim. Now device > like could be operated by class. > > Signed-off-by: Xu Wang > --- > schema/ResourceAllocationSettingData.mof | 8 ++++---- > src/Virt_RASD.c | 3 +++ > src/Virt_RASD.h | 1 + > src/Virt_SettingsDefineCapabilities.c | 2 ++ > src/Virt_VirtualSystemManagementService.c | 2 ++ > 5 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof > index 9c387f0..f78d423 100644 > --- a/schema/ResourceAllocationSettingData.mof > +++ b/schema/ResourceAllocationSettingData.mof > @@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData > string VirtualDevice; > > [Description ("Device emulation type"), > - ValueMap {"0", "1", "2"}, > - Values {"Disk", "CDROM", "floppy"}] > + ValueMap {"0", "1", "2", "4"}, > + Values {"Disk", "CDROM", "floppy", "lun"}] > uint16 EmulatedType; > > [Description ("Bus type of the device")] > @@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData > string VirtualDevice; > > [Description ("Device emulation type"), > - ValueMap {"0", "1", "2", "3"}, > - Values {"Disk", "CDROM", "floppy", "filesystem"}] > + ValueMap {"0", "1", "2", "3", "4"}, > + Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}] > uint16 EmulatedType; > > [Description ("Bus type of the device")] > diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c > index 3c62c2d..761d053 100644 > --- a/src/Virt_RASD.c > +++ b/src/Virt_RASD.c > @@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, > else if ((dev->dev.disk.device != NULL) && > STREQ(dev->dev.disk.device, "floppy")) > type = VIRT_DISK_TYPE_FLOPPY; > + else if ((dev->dev.disk.device != NULL) && > + STREQ(dev->dev.disk.device, "lun")) > + type = VIRT_DISK_TYPE_LUN; > else > type = VIRT_DISK_TYPE_DISK; > > diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h > index 400143f..49d7195 100644 > --- a/src/Virt_RASD.h > +++ b/src/Virt_RASD.h > @@ -27,6 +27,7 @@ > #define VIRT_DISK_TYPE_CDROM 1 > #define VIRT_DISK_TYPE_FLOPPY 2 > #define VIRT_DISK_TYPE_FS 3 > +#define VIRT_DISK_TYPE_LUN 4 > > char *rasd_to_xml(CMPIInstance *rasd); > > diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c > index 756e46b..714153e 100644 > --- a/src/Virt_SettingsDefineCapabilities.c > +++ b/src/Virt_SettingsDefineCapabilities.c > @@ -1078,6 +1078,8 @@ static CMPIStatus set_disk_props(int type, > dev = "hdc"; > } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) { > dev = "fda"; > + } else if (emu_type == VIRT_DISK_TYPE_LUN) { > + dev = "sda"; Are there any other properties that should be set here? I see that TYPE_DISK sets "VirtualQuantity" which is something I would think a LUN would have. > } > > CMSetProperty(inst, "VirtualDevice", > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index f673c38..28a9a5f 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -1149,6 +1149,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, @ line 1116 there's a check for type == VIRT_DISK_TYPE_DISK || TYPE_FS with some sort of sub test for disk_type - is that something that perhaps needs to be checked for LUN as well? > dev->dev.disk.device = strdup("floppy"); > else if (type == VIRT_DISK_TYPE_FS) > dev->dev.disk.device = strdup("filesystem"); > + else if (type == VIRT_DISK_TYPE_LUN) > + dev->dev.disk.device = strdup("lun"); > else > return "Invalid value for EmulatedType"; > > My cimtest run went fine, which is good! So just answer the two inquiries and I can push this. If necessary I can squash whatever you want in... John From gesaint at linux.vnet.ibm.com Mon May 26 09:00:35 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Mon, 26 May 2014 17:00:35 +0800 Subject: [Libvirt-cim] [PATCH] Complete the support for dumpCore Message-ID: <1401094835-24383-1-git-send-email-gesaint@linux.vnet.ibm.com> Add API support for dumpCore field of Memory devices. Signed-off-by: Xu Wang --- libxkutil/device_parsing.c | 1 + schema/ResourceAllocationSettingData.mof | 3 +++ src/Virt_RASD.c | 8 ++++++++ src/Virt_VirtualSystemManagementService.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 0 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index f863cc5..d654a6a 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1438,6 +1438,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev) } else if (dev->type == CIM_RES_TYPE_MEM) { dev->dev.mem.size = _dev->dev.mem.size; dev->dev.mem.maxsize = _dev->dev.mem.maxsize; + dev->dev.mem.dumpCore = _dev->dev.mem.dumpCore; } else if (dev->type == CIM_RES_TYPE_PROC) { dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; } else if (dev->type == CIM_RES_TYPE_EMU) { diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 9c387f0..11a444f 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -229,6 +229,9 @@ class Xen_MemResourceAllocationSettingData : Xen_ResourceAllocationSettingData ] class KVM_MemResourceAllocationSettingData : KVM_ResourceAllocationSettingData { + [Description ("dumpCore could be set as 'on' or 'off'. " + "it also could be leave null.")] + boolean dumpCore; }; [Description ("LXC virtual memory"), diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index 3c62c2d..691fff9 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -1044,6 +1044,14 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker, (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); CMSetProperty(inst, "Limit", (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); + + if (dev->dev.mem.dumpCore != MEM_DUMP_CORE_NOT_SET) { + bool dumpCore = true; + if (dev->dev.mem.dumpCore == MEM_DUMP_CORE_OFF) + dumpCore = false; + CMSetProperty(inst, "dumpCore", + (CMPIValue *)&dumpCore, CMPI_boolean); + } } else if (dev->type == CIM_RES_TYPE_PROC) { set_proc_rasd_params(broker, ref, dev, host, inst); } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index f673c38..f228a73 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1236,6 +1236,17 @@ static const char *mem_rasd_to_vdev(CMPIInstance *inst, const char *units; CMPIrc ret; int shift; + bool dumpCore; + + ret = cu_get_bool_prop(inst, "dumpCore", &dumpCore); + if (ret != CMPI_RC_OK) { + dev->dev.mem.dumpCore = MEM_DUMP_CORE_NOT_SET; + } else { + if (dumpCore) + dev->dev.mem.dumpCore = MEM_DUMP_CORE_ON; + else + dev->dev.mem.dumpCore = MEM_DUMP_CORE_OFF; + } ret = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size); if (ret != CMPI_RC_OK) -- 1.7.1 From gesaint at linux.vnet.ibm.com Tue May 27 08:06:13 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 27 May 2014 16:06:13 +0800 Subject: [Libvirt-cim] [PATCH] Add disk device='lun' support In-Reply-To: <537BA53D.3050809@redhat.com> References: <1400226046-27170-1-git-send-email-gesaint@linux.vnet.ibm.com> <537BA53D.3050809@redhat.com> Message-ID: <53844775.8020103@linux.vnet.ibm.com> ? 2014?05?21? 02:55, John Ferlan ??: > > On 05/16/2014 03:40 AM, Xu Wang wrote: >> Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one >> more value 'lun' should be supported by value of device field in >> the disk device. So this patch adds it into libvirt-cim. Now device >> like could be operated by class. >> >> Signed-off-by: Xu Wang >> --- >> schema/ResourceAllocationSettingData.mof | 8 ++++---- >> src/Virt_RASD.c | 3 +++ >> src/Virt_RASD.h | 1 + >> src/Virt_SettingsDefineCapabilities.c | 2 ++ >> src/Virt_VirtualSystemManagementService.c | 2 ++ >> 5 files changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof >> index 9c387f0..f78d423 100644 >> --- a/schema/ResourceAllocationSettingData.mof >> +++ b/schema/ResourceAllocationSettingData.mof >> @@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData >> string VirtualDevice; >> >> [Description ("Device emulation type"), >> - ValueMap {"0", "1", "2"}, >> - Values {"Disk", "CDROM", "floppy"}] >> + ValueMap {"0", "1", "2", "4"}, >> + Values {"Disk", "CDROM", "floppy", "lun"}] >> uint16 EmulatedType; >> >> [Description ("Bus type of the device")] >> @@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData >> string VirtualDevice; >> >> [Description ("Device emulation type"), >> - ValueMap {"0", "1", "2", "3"}, >> - Values {"Disk", "CDROM", "floppy", "filesystem"}] >> + ValueMap {"0", "1", "2", "3", "4"}, >> + Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}] >> uint16 EmulatedType; >> >> [Description ("Bus type of the device")] >> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c >> index 3c62c2d..761d053 100644 >> --- a/src/Virt_RASD.c >> +++ b/src/Virt_RASD.c >> @@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, >> else if ((dev->dev.disk.device != NULL) && >> STREQ(dev->dev.disk.device, "floppy")) >> type = VIRT_DISK_TYPE_FLOPPY; >> + else if ((dev->dev.disk.device != NULL) && >> + STREQ(dev->dev.disk.device, "lun")) >> + type = VIRT_DISK_TYPE_LUN; >> else >> type = VIRT_DISK_TYPE_DISK; >> >> diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h >> index 400143f..49d7195 100644 >> --- a/src/Virt_RASD.h >> +++ b/src/Virt_RASD.h >> @@ -27,6 +27,7 @@ >> #define VIRT_DISK_TYPE_CDROM 1 >> #define VIRT_DISK_TYPE_FLOPPY 2 >> #define VIRT_DISK_TYPE_FS 3 >> +#define VIRT_DISK_TYPE_LUN 4 >> >> char *rasd_to_xml(CMPIInstance *rasd); >> >> diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c >> index 756e46b..714153e 100644 >> --- a/src/Virt_SettingsDefineCapabilities.c >> +++ b/src/Virt_SettingsDefineCapabilities.c >> @@ -1078,6 +1078,8 @@ static CMPIStatus set_disk_props(int type, >> dev = "hdc"; >> } else if (emu_type == VIRT_DISK_TYPE_FLOPPY) { >> dev = "fda"; >> + } else if (emu_type == VIRT_DISK_TYPE_LUN) { >> + dev = "sda"; > Are there any other properties that should be set here? I see that > TYPE_DISK sets "VirtualQuantity" which is something I would think a LUN > would have. lun devices like disk, need to state size field as well. So I think your words are right. "VirtualQuantity" is needed here. Others have not been found like that. I'll update this patch to V2. >> } >> >> CMSetProperty(inst, "VirtualDevice", >> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c >> index f673c38..28a9a5f 100644 >> --- a/src/Virt_VirtualSystemManagementService.c >> +++ b/src/Virt_VirtualSystemManagementService.c >> @@ -1149,6 +1149,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, > @ line 1116 there's a check for type == VIRT_DISK_TYPE_DISK || TYPE_FS > with some sort of sub test for disk_type - is that something that > perhaps needs to be checked for LUN as well? I am afraid so it is. Thanks, Xu Wang >> dev->dev.disk.device = strdup("floppy"); >> else if (type == VIRT_DISK_TYPE_FS) >> dev->dev.disk.device = strdup("filesystem"); >> + else if (type == VIRT_DISK_TYPE_LUN) >> + dev->dev.disk.device = strdup("lun"); >> else >> return "Invalid value for EmulatedType"; >> >> > My cimtest run went fine, which is good! > > So just answer the two inquiries and I can push this. If necessary I > can squash whatever you want in... > > John > From gesaint at linux.vnet.ibm.com Tue May 27 08:14:10 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 27 May 2014 16:14:10 +0800 Subject: [Libvirt-cim] [PATCH V2] Add disk device='lun' support Message-ID: <1401178450-14982-1-git-send-email-gesaint@linux.vnet.ibm.com> Besides 'disk', 'cdrom', 'floppy' and 'filesystem', there is one more value 'lun' should be supported by value of device field in the disk device. So this patch adds it into libvirt-cim. Now device like could be operated by class. Signed-off-by: Xu Wang --- schema/ResourceAllocationSettingData.mof | 8 ++++---- src/Virt_RASD.c | 3 +++ src/Virt_RASD.h | 1 + src/Virt_SettingsDefineCapabilities.c | 3 ++- src/Virt_VirtualSystemManagementService.c | 5 ++++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof index 9c387f0..f78d423 100644 --- a/schema/ResourceAllocationSettingData.mof +++ b/schema/ResourceAllocationSettingData.mof @@ -10,8 +10,8 @@ class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData string VirtualDevice; [Description ("Device emulation type"), - ValueMap {"0", "1", "2"}, - Values {"Disk", "CDROM", "floppy"}] + ValueMap {"0", "1", "2", "4"}, + Values {"Disk", "CDROM", "floppy", "lun"}] uint16 EmulatedType; [Description ("Bus type of the device")] @@ -43,8 +43,8 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData string VirtualDevice; [Description ("Device emulation type"), - ValueMap {"0", "1", "2", "3"}, - Values {"Disk", "CDROM", "floppy", "filesystem"}] + ValueMap {"0", "1", "2", "3", "4"}, + Values {"Disk", "CDROM", "floppy", "filesystem", "lun"}] uint16 EmulatedType; [Description ("Bus type of the device")] diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c index 3c62c2d..761d053 100644 --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -444,6 +444,9 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker, else if ((dev->dev.disk.device != NULL) && STREQ(dev->dev.disk.device, "floppy")) type = VIRT_DISK_TYPE_FLOPPY; + else if ((dev->dev.disk.device != NULL) && + STREQ(dev->dev.disk.device, "lun")) + type = VIRT_DISK_TYPE_LUN; else type = VIRT_DISK_TYPE_DISK; diff --git a/src/Virt_RASD.h b/src/Virt_RASD.h index 400143f..49d7195 100644 --- a/src/Virt_RASD.h +++ b/src/Virt_RASD.h @@ -27,6 +27,7 @@ #define VIRT_DISK_TYPE_CDROM 1 #define VIRT_DISK_TYPE_FLOPPY 2 #define VIRT_DISK_TYPE_FS 3 +#define VIRT_DISK_TYPE_LUN 4 char *rasd_to_xml(CMPIInstance *rasd); diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c index 756e46b..49986ff 100644 --- a/src/Virt_SettingsDefineCapabilities.c +++ b/src/Virt_SettingsDefineCapabilities.c @@ -1071,7 +1071,8 @@ static CMPIStatus set_disk_props(int type, (CMPIValue *)"FV disk", CMPI_chars); } - if (emu_type == VIRT_DISK_TYPE_DISK) { + if (emu_type == VIRT_DISK_TYPE_DISK || + emu_type == VIRT_DISK_TYPE_LUN) { CMSetProperty(inst, "VirtualQuantity", (CMPIValue *)&disk_size, CMPI_uint64); } else if (emu_type == VIRT_DISK_TYPE_CDROM) { diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index f673c38..c640360 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1114,7 +1114,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, type = VIRT_DISK_TYPE_DISK; if ((type == VIRT_DISK_TYPE_DISK) || - (type == VIRT_DISK_TYPE_FS)){ + (type == VIRT_DISK_TYPE_FS) || + (type == VIRT_DISK_TYPE_LUN)){ if (dev->dev.disk.disk_type == DISK_UNKNOWN) { /* on success or fail caller should try free it */ rc = asprintf(p_error, "Device %s, Address %s, " @@ -1149,6 +1150,8 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, dev->dev.disk.device = strdup("floppy"); else if (type == VIRT_DISK_TYPE_FS) dev->dev.disk.device = strdup("filesystem"); + else if (type == VIRT_DISK_TYPE_LUN) + dev->dev.disk.device = strdup("lun"); else return "Invalid value for EmulatedType"; -- 1.7.1 From gesaint at linux.vnet.ibm.com Tue May 27 08:57:31 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 27 May 2014 16:57:31 +0800 Subject: [Libvirt-cim] [PATCH] cimtest: Update controller type from pci to scsi In-Reply-To: <537A0D1B.9010308@redhat.com> References: <1399541142-3391-1-git-send-email-gesaint@linux.vnet.ibm.com> <537A0D1B.9010308@redhat.com> Message-ID: <5384537B.3080701@linux.vnet.ibm.com> ? 2014?05?19? 21:54, John Ferlan ??: > > On 05/08/2014 05:25 AM, Xu Wang wrote: >> To test controller device new element > model='pci-root'> was introduced into domain xml. But it was not supported >> until libvirt-1.0.5. Now RHEL-6.5 is using libvirt-0.10.2-29. It could >> involve regression issue. Hence here I updated it to > index='0' model='virtio-scsi'> to test fields of this device. >> >> Signed-off-by: Xu Wang >> --- >> .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 2 +- >> .../02_reverse.py | 2 +- >> suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- >> 3 files changed, 3 insertions(+), 3 deletions(-) >> > The patch fails for me in the upstream environment... > > Testing KVM hypervisor > -------------------------------------------------------------------- > SystemDevice - 01_forward.py: FAIL > ERROR - DeviceID mismatch > ERROR - Exception Expected DeviceID: ['test_domain/controller:scsi:0', 'test_domain/controller:usb:0'] > Got: [u'test_domain/controller:pci:0', u'test_domain/controller:scsi:0', u'test_domain/controller:usb:0'] > -------------------------------------------------------------------- > ... > -------------------------------------------------------------------- > VirtualSystemSettingDataComponent - 02_reverse.py: FAIL > ERROR - Assoc instances don't match expect=10 found=9. > ERROR - Did not find association id=VSSDC_dom/controller:pci:0 in assoc_list > -------------------------------------------------------------------- > > What were the failures you saw in the 6.5 environment? > > I'm sure we can come to some sort of "middle ground"... > > How about the following squashed in (does it work in your > environment)?: > > diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libv > index 052efc1..b2a4bfa 100644 > --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py > +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py > @@ -134,6 +134,10 @@ def main(): > controller_cn = get_typed_class(virt, "Controller") > exp_pllist[controller_cn] = [] > exp_pllist[controller_cn].append('%s/controller:scsi:0' % test_dom) > + # pci-root gets added automagically for us since scsi has to > + # hang somewhere > + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: > + exp_pllist[controller_cn].append('%s/controller:pci:0' % test_dom) > exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) > > try: > > and > > diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_rev > index 9060ae4..33877bf 100644 > --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py > +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py > @@ -102,6 +102,10 @@ def assoc_values(ip, assoc_info, virt="Xen"): > if curr_cim_rev >= controller_rev: > # Add controllers too ... will need a cim/cimtest version check > rasd_list.update({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) > + # pci-root gets added automagically for us since scsi has to > + # hang somewhere > + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: > + 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) > > > BTW: I use 1.0.5 only because of your note... > > John I have updated my patch based on your comments. It works fine for RHEL-6.5. But I am seeking the root cause of several other failed testcases. -------------------------------------------------------------------- ComputerSystemIndication - 01_created_indication.py: FAIL ERROR - Waited too long for define indication ERROR - Exception: Poll for indication Failed ERROR - Waited too long for start indication ERROR - Exception: Poll for indication Failed ERROR - Waited too long for destroy indication ERROR - Exception: Poll for indication Failed -------------------------------------------------------------------- -------------------------------------------------------------------- ElementConforms - 01_forward.py: FAIL ERROR - Exception: 'KVM_ElementConformsToProfile' returned (0) 'KVM_RegisteredProfile' objects -------------------------------------------------------------------- ElementConforms - 02_reverse.py: FAIL ERROR - ElementConformsToProfile assoc failed Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. -------------------------------------------------------------------- -------------------------------------------------------------------- ElementConforms - 04_ectp_rev_errs.py: FAIL ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_CCName_Keyname------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_CCName_Keyvalue------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_Name_Keyname------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_Name_Keyvalue------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_CCName_Keyname------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_CCName_Keyvalue------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_Name_Keyname------ ERROR - Unexpected rc code 100 and description Unrecognized CIM status code "100": Cannot connect to local CIM server. Connection failed. ERROR - ------ FAILED: INVALID_Name_Keyvalue------ -------------------------------------------------------------------- -------------------------------------------------------------------- Profile - 02_profile_to_elec.py: FAIL ERROR - KVM_ComputerSystem with domguest was not returned -------------------------------------------------------------------- -------------------------------------------------------------------- RASDIndications - 01_guest_states_rasd_ind.py: FAIL ERROR - Exception: Poll for indication Failed -------------------------------------------------------------------- RASDIndications - 02_guest_add_mod_rem_rasd_ind.py: FAIL ERROR - Exception: Poll for indication Failed -------------------------------------------------------------------- -------------------------------------------------------------------- VirtualSystemSnapshotService - 03_create_snapshot.py: FAIL ERROR - Exception: CreateSnapshot failed to return a CIM job inst ERROR - Failed to remove snapshot file for snapshot_vm -------------------------------------------------------------------- But I still have no idea about them. Thanks, Xu Wang > >> diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py >> index f81aff1..052efc1 100644 >> --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py >> +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py >> @@ -133,7 +133,7 @@ def main(): >> 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:scsi:0' % test_dom) >> exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) >> >> try: >> diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py >> index a7e6c17..9060ae4 100644 >> --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py >> +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py >> @@ -101,7 +101,7 @@ def assoc_values(ip, assoc_info, virt="Xen"): >> >> 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({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) >> rasd_list.update({"usb_rasd":"%s/controller:usb:0" % test_dom}) >> >> expect_rasds = len(rasd_list) >> diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> index 3bea13c..9ea46e4 100644 >> --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py >> @@ -937,7 +937,7 @@ class KVMXML(VirtXML, VirtCIM): >> is_ipv6_only=None, >> port_num='-1', keymap="en-us", irstype="mouse", >> btype="ps2", vnc_passwd=None, >> - ctltype="pci", ctlindex=0, ctlmodel="pci-root"): >> + ctltype="scsi", ctlindex=0, ctlmodel="virtio-scsi"): >> # Optionally the following works too: >> #ctltype="usb", ctlindex=0, ctlmodel=None): >> if not os.path.exists(disk_file_path): >> From gesaint at linux.vnet.ibm.com Tue May 27 08:58:21 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 27 May 2014 16:58:21 +0800 Subject: [Libvirt-cim] [PATCH V2] cimtest: Update controller type from pci to scsi Message-ID: <1401181101-340-1-git-send-email-gesaint@linux.vnet.ibm.com> To test controller device new element was introduced into domain xml. But it was not supported until libvirt-1.0.5. Now RHEL-6.5 is using libvirt-0.10.2-29. It could involve regression issue. Hence here I updated it to to test fields of this device. Signed-off-by: Xu Wang --- .../libvirt-cim/cimtest/SystemDevice/01_forward.py | 6 +++++- .../02_reverse.py | 6 +++++- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py index f81aff1..3fab346 100644 --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py @@ -133,7 +133,11 @@ def main(): 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:scsi:0' % test_dom) + # pci-root gets added automagically for us since scsi has to + # hang somewhere + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: + exp_pllist[controller_cn].append('%s/controller:pci:0' % test_dom) exp_pllist[controller_cn].append('%s/controller:usb:0' % test_dom) try: diff --git a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py index a7e6c17..89124e3 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py @@ -101,7 +101,11 @@ def assoc_values(ip, assoc_info, virt="Xen"): 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({"scsi_rasd":"%s/controller:scsi:0" % test_dom}) + # pci-root gets added automagically for us since scsi has to + # hang somewhere + if virsh_version_cmp(libvirt_version, "1.0.5") >= 0: + 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) diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index c38b4dd..8c4256c 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -937,7 +937,7 @@ class KVMXML(VirtXML, VirtCIM): is_ipv6_only=None, port_num='-1', keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None, - ctltype="pci", ctlindex=0, ctlmodel="pci-root"): + ctltype="scsi", ctlindex=0, ctlmodel="virtio-scsi"): # Optionally the following works too: #ctltype="usb", ctlindex=0, ctlmodel=None): if not os.path.exists(disk_file_path): -- 1.7.1 From gesaint at linux.vnet.ibm.com Tue May 27 09:00:05 2014 From: gesaint at linux.vnet.ibm.com (Xu Wang) Date: Tue, 27 May 2014 17:00:05 +0800 Subject: [Libvirt-cim] [PATCH 1/3] live.full_hostname: Adjust mechanism to get FQDN In-Reply-To: <1400610388-907-2-git-send-email-jferlan@redhat.com> References: <1400610388-907-1-git-send-email-jferlan@redhat.com> <1400610388-907-2-git-send-email-jferlan@redhat.com> Message-ID: <53845415.8020702@linux.vnet.ibm.com> It works fine for me. hostname mismatch issue has been solved by this patch. Thanks, Xu Wang ? 2014?05?21? 02:26, John Ferlan ??: > Use socket.getfqdn() rather than socket.gethostbyaddr(socket.gethostname())[0] > to return the fully qualified domain name. Also, since the input parameter > 'server' was never used - just remove it > > Signed-off-by: John Ferlan > --- > lib/VirtLib/live.py | 6 +++--- > suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py | 2 +- > suites/libvirt-cim/cimtest/HostSystem/01_enum.py | 4 ++-- > suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py | 2 +- > suites/libvirt-cim/lib/XenKvmLib/vxml.py | 2 +- > 5 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py > index c929e71..45a6713 100644 > --- a/lib/VirtLib/live.py > +++ b/lib/VirtLib/live.py > @@ -99,7 +99,7 @@ def hostname(server): > > return out > > -def full_hostname(server): > - """To return the fully qualifiec domain name(FQDN) of the system""" > +def full_hostname(): > + """To return the fully qualified domain name(FQDN) of the system""" > > - return socket.gethostbyaddr(socket.gethostname())[0] > + return socket.getfqdn() > diff --git a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py > index fa92176..b724815 100644 > --- a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py > +++ b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py > @@ -155,7 +155,7 @@ def main(): > > hs = get_typed_class(options.virt, "HostSystem") > cs = get_typed_class(options.virt, "ComputerSystem") > - host_name = full_hostname(options.ip) > + host_name = full_hostname() > host_name_val = [ > 'CreationClassName', hs, > 'Name', host_name > diff --git a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py > index fd44b8b..75d6f5d 100644 > --- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py > +++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py > @@ -40,8 +40,8 @@ SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC'] > @do_main(SUPPORTED_TYPES) > def main(): > options = main.options > - host = full_hostname(options.ip) > - > + host = full_hostname() > + > status = FAIL > keys = ['Name', 'CreationClassName'] > name = get_typed_class(options.virt, 'HostSystem') > diff --git a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py > index f960911..8bbe8c1 100644 > --- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py > +++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py > @@ -100,7 +100,7 @@ def get_inst_from_list(cn, qcn, list, filter, exp_val): > > def get_hostsys(server, virt="Xen"): > status = PASS > - host = full_hostname(server) > + host = full_hostname() > > try: > status, host_inst = get_host_info(server, virt) > diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > index 3bea13c..c38b4dd 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > @@ -1109,7 +1109,7 @@ def get_class(virt): > > def set_default(server): > dict = {} > - dict['default_sysname'] = live.full_hostname(server) > + dict['default_sysname'] = live.full_hostname() > dict['default_port'] = CIM_PORT > dict['default_url'] = "%s:%s" % (dict['default_sysname'], > dict['default_port'])