[PATCH 00/10] cimtest: changes for controller and upstream support

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

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 <jferlan@redhat.com> --- 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

于 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 <jferlan@redhat.com> --- 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

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 <jferlan@redhat.com> --- 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

于 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 <jferlan@redhat.com> --- 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <jferlan@redhat.com> --- 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

于 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<jferlan@redhat.com> --- 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 "<stdin>", line 1, in <module> 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

<...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 "<stdin>", line 1, in <module> 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 "<stdin>", line 1, in <module> 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

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 <jferlan@redhat.com> --- 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <jferlan@redhat.com> --- 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

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 <jferlan@redhat.com> --- .../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

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 <jferlan@redhat.com> --- .../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

Add support to handle a controller device variantly based up on the libvirt-cim revision value Signed-off-by: John Ferlan <jferlan@redhat.com> --- 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 + +@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

于 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 <jferlan@redhat.com> --- 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 + +@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)

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 <jferlan@redhat.com> --- 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 + +@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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Add controller RASD's to various tests. Signed-off-by: John Ferlan <jferlan@redhat.com> --- .../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

Add support to have a controller pool for the controller RASD Signed-off-by: John Ferlan <jferlan@redhat.com> --- 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

Add support for controller pools Signed-off-by: John Ferlan <jferlan@redhat.com> --- 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

于 2014年04月05日 00:12, John Ferlan 写道:
Add support for controller pools
Signed-off-by: John Ferlan <jferlan@redhat.com> --- 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 = {}

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 <jferlan@redhat.com> --- 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <jferlan@redhat.com> --- 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

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 <jferlan@redhat.com> --- .../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

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

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 <controller type='pci' ...> (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

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 <controller type='pci' ...> (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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <controller type='pci' ...> (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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <controller type='pci' ...> (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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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 <controller type='pci' ...> (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

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 写道:
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 <controller type='pci' ...> (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
On 04/21/2014 10:59 PM, Xu Wang wrote: 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

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
participants (3)
-
John Ferlan
-
Xu Wang
-
Xu Wang