From veillard at redhat.com Wed Apr 3 13:16:52 2013 From: veillard at redhat.com (Daniel Veillard) Date: Wed, 3 Apr 2013 21:16:52 +0800 Subject: [Libvirt-cim] [PATCH V3 0/2] libcmpiutil: patch rebase for libvirt-cim 6.2 In-Reply-To: <1355822046-25220-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1355822046-25220-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <20130403131652.GG1437@redhat.com> On Tue, Dec 18, 2012 at 05:14:04PM +0800, Wenchao Xia wrote: > Hi, Danial > Sorry for have sent confusing patches, please use this serial for libcmpiutil. > > Wenchao Xia (2): > libcmpiutil: fix potential debug print crash > libcmpiutil: add time and thread info in debug log > > debug_util.c | 19 ++++++++++++++++++- > std_indication.c | 14 ++++++++++++-- > 2 files changed, 30 insertions(+), 3 deletions(-) Sorry for the very long delay, yes looks fine, ACK and pushed ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Fri Apr 5 11:15:03 2013 From: veillard at redhat.com (Daniel Veillard) Date: Fri, 5 Apr 2013 19:15:03 +0800 Subject: [Libvirt-cim] [PATCH V6 00/20] Bug fix patches for 0.6.2 In-Reply-To: <51556A41.8080800@redhat.com> References: <1364205180-21124-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5150CD45.8050800@redhat.com> <5154F79A.7040604@linux.vnet.ibm.com> <51556A41.8080800@redhat.com> Message-ID: <20130405111503.GF22671@redhat.com> On Fri, Mar 29, 2013 at 06:17:37AM -0400, John Ferlan wrote: > On 03/28/2013 10:08 PM, Wenchao Xia wrote: > > ? 2013-3-26 6:18, John Ferlan ??: > >> On 03/25/2013 05:52 AM, Wenchao Xia wrote: > > >> > >> ACK on series. There were a couple of grammar things seen in commit > >> messages and comments, but nothing that isn't understandable ;-) > >> > >> I was able to test using my fedora box, but haven't had the cycles to do > >> the same on the rh64 box. With my cimtest changes I am down to very few > >> errors now - mostly config type stuff (indications don't work for me and > >> I don't have the right setup for a couple of network tests). > >> > >> John > >> > > So nice to know patches are OK. Do you think it can be pulled? > > > > I think DV is the maintainer, right? Not sure how that part works quite > yet. That is - what the process is from here. I do know he also handles > the libvirt releases as well and is in the middle of a release for that > right now. Well both of you have commit acces rights, so you can just push your changes to git (I didn't see them !) > I would be nice to perhaps include the cimtest changes that I posted as > well, although not a requirement for the release. push all you need in git master, test from there (make rpm , cimtest...) and when you feel it is ready tell me i will build a release ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From xiawenc at linux.vnet.ibm.com Sun Apr 7 11:01:48 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Sun, 07 Apr 2013 19:01:48 +0800 Subject: [Libvirt-cim] [PATCH V6 00/20] Bug fix patches for 0.6.2 In-Reply-To: <20130405111503.GF22671@redhat.com> References: <1364205180-21124-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5150CD45.8050800@redhat.com> <5154F79A.7040604@linux.vnet.ibm.com> <51556A41.8080800@redhat.com> <20130405111503.GF22671@redhat.com> Message-ID: <5161521C.3030309@linux.vnet.ibm.com> ? 2013-4-5 19:15, Daniel Veillard ??: > On Fri, Mar 29, 2013 at 06:17:37AM -0400, John Ferlan wrote: >> On 03/28/2013 10:08 PM, Wenchao Xia wrote: >>> ? 2013-3-26 6:18, John Ferlan ??: >>>> On 03/25/2013 05:52 AM, Wenchao Xia wrote: >> >>>> >>>> ACK on series. There were a couple of grammar things seen in commit >>>> messages and comments, but nothing that isn't understandable ;-) >>>> >>>> I was able to test using my fedora box, but haven't had the cycles to do >>>> the same on the rh64 box. With my cimtest changes I am down to very few >>>> errors now - mostly config type stuff (indications don't work for me and >>>> I don't have the right setup for a couple of network tests). >>>> >>>> John >>>> >>> So nice to know patches are OK. Do you think it can be pulled? >>> >> >> I think DV is the maintainer, right? Not sure how that part works quite >> yet. That is - what the process is from here. I do know he also handles >> the libvirt releases as well and is in the middle of a release for that >> right now. > > Well both of you have commit acces rights, so you can just push your > changes to git (I didn't see them !) > >> I would be nice to perhaps include the cimtest changes that I posted as >> well, although not a requirement for the release. > > push all you need in git master, test from there (make rpm , > cimtest...) and when you feel it is ready tell me i will build a > release ! > > Daniel > Hi, Daniel Thanks for you help, I have just spent one day testing it on RH6.4, will try push tommorrow. -- Best Regards Wenchao Xia From xiawenc at linux.vnet.ibm.com Mon Apr 8 09:06:23 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 08 Apr 2013 17:06:23 +0800 Subject: [Libvirt-cim] [PATCH V6 00/20] Bug fix patches for 0.6.2 In-Reply-To: <20130405111503.GF22671@redhat.com> References: <1364205180-21124-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5150CD45.8050800@redhat.com> <5154F79A.7040604@linux.vnet.ibm.com> <51556A41.8080800@redhat.com> <20130405111503.GF22671@redhat.com> Message-ID: <5162888F.60909@linux.vnet.ibm.com> Hi, Danial Patches pushed. > On Fri, Mar 29, 2013 at 06:17:37AM -0400, John Ferlan wrote: >> On 03/28/2013 10:08 PM, Wenchao Xia wrote: >>> ? 2013-3-26 6:18, John Ferlan ??: >>>> On 03/25/2013 05:52 AM, Wenchao Xia wrote: >> >>>> >>>> ACK on series. There were a couple of grammar things seen in commit >>>> messages and comments, but nothing that isn't understandable ;-) >>>> >>>> I was able to test using my fedora box, but haven't had the cycles to do >>>> the same on the rh64 box. With my cimtest changes I am down to very few >>>> errors now - mostly config type stuff (indications don't work for me and >>>> I don't have the right setup for a couple of network tests). >>>> >>>> John >>>> >>> So nice to know patches are OK. Do you think it can be pulled? >>> >> >> I think DV is the maintainer, right? Not sure how that part works quite >> yet. That is - what the process is from here. I do know he also handles >> the libvirt releases as well and is in the middle of a release for that >> right now. > > Well both of you have commit acces rights, so you can just push your > changes to git (I didn't see them !) > >> I would be nice to perhaps include the cimtest changes that I posted as >> well, although not a requirement for the release. > > push all you need in git master, test from there (make rpm , > cimtest...) and when you feel it is ready tell me i will build a > release ! > > Daniel > -- Best Regards Wenchao Xia From xiawenc at linux.vnet.ibm.com Mon Apr 8 10:16:22 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 8 Apr 2013 18:16:22 +0800 Subject: [Libvirt-cim] [PATCH 2/3] test: rasd use int as comparation condtion for libvirt version In-Reply-To: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <1365416183-1084-3-git-send-email-xiawenc@linux.vnet.ibm.com> From: root Signed-off-by: Wenchao Xia --- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index d65011e..11b0e38 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -32,7 +32,7 @@ from XenKvmLib.const import default_pool_name, default_network_name, \ get_provider_version, default_net_type from XenKvmLib.pool import enum_volumes from XenKvmLib.xm_virt_util import virsh_version -from XenKvmLib.common_util import parse_instance_id +from XenKvmLib.common_util import parse_instance_id, get_version_number pasd_cn = 'ProcResourceAllocationSettingData' nasd_cn = 'NetResourceAllocationSettingData' @@ -382,8 +382,9 @@ def get_exp_disk_rasd_len(virt, ip, rev, id): else: exp_len = (volumes * exp_base_num) + exp_cdrom - - if virt != 'LXC' and libvirt_ver >= '0.4.1': + a = get_version_number(libvirt_ver) + b = get_version_number("0.4.1") + if virt != 'LXC' and a >= b: if rev >= libvirt_rasd_storagepool_changes: exp_len += exp_storagevol_rasd -- 1.7.1 From xiawenc at linux.vnet.ibm.com Mon Apr 8 10:16:23 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 8 Apr 2013 18:16:23 +0800 Subject: [Libvirt-cim] [PATCH 3/3] test: RPCS fix nfs issue In-Reply-To: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <1365416183-1084-4-git-send-email-xiawenc@linux.vnet.ibm.com> From: root Signed-off-by: Wenchao Xia --- .../12_create_netfs_storagevolume_errs.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 4 ++-- suites/libvirt-cim/lib/XenKvmLib/pool.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py index 004af9f..27cb2f7 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py @@ -154,7 +154,7 @@ def main(): if status != PASS : raise Exception("Failed to verify the Invlaid '%s' " % pool_name) - + except Exception, details: logger.error("Exception details: %s", details) status = FAIL diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index 3316c51..efcda92 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -536,8 +536,8 @@ def get_nfs_bin(server): if elems[0] == 'Fedora' or (elems[0] == 'Red' and elems[1] == 'Hat'): for i in range(1, len(elems)): if elems[i] == 'release': - if (elems[0] == 'Fedora' and int(elems[i+1]) >= 15) or \ - (elems[0] == 'Red' and int(elems[i+1]) >= 7): + if (elems[0] == 'Fedora' and get_version_number(elems[i+1]) >= 1500) or \ + (elems[0] == 'Red' and get_version_number(elems[i+1]) >= 700): # Handle this differently - the command would be # "systemctl {start|restart|status} nfs" nfs_server_bin = "systemctl %s nfs" diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py index a5ca331..86898b1 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py @@ -26,7 +26,7 @@ from VirtLib import utils from CimTest.Globals import logger, CIM_NS from CimTest.ReturnCodes import PASS, FAIL, SKIP from XenKvmLib.classes import get_typed_class, inst_to_mof -from XenKvmLib.const import get_provider_version, default_pool_name +from XenKvmLib.const import get_provider_version, default_pool_name from XenKvmLib.enumclass import EnumInstances, GetInstance, EnumNames from XenKvmLib.assoc import Associators from VirtLib.utils import run_remote @@ -37,7 +37,7 @@ from CimTest.CimExt import CIMClassMOF from XenKvmLib.vxml import NetXML, PoolXML from XenKvmLib.xm_virt_util import virsh_version from XenKvmLib.vsms import RASD_TYPE_STOREVOL -from XenKvmLib.common_util import destroy_diskpool +from XenKvmLib.common_util import destroy_diskpool, get_version_number cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED cim_mname = "CreateChildResourcePool" @@ -183,7 +183,7 @@ def undefine_netpool(server, virt, net_name): def undefine_diskpool(server, virt, dp_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if get_version_number(libvirt_version) >= get_version_number("0.4.1"): if dp_name == None: return FAIL @@ -403,7 +403,7 @@ def cleanup_pool_vol(server, virt, pool_name, vol_name, status = destroy_diskpool(server, virt, pool_name) if status != PASS: raise Exception("Unable to destroy diskpool '%s'" % pool_name) - else: + else: status = undefine_diskpool(server, virt, pool_name) if status != PASS: raise Exception("Unable to undefine diskpool '%s'" \ -- 1.7.1 From xiawenc at linux.vnet.ibm.com Mon Apr 8 10:16:20 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 8 Apr 2013 18:16:20 +0800 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch Message-ID: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> This is a patch follows John's 9 patches for cimtest, after it cimtest should only fail 3 case on RH6.4: HostSystem - 01_enum.py: FAIL HostSystem - 03_hs_to_settdefcap.py: FAIL VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL This patch is only for review and test, it may need adjust and merge with John's patch, and change to author name(not root :|), please do not push directly. root (3): test: common_util, use number to check version test: rasd use int as comparation condtion for libvirt version test: RPCS fix nfs issue .../12_create_netfs_storagevolume_errs.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 32 ++++++++++++++++--- suites/libvirt-cim/lib/XenKvmLib/pool.py | 8 ++-- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 7 ++-- 4 files changed, 36 insertions(+), 13 deletions(-) From xiawenc at linux.vnet.ibm.com Mon Apr 8 10:16:21 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Mon, 8 Apr 2013 18:16:21 +0800 Subject: [Libvirt-cim] [PATCH 1/3] test: common_util, use number to check version In-Reply-To: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <1365416183-1084-2-git-send-email-xiawenc@linux.vnet.ibm.com> From: root Signed-off-by: Wenchao Xia --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 28 ++++++++++++++++++++-- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index 43e5e2c..3316c51 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -23,6 +23,7 @@ import os import pywbem import random +import string from time import sleep from tempfile import mkdtemp from commands import getstatusoutput @@ -296,6 +297,17 @@ def conf_file(): logger.error("Creation of Disk Conf file Failed") return status +def get_version_number(version_str): + num = version_str.split(".") + l = len(num) + total = 0 + multiple = 1 + increase = 100 + for i in range(0, l): + t = string.atoi(num[l - 1- i]) * multiple + total = total + t + multiple = multiple * increase + return total def cleanup_restore(server, virt): """ @@ -308,7 +320,11 @@ def cleanup_restore(server, virt): # libvirt_version >= 0.4.1 # Hence Skipping the logic to delete the new conf file # and just returning PASS - if libvirt_version >= '0.4.1': + libvirt_version = virsh_version(server, virt) + libvirt_version_req = "0.4.1" + a = get_version_number(libvirt_version) + b = get_version_number(libvirt_version_req) + if a >= b: return status try: if os.path.exists(back_disk_file): @@ -365,7 +381,10 @@ def create_diskpool(server, virt='KVM', dpool=default_pool_name, def create_diskpool_conf(server, virt, dpool=default_pool_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + libvirt_version_req = "0.4.1" + a = get_version_number(libvirt_version) + b = get_version_number(libvirt_version_req) + if a >= b: status, dpoolname = create_diskpool(server, virt, dpool) diskid = "%s/%s" % ("DiskPool", dpoolname) else: @@ -376,7 +395,10 @@ def create_diskpool_conf(server, virt, dpool=default_pool_name): def destroy_diskpool(server, virt, dpool): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + libvirt_version_req = "0.4.1" + a = get_version_number(libvirt_version) + b = get_version_number(libvirt_version_req) + if a >= b: if dpool == None: logger.error("No disk pool specified") return FAIL -- 1.7.1 From xiawenc at linux.vnet.ibm.com Tue Apr 9 10:31:15 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Tue, 9 Apr 2013 18:31:15 +0800 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable Message-ID: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> In RH6.4 lldptool query command and output changed a bit, to make it work on different version, the string used in search and options used in lldptool command should be set in configuration file. Signed-off-by: Wenchao Xia --- libvirt-cim.conf | 12 ++++++++++++ libxkutil/misc_util.c | 27 +++++++++++++++++++++++++++ libxkutil/misc_util.h | 4 +++- src/Virt_SwitchService.c | 31 ++++++++++++++++++++++++------- 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/libvirt-cim.conf b/libvirt-cim.conf index 37d7b0f..40fc94a 100644 --- a/libvirt-cim.conf +++ b/libvirt-cim.conf @@ -30,3 +30,15 @@ # Default value: NULL, that is not set. # # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; + +# lldptool_query_options (string) +# Defines the command used in SwitchService to query VEPA support, will be +# used as "lldptool -i [INTERFACE] [OPTIONS]" +# +# lldptool_query_options = "-t -g ncb -V evbcfg"; + +# vsi_search_string (string) +# Defines the string used in SwitchService to search in lldptool's output +# +# vsi_search_string0 = "supported forwarding mode: (0x40) reflective relay"; +# vsi_search_string1 = "supported capabilities: (0x7) RTE ECP VDP"; diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c index 00eb4b1..1a9a1b4 100644 --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -236,6 +236,33 @@ const char *get_mig_ssh_tmp_key(void) return prop.value_string; } +const char *get_lldptool_query_options(void) +{ + static LibvirtcimConfigProperty prop = { + "lldptool_query_options", CONFIG_STRING, {0}, 0}; + + libvirt_cim_config_get(&prop); + return prop.value_string; +} + +const char *get_vsi_search_string0(void) +{ + static LibvirtcimConfigProperty prop = { + "vsi_search_string0", CONFIG_STRING, {0}, 0}; + + libvirt_cim_config_get(&prop); + return prop.value_string; +} + +const char *get_vsi_search_string1(void) +{ + static LibvirtcimConfigProperty prop = { + "vsi_search_string1", CONFIG_STRING, {0}, 0}; + + libvirt_cim_config_get(&prop); + return prop.value_string; +} + virConnectPtr connect_by_classname(const CMPIBroker *broker, const char *classname, CMPIStatus *s) diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h index 0f52290..06a37cc 100644 --- a/libxkutil/misc_util.h +++ b/libxkutil/misc_util.h @@ -154,7 +154,9 @@ int virt_set_status(const CMPIBroker *broker, /* get libvirt-cim config */ const char *get_mig_ssh_tmp_key(void); - +const char *get_lldptool_query_options(void); +const char *get_vsi_search_string0(void); +const char *get_vsi_search_string1(void); /* * Local Variables: * mode: C diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c index 8991426..103f125 100644 --- a/src/Virt_SwitchService.c +++ b/src/Virt_SwitchService.c @@ -46,13 +46,24 @@ static CMPIStatus check_vsi_support(char *command) CMPIStatus s = {CMPI_RC_OK, NULL}; char buff[MAX_LEN]; FILE *stream = NULL; - const char *searchStr[] = {" supported forwarding mode: " - "(0x40) reflective relay", - " supported capabilities: " - "(0x07) RTE ECP VDP", - NULL}; + const char *string0 = get_vsi_search_string0(); + const char *string1 = get_vsi_search_string1(); + const char *searchStr[3]; int matched = 0; + if (!string0) { + string0 = " supported forwarding mode: " + "(0x40) reflective relay"; + } + if (!string1) { + string1 = " supported capabilities: " + "(0x7) RTE ECP VDP"; + } + CU_DEBUG("vsi searching for string [%s] [%s]", string0, string1); + searchStr[0] = string0; + searchStr[1] = string1; + searchStr[2] = NULL; + // Run lldptool command to find vsi support. stream = popen(command, "r"); if (stream == NULL) { @@ -214,6 +225,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, int i; char **if_list; char cmd[MAX_LEN]; + const char *lldptool_query_options = NULL; *_inst = NULL; conn = connect_by_classname(broker, CLASSNAME(reference), &s); @@ -257,10 +269,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, CU_DEBUG("Found %d interfaces", count); + lldptool_query_options = get_lldptool_query_options(); + if (!lldptool_query_options) { + lldptool_query_options = "-t -g ncb -V evbcfg"; + } for (i=0; i References: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <5163F022.8070109@linux.vnet.ibm.com> Hi, John Sorry to interrupt but still need you to review this patch, which make it work more flex on different version. By the way, I got only 3 fail and they seems small problems in test suit's code, do you think it is ready to release 0.6.2(with this patch pushed)? > In RH6.4 lldptool query command and output changed a bit, > to make it work on different version, the string used in search and > options used in lldptool command should be set in configuration file. > > Signed-off-by: Wenchao Xia > --- > libvirt-cim.conf | 12 ++++++++++++ > libxkutil/misc_util.c | 27 +++++++++++++++++++++++++++ > libxkutil/misc_util.h | 4 +++- > src/Virt_SwitchService.c | 31 ++++++++++++++++++++++++------- > 4 files changed, 66 insertions(+), 8 deletions(-) > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > index 37d7b0f..40fc94a 100644 > --- a/libvirt-cim.conf > +++ b/libvirt-cim.conf > @@ -30,3 +30,15 @@ > # Default value: NULL, that is not set. > # > # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; > + > +# lldptool_query_options (string) > +# Defines the command used in SwitchService to query VEPA support, will be > +# used as "lldptool -i [INTERFACE] [OPTIONS]" > +# > +# lldptool_query_options = "-t -g ncb -V evbcfg"; > + > +# vsi_search_string (string) > +# Defines the string used in SwitchService to search in lldptool's output > +# > +# vsi_search_string0 = "supported forwarding mode: (0x40) reflective relay"; > +# vsi_search_string1 = "supported capabilities: (0x7) RTE ECP VDP"; > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > index 00eb4b1..1a9a1b4 100644 > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -236,6 +236,33 @@ const char *get_mig_ssh_tmp_key(void) > return prop.value_string; > } > > +const char *get_lldptool_query_options(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "lldptool_query_options", CONFIG_STRING, {0}, 0}; > + > + libvirt_cim_config_get(&prop); > + return prop.value_string; > +} > + > +const char *get_vsi_search_string0(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "vsi_search_string0", CONFIG_STRING, {0}, 0}; > + > + libvirt_cim_config_get(&prop); > + return prop.value_string; > +} > + > +const char *get_vsi_search_string1(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "vsi_search_string1", CONFIG_STRING, {0}, 0}; > + > + libvirt_cim_config_get(&prop); > + return prop.value_string; > +} > + > virConnectPtr connect_by_classname(const CMPIBroker *broker, > const char *classname, > CMPIStatus *s) > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > index 0f52290..06a37cc 100644 > --- a/libxkutil/misc_util.h > +++ b/libxkutil/misc_util.h > @@ -154,7 +154,9 @@ int virt_set_status(const CMPIBroker *broker, > > /* get libvirt-cim config */ > const char *get_mig_ssh_tmp_key(void); > - > +const char *get_lldptool_query_options(void); > +const char *get_vsi_search_string0(void); > +const char *get_vsi_search_string1(void); > /* > * Local Variables: > * mode: C > diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c > index 8991426..103f125 100644 > --- a/src/Virt_SwitchService.c > +++ b/src/Virt_SwitchService.c > @@ -46,13 +46,24 @@ static CMPIStatus check_vsi_support(char *command) > CMPIStatus s = {CMPI_RC_OK, NULL}; > char buff[MAX_LEN]; > FILE *stream = NULL; > - const char *searchStr[] = {" supported forwarding mode: " > - "(0x40) reflective relay", > - " supported capabilities: " > - "(0x07) RTE ECP VDP", > - NULL}; > + const char *string0 = get_vsi_search_string0(); > + const char *string1 = get_vsi_search_string1(); > + const char *searchStr[3]; > int matched = 0; > > + if (!string0) { > + string0 = " supported forwarding mode: " > + "(0x40) reflective relay"; > + } > + if (!string1) { > + string1 = " supported capabilities: " > + "(0x7) RTE ECP VDP"; > + } > + CU_DEBUG("vsi searching for string [%s] [%s]", string0, string1); > + searchStr[0] = string0; > + searchStr[1] = string1; > + searchStr[2] = NULL; > + > // Run lldptool command to find vsi support. > stream = popen(command, "r"); > if (stream == NULL) { > @@ -214,6 +225,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > int i; > char **if_list; > char cmd[MAX_LEN]; > + const char *lldptool_query_options = NULL; > > *_inst = NULL; > conn = connect_by_classname(broker, CLASSNAME(reference), &s); > @@ -257,10 +269,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > CU_DEBUG("Found %d interfaces", count); > > + lldptool_query_options = get_lldptool_query_options(); > + if (!lldptool_query_options) { > + lldptool_query_options = "-t -g ncb -V evbcfg"; > + } > > for (i=0; i - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); > - CU_DEBUG("running command %s ...", cmd); > + sprintf(cmd, "lldptool -i %s %s", > + if_list[i], lldptool_query_options); > + CU_DEBUG("running command [%s]", cmd); > s = check_vsi_support(cmd); > if (s.rc == CMPI_RC_OK) { > vsi = true; > -- Best Regards Wenchao Xia From veillard at redhat.com Tue Apr 9 10:54:17 2013 From: veillard at redhat.com (Daniel Veillard) Date: Tue, 9 Apr 2013 18:54:17 +0800 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: <5163F022.8070109@linux.vnet.ibm.com> References: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5163F022.8070109@linux.vnet.ibm.com> Message-ID: <20130409105417.GF22671@redhat.com> On Tue, Apr 09, 2013 at 06:40:34PM +0800, Wenchao Xia wrote: > Hi, John > Sorry to interrupt but still need you to review this patch, which > make it work more flex on different version. > By the way, I got only 3 fail and they seems small problems in test > suit's code, do you think it is ready to release 0.6.2(with this patch > pushed)? didn't we want to have the testsuite patches pushed too before the release ? Daniel > > In RH6.4 lldptool query command and output changed a bit, > > to make it work on different version, the string used in search and > > options used in lldptool command should be set in configuration file. > > > > Signed-off-by: Wenchao Xia > > --- > > libvirt-cim.conf | 12 ++++++++++++ > > libxkutil/misc_util.c | 27 +++++++++++++++++++++++++++ > > libxkutil/misc_util.h | 4 +++- > > src/Virt_SwitchService.c | 31 ++++++++++++++++++++++++------- > > 4 files changed, 66 insertions(+), 8 deletions(-) > > > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > > index 37d7b0f..40fc94a 100644 > > --- a/libvirt-cim.conf > > +++ b/libvirt-cim.conf > > @@ -30,3 +30,15 @@ > > # Default value: NULL, that is not set. > > # > > # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; > > + > > +# lldptool_query_options (string) > > +# Defines the command used in SwitchService to query VEPA support, will be > > +# used as "lldptool -i [INTERFACE] [OPTIONS]" > > +# > > +# lldptool_query_options = "-t -g ncb -V evbcfg"; > > + > > +# vsi_search_string (string) > > +# Defines the string used in SwitchService to search in lldptool's output > > +# > > +# vsi_search_string0 = "supported forwarding mode: (0x40) reflective relay"; > > +# vsi_search_string1 = "supported capabilities: (0x7) RTE ECP VDP"; > > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > > index 00eb4b1..1a9a1b4 100644 > > --- a/libxkutil/misc_util.c > > +++ b/libxkutil/misc_util.c > > @@ -236,6 +236,33 @@ const char *get_mig_ssh_tmp_key(void) > > return prop.value_string; > > } > > > > +const char *get_lldptool_query_options(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "lldptool_query_options", CONFIG_STRING, {0}, 0}; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > +const char *get_vsi_search_string0(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "vsi_search_string0", CONFIG_STRING, {0}, 0}; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > +const char *get_vsi_search_string1(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "vsi_search_string1", CONFIG_STRING, {0}, 0}; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > virConnectPtr connect_by_classname(const CMPIBroker *broker, > > const char *classname, > > CMPIStatus *s) > > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > > index 0f52290..06a37cc 100644 > > --- a/libxkutil/misc_util.h > > +++ b/libxkutil/misc_util.h > > @@ -154,7 +154,9 @@ int virt_set_status(const CMPIBroker *broker, > > > > /* get libvirt-cim config */ > > const char *get_mig_ssh_tmp_key(void); > > - > > +const char *get_lldptool_query_options(void); > > +const char *get_vsi_search_string0(void); > > +const char *get_vsi_search_string1(void); > > /* > > * Local Variables: > > * mode: C > > diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c > > index 8991426..103f125 100644 > > --- a/src/Virt_SwitchService.c > > +++ b/src/Virt_SwitchService.c > > @@ -46,13 +46,24 @@ static CMPIStatus check_vsi_support(char *command) > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > char buff[MAX_LEN]; > > FILE *stream = NULL; > > - const char *searchStr[] = {" supported forwarding mode: " > > - "(0x40) reflective relay", > > - " supported capabilities: " > > - "(0x07) RTE ECP VDP", > > - NULL}; > > + const char *string0 = get_vsi_search_string0(); > > + const char *string1 = get_vsi_search_string1(); > > + const char *searchStr[3]; > > int matched = 0; > > > > + if (!string0) { > > + string0 = " supported forwarding mode: " > > + "(0x40) reflective relay"; > > + } > > + if (!string1) { > > + string1 = " supported capabilities: " > > + "(0x7) RTE ECP VDP"; > > + } > > + CU_DEBUG("vsi searching for string [%s] [%s]", string0, string1); > > + searchStr[0] = string0; > > + searchStr[1] = string1; > > + searchStr[2] = NULL; > > + > > // Run lldptool command to find vsi support. > > stream = popen(command, "r"); > > if (stream == NULL) { > > @@ -214,6 +225,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > int i; > > char **if_list; > > char cmd[MAX_LEN]; > > + const char *lldptool_query_options = NULL; > > > > *_inst = NULL; > > conn = connect_by_classname(broker, CLASSNAME(reference), &s); > > @@ -257,10 +269,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > > > CU_DEBUG("Found %d interfaces", count); > > > > + lldptool_query_options = get_lldptool_query_options(); > > + if (!lldptool_query_options) { > > + lldptool_query_options = "-t -g ncb -V evbcfg"; > > + } > > > > for (i=0; i > - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); > > - CU_DEBUG("running command %s ...", cmd); > > + sprintf(cmd, "lldptool -i %s %s", > > + if_list[i], lldptool_query_options); > > + CU_DEBUG("running command [%s]", cmd); > > s = check_vsi_support(cmd); > > if (s.rc == CMPI_RC_OK) { > > vsi = true; > > > > > -- > Best Regards > > Wenchao Xia -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From jferlan at redhat.com Tue Apr 9 14:40:49 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 09 Apr 2013 10:40:49 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> Message-ID: <51642871.7080001@redhat.com> On 04/08/2013 06:16 AM, Wenchao Xia wrote: > This is a patch follows John's 9 patches for cimtest, after it > cimtest should only fail 3 case on RH6.4: > HostSystem - 01_enum.py: FAIL > HostSystem - 03_hs_to_settdefcap.py: FAIL > VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL > > This patch is only for review and test, it may need adjust and merge > with John's patch, and change to author name(not root :|), please > do not push directly. > > root (3): > test: common_util, use number to check version > test: rasd use int as comparation condtion for libvirt version > test: RPCS fix nfs issue > > .../12_create_netfs_storagevolume_errs.py | 2 +- > suites/libvirt-cim/lib/XenKvmLib/common_util.py | 32 ++++++++++++++++--- > suites/libvirt-cim/lib/XenKvmLib/pool.py | 8 ++-- > suites/libvirt-cim/lib/XenKvmLib/rasd.py | 7 ++-- > 4 files changed, 36 insertions(+), 13 deletions(-) > > While it seems the change resolves some issues I saw in my initial run, I think the official patch needs to describe the problem/symptom and resolution more clearly. In particular, is the change because cimtest was improperly handling the result of the "virsh -v"? Was this only a rhel64 issue? My Fedora system still gets only Indication failures - so there's no 'regressions' there. Unfortunately there are still a number of errors on my rhel64 which I'm looking into. They could be environmental, but I'd still like to get a handle on them. I get the following errors: ElementCapabilities - 02_reverse.py: FAIL ElementCapabilities - 04_reverse_errs.py: FAIL ElementCapabilities - 05_hostsystem_cap.py: FAIL ElementConforms - 01_forward.py: FAIL ElementConforms - 02_reverse.py: FAIL HostedService - 01_forward.py: FAIL HostedService - 02_reverse.py: FAIL HostedService - 04_reverse_errs.py: FAIL HostSystem - 03_hs_to_settdefcap.py: FAIL Profile - 01_enum.py: FAIL Profile - 02_profile_to_elec.py: FAIL Profile - 03_rprofile_gi_errs.py: FAIL RedirectionService - 01_enum_crs.py: FAIL ReferencedProfile - 01_verify_refprof.py: FAIL ReferencedProfile - 02_refprofile_errs.py: FAIL SettingsDefineCapabilities - 04_forward_vsmsdata.py: FAIL SettingsDefineCapabilities - 05_reverse_vsmcap.py: FAIL VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL VirtualSystemMigrationCapabilities - 01_enum.py: FAIL John From jferlan at redhat.com Tue Apr 9 15:45:26 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 09 Apr 2013 11:45:26 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <51642871.7080001@redhat.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> Message-ID: <51643796.7080507@redhat.com> On 04/09/2013 10:40 AM, John Ferlan wrote: > On 04/08/2013 06:16 AM, Wenchao Xia wrote: >> This is a patch follows John's 9 patches for cimtest, after it >> cimtest should only fail 3 case on RH6.4: >> HostSystem - 01_enum.py: FAIL >> HostSystem - 03_hs_to_settdefcap.py: FAIL >> VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL >> >> This patch is only for review and test, it may need adjust and merge >> with John's patch, and change to author name(not root :|), please >> do not push directly. >> >> root (3): >> test: common_util, use number to check version >> test: rasd use int as comparation condtion for libvirt version >> test: RPCS fix nfs issue >> >> .../12_create_netfs_storagevolume_errs.py | 2 +- >> suites/libvirt-cim/lib/XenKvmLib/common_util.py | 32 ++++++++++++++++--- >> suites/libvirt-cim/lib/XenKvmLib/pool.py | 8 ++-- >> suites/libvirt-cim/lib/XenKvmLib/rasd.py | 7 ++-- >> 4 files changed, 36 insertions(+), 13 deletions(-) >> >> > > While it seems the change resolves some issues I saw in my initial run, > I think the official patch needs to describe the problem/symptom and > resolution more clearly. In particular, is the change because cimtest > was improperly handling the result of the "virsh -v"? Was this only a > rhel64 issue? > Uh, duh. Should have held off hitting send for just a few minutes. My version on rhel64 is "0.10.2" while on my f18 system it was "1.0.3", so naturally when comparing against "0.4.1" I can "see" why the change was necessary. I can also understand why this is a "new" regression since probably the last time tests were run the virsh version was "0.9.*" or "0.8.*"... While I agree what you did resolves some issues - I think the change is incomplete. You've only changed a few places and my cscope tells me there are 15 callers to virsh_version(). Let's see what I can come up with... John From jferlan at redhat.com Tue Apr 9 16:06:11 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 09 Apr 2013 12:06:11 -0400 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: <5163F022.8070109@linux.vnet.ibm.com> References: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5163F022.8070109@linux.vnet.ibm.com> Message-ID: <51643C73.7080607@redhat.com> On 04/09/2013 06:40 AM, Wenchao Xia wrote: > Hi, John > Sorry to interrupt but still need you to review this patch, which > make it work more flex on different version. > By the way, I got only 3 fail and they seems small problems in test > suit's code, do you think it is ready to release 0.6.2(with this patch > pushed)? > I don't have 'lldptool' installed on my system, so I cannot verify the output or the fix. What concerns me though is the reliance on something that could (and does) change between versions. What you have is just "two" versions of differences. What if there's a 3rd version that had/has something different? Is the output different on different archs/OS's? Is there no way to make the vsi_search_string be an array in the configuration file? Rather than two constant strings. I suppose what you have works, but it seems there has to be a better way to do this. I also think the comments in the .conf file could be beefed up so someone would know what to look for. Is that a specific field in the output or is that string what is returned. Essentially how would someone know what to look for in order to add a new/different string. Call this a "luke-warm" ACK. It works, but I think it's a shortcut. John >> In RH6.4 lldptool query command and output changed a bit, >> to make it work on different version, the string used in search and >> options used in lldptool command should be set in configuration file. >> >> Signed-off-by: Wenchao Xia >> --- >> libvirt-cim.conf | 12 ++++++++++++ >> libxkutil/misc_util.c | 27 +++++++++++++++++++++++++++ >> libxkutil/misc_util.h | 4 +++- >> src/Virt_SwitchService.c | 31 ++++++++++++++++++++++++------- >> 4 files changed, 66 insertions(+), 8 deletions(-) >> >> diff --git a/libvirt-cim.conf b/libvirt-cim.conf >> index 37d7b0f..40fc94a 100644 >> --- a/libvirt-cim.conf >> +++ b/libvirt-cim.conf >> @@ -30,3 +30,15 @@ >> # Default value: NULL, that is not set. >> # >> # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; >> + >> +# lldptool_query_options (string) >> +# Defines the command used in SwitchService to query VEPA support, will be >> +# used as "lldptool -i [INTERFACE] [OPTIONS]" >> +# >> +# lldptool_query_options = "-t -g ncb -V evbcfg"; >> + >> +# vsi_search_string (string) >> +# Defines the string used in SwitchService to search in lldptool's output >> +# >> +# vsi_search_string0 = "supported forwarding mode: (0x40) reflective relay"; >> +# vsi_search_string1 = "supported capabilities: (0x7) RTE ECP VDP"; >> diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c >> index 00eb4b1..1a9a1b4 100644 >> --- a/libxkutil/misc_util.c >> +++ b/libxkutil/misc_util.c >> @@ -236,6 +236,33 @@ const char *get_mig_ssh_tmp_key(void) >> return prop.value_string; >> } >> >> +const char *get_lldptool_query_options(void) >> +{ >> + static LibvirtcimConfigProperty prop = { >> + "lldptool_query_options", CONFIG_STRING, {0}, 0}; >> + >> + libvirt_cim_config_get(&prop); >> + return prop.value_string; >> +} >> + >> +const char *get_vsi_search_string0(void) >> +{ >> + static LibvirtcimConfigProperty prop = { >> + "vsi_search_string0", CONFIG_STRING, {0}, 0}; >> + >> + libvirt_cim_config_get(&prop); >> + return prop.value_string; >> +} >> + >> +const char *get_vsi_search_string1(void) >> +{ >> + static LibvirtcimConfigProperty prop = { >> + "vsi_search_string1", CONFIG_STRING, {0}, 0}; >> + >> + libvirt_cim_config_get(&prop); >> + return prop.value_string; >> +} >> + >> virConnectPtr connect_by_classname(const CMPIBroker *broker, >> const char *classname, >> CMPIStatus *s) >> diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h >> index 0f52290..06a37cc 100644 >> --- a/libxkutil/misc_util.h >> +++ b/libxkutil/misc_util.h >> @@ -154,7 +154,9 @@ int virt_set_status(const CMPIBroker *broker, >> >> /* get libvirt-cim config */ >> const char *get_mig_ssh_tmp_key(void); >> - >> +const char *get_lldptool_query_options(void); >> +const char *get_vsi_search_string0(void); >> +const char *get_vsi_search_string1(void); >> /* >> * Local Variables: >> * mode: C >> diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c >> index 8991426..103f125 100644 >> --- a/src/Virt_SwitchService.c >> +++ b/src/Virt_SwitchService.c >> @@ -46,13 +46,24 @@ static CMPIStatus check_vsi_support(char *command) >> CMPIStatus s = {CMPI_RC_OK, NULL}; >> char buff[MAX_LEN]; >> FILE *stream = NULL; >> - const char *searchStr[] = {" supported forwarding mode: " >> - "(0x40) reflective relay", >> - " supported capabilities: " >> - "(0x07) RTE ECP VDP", >> - NULL}; >> + const char *string0 = get_vsi_search_string0(); >> + const char *string1 = get_vsi_search_string1(); >> + const char *searchStr[3]; >> int matched = 0; >> >> + if (!string0) { >> + string0 = " supported forwarding mode: " >> + "(0x40) reflective relay"; >> + } >> + if (!string1) { >> + string1 = " supported capabilities: " >> + "(0x7) RTE ECP VDP"; >> + } >> + CU_DEBUG("vsi searching for string [%s] [%s]", string0, string1); >> + searchStr[0] = string0; >> + searchStr[1] = string1; >> + searchStr[2] = NULL; >> + >> // Run lldptool command to find vsi support. >> stream = popen(command, "r"); >> if (stream == NULL) { >> @@ -214,6 +225,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, >> int i; >> char **if_list; >> char cmd[MAX_LEN]; >> + const char *lldptool_query_options = NULL; >> >> *_inst = NULL; >> conn = connect_by_classname(broker, CLASSNAME(reference), &s); >> @@ -257,10 +269,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, >> >> CU_DEBUG("Found %d interfaces", count); >> >> + lldptool_query_options = get_lldptool_query_options(); >> + if (!lldptool_query_options) { >> + lldptool_query_options = "-t -g ncb -V evbcfg"; >> + } >> >> for (i=0; i> - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); >> - CU_DEBUG("running command %s ...", cmd); >> + sprintf(cmd, "lldptool -i %s %s", >> + if_list[i], lldptool_query_options); >> + CU_DEBUG("running command [%s]", cmd); >> s = check_vsi_support(cmd); >> if (s.rc == CMPI_RC_OK) { >> vsi = true; >> > > From jferlan at redhat.com Tue Apr 9 18:33:49 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 9 Apr 2013 14:33:49 -0400 Subject: [Libvirt-cim] [PATCH 0/2] Add version comparison method for virsh_version output Message-ID: <1365532431-1009-1-git-send-email-jferlan@redhat.com> I believe this set of patches should be applied instead of those from https://www.redhat.com/archives/libvirt-cim/2013-April/msg00006.html I suppose we could consider combining the two functions; however, there are a couple place where the return version string is compared more than once, so I kept both interfaces. The vxml change is just an informative message that showed me the name of the image that was failing - I had created 'default-kvm-dimage.img' and tests were failing to find 'default-kvm-dimage' to place into the cimtest storage pool. John Ferlan (2): vxml: Add which volume could not be found to error message Add and utilize virsh_version_cmp .../08_CreateDiskResourcePool.py | 4 ++-- .../10_create_storagevolume.py | 6 ++++-- .../11_create_dir_storagevolume_errs.py | 5 +++-- .../12_create_netfs_storagevolume_errs.py | 5 +++-- .../13_delete_storagevolume.py | 5 +++-- .../14_delete_storagevolume_errs.py | 5 +++-- .../ResourcePoolConfigurationService/15_DiskPoolAutostart.py | 4 ++-- .../cimtest/SettingsDefineCapabilities/01_forward.py | 1 - .../VirtualSystemManagementService/19_definenetwork_ers.py | 8 ++++---- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 9 +++++---- suites/libvirt-cim/lib/XenKvmLib/pool.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 10 ++++++---- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 ++-- suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py | 6 ++++++ 14 files changed, 46 insertions(+), 32 deletions(-) -- 1.8.1.4 From jferlan at redhat.com Tue Apr 9 18:33:50 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 9 Apr 2013 14:33:50 -0400 Subject: [Libvirt-cim] [PATCH 1/2] vxml: Add which volume could not be found to error message In-Reply-To: <1365532431-1009-1-git-send-email-jferlan@redhat.com> References: <1365532431-1009-1-git-send-email-jferlan@redhat.com> Message-ID: <1365532431-1009-2-git-send-email-jferlan@redhat.com> --- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index 51a4166..82ab501 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -921,7 +921,7 @@ class KVMXML(VirtXML, VirtCIM): port_num='-1', keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): - logger.error('Error: Disk image does not exist') + logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'KVM', test_dom, uuid, pae, acpi, apic, disk, @@ -984,7 +984,7 @@ class XenFVXML(VirtXML, VirtCIM): keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): - logger.error('Error: Disk image does not exist') + logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'XenFV', test_dom, uuid, pae, acpi, apic, disk, -- 1.8.1.4 From jferlan at redhat.com Tue Apr 9 18:33:51 2013 From: jferlan at redhat.com (John Ferlan) Date: Tue, 9 Apr 2013 14:33:51 -0400 Subject: [Libvirt-cim] [PATCH 2/2] Add and utilize virsh_version_cmp In-Reply-To: <1365532431-1009-1-git-send-email-jferlan@redhat.com> References: <1365532431-1009-1-git-send-email-jferlan@redhat.com> Message-ID: <1365532431-1009-3-git-send-email-jferlan@redhat.com> The string version comparisons failed when determining if "0.10.2" was a greater version than "0.4.1" (and other similar checks). Needed to create a version comparison method that did the right thing. Also, not change to 12_create_netfs_storagevolume_errs.py to use "or" logic rather than "and" logic on comparison. Other tests within the family use "or" logic. --- .../08_CreateDiskResourcePool.py | 4 ++-- .../10_create_storagevolume.py | 6 ++++-- .../11_create_dir_storagevolume_errs.py | 5 +++-- .../12_create_netfs_storagevolume_errs.py | 5 +++-- .../13_delete_storagevolume.py | 5 +++-- .../14_delete_storagevolume_errs.py | 5 +++-- .../ResourcePoolConfigurationService/15_DiskPoolAutostart.py | 4 ++-- .../cimtest/SettingsDefineCapabilities/01_forward.py | 1 - .../VirtualSystemManagementService/19_definenetwork_ers.py | 8 ++++---- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 9 +++++---- suites/libvirt-cim/lib/XenKvmLib/pool.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 10 ++++++---- suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py | 6 ++++++ 13 files changed, 44 insertions(+), 30 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py index 636f59c..b5ec5dc 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py @@ -50,7 +50,7 @@ import sys import os from CimTest.Globals import logger -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class @@ -89,7 +89,7 @@ def main(): dp_types = { } libvirt_version = virsh_version(server, virt) - if libvirt_version < "0.4.1": + if virsh_version_cmp(libvirt_version, "0.4.1") < 0: logger.info("Storage pool creation support is available in Libvirt " "version >= 0.4.1 , hence skipping the test....") return SKIP diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py index 511463b..3b0673f 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py @@ -38,7 +38,8 @@ from XenKvmLib.rasd import libvirt_rasd_storagepool_changes from XenKvmLib import rpcs_service from XenKvmLib.assoc import Associators from XenKvmLib.enumclass import GetInstance, EnumNames -from XenKvmLib.xm_virt_util import virsh_version, vol_list, vol_delete +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp, \ + vol_list, vol_delete from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.common_util import destroy_diskpool from XenKvmLib.pool import create_pool, undefine_diskpool, DIR_POOL @@ -186,7 +187,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py index 76e1e8f..318cfa8 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py @@ -36,7 +36,7 @@ from CimTest.Globals import logger from XenKvmLib import rpcs_service from pywbem.cim_types import Uint64 from pywbem import CIM_ERR_FAILED, CIMError -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import libvirt_rasd_storagepool_changes @@ -125,7 +125,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py index 004af9f..215727f 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py @@ -36,7 +36,7 @@ from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup, get_provider_version from XenKvmLib.rasd import libvirt_rasd_storagepool_changes from XenKvmLib import rpcs_service -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.common_util import nfs_netfs_setup, netfs_cleanup from XenKvmLib.pool import create_pool, NETFS_POOL, get_diskpool, \ @@ -123,7 +123,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" and cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py index d7a6365..3578532 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py @@ -29,7 +29,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.const import do_main, platform_sup, get_provider_version, \ default_pool_name, _image_dir from XenKvmLib import rpcs_service @@ -50,7 +50,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_spool_del_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_spool_del_changes: logger.info("Storage Volume deletion support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_spool_del_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py index 9e33215..d7ed5ad 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py @@ -33,7 +33,7 @@ from VirtLib import utils from CimTest.Globals import logger from pywbem import CIM_ERR_FAILED, CIM_ERR_INVALID_PARAMETER, CIMError from CimTest.ReturnCodes import FAIL, PASS, SKIP -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.const import do_main, platform_sup, get_provider_version,\ default_pool_name, _image_dir from XenKvmLib import rpcs_service @@ -119,7 +119,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_spool_del_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_spool_del_changes: logger.info("Storage Volume deletion support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_spool_del_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py index b7e72a8..3cf6321 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py @@ -26,7 +26,7 @@ import sys import os from pywbem import cim_types from CimTest.Globals import logger -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class @@ -62,7 +62,7 @@ def main(): dp_types = { } libvirt_version = virsh_version(server, virt) - if libvirt_version < "0.4.1": + if virsh_version_cmp(libvirt_version, "0.4.1") < 0: logger.info("Storage pool creation support is available in Libvirt " "version >= 0.4.1 , hence skipping the test....") return SKIP diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py index 555e3c1..dd19ca0 100644 --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py @@ -57,7 +57,6 @@ import os from distutils.file_util import move_file from XenKvmLib import assoc from XenKvmLib import enumclass -from XenKvmLib.xm_virt_util import virsh_version from CimTest.ReturnCodes import PASS, FAIL, SKIP from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, \ CIM_ERROR_ASSOCIATORS diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index cf461d1..19294db 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -33,7 +33,7 @@ from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS from XenKvmLib.const import default_network_name, do_main, get_provider_version from XenKvmLib.common_util import create_netpool_conf, destroy_netpool -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' @@ -71,7 +71,7 @@ def main(): libvirt_version = virsh_version(options.ip, options.virt) inv_empty_network = "Network not found" if options.virt == "Xen" or options.virt == "XenFV": - if libvirt_version <= "0.3.3": + if virsh_version_cmp(libvirt_version, "0.3.3") <= 0: inv_empty_network = "no network with matching name" inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ @@ -89,10 +89,10 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: - if libvirt_version >= "0.7.0": + if virsh_version_cmp(libvirt_version, "0.7.0") >= 0: expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network - if libvirt_version >= "0.9.8": + if virsh_version_cmp(libvirt_version, "0.9.8") >= 0: expected_values['invalid']['bridge'] = "Cannot get interface "\ "MTU on 'invalid'" else: diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index 43e5e2c..53fb14f 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -38,7 +38,8 @@ from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, \ CIM_ERROR_GETINSTANCE from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC, SKIP -from XenKvmLib.xm_virt_util import diskpool_list, virsh_version, net_list,\ +from XenKvmLib.xm_virt_util import diskpool_list, virsh_version,\ + virsh_version_cmp, net_list,\ domain_list, virt2uri, net_destroy from XenKvmLib.vxml import PoolXML, NetXML from VirtLib import utils @@ -308,7 +309,7 @@ def cleanup_restore(server, virt): # libvirt_version >= 0.4.1 # Hence Skipping the logic to delete the new conf file # and just returning PASS - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: return status try: if os.path.exists(back_disk_file): @@ -365,7 +366,7 @@ def create_diskpool(server, virt='KVM', dpool=default_pool_name, def create_diskpool_conf(server, virt, dpool=default_pool_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: status, dpoolname = create_diskpool(server, virt, dpool) diskid = "%s/%s" % ("DiskPool", dpoolname) else: @@ -376,7 +377,7 @@ def create_diskpool_conf(server, virt, dpool=default_pool_name): def destroy_diskpool(server, virt, dpool): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: if dpool == None: logger.error("No disk pool specified") return FAIL diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py index a5ca331..1a57aba 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py @@ -35,7 +35,7 @@ from XenKvmLib import rpcs_service import pywbem from CimTest.CimExt import CIMClassMOF from XenKvmLib.vxml import NetXML, PoolXML -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.vsms import RASD_TYPE_STOREVOL from XenKvmLib.common_util import destroy_diskpool @@ -183,7 +183,7 @@ def undefine_netpool(server, virt, net_name): def undefine_diskpool(server, virt, dp_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: if dp_name == None: return FAIL @@ -285,7 +285,7 @@ def verify_pool(server, virt, poolname, pool_attr_list, mode_type=0, ret_mode = net_xml.xml_get_netpool_mode() libvirt_version = virsh_version(server, virt) #Forward mode support was added in 0.4.2 - if libvirt_version >= '0.4.2': + if virsh_version_cmp(libvirt_version, '0.4.2') >= 0: if mode_type == 1 and ret_mode != "nat": logger.error("Error when verifying 'nat' type network") return FAIL diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index d65011e..4d4240a 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -31,7 +31,7 @@ from XenKvmLib.assoc import Associators from XenKvmLib.const import default_pool_name, default_network_name, \ get_provider_version, default_net_type from XenKvmLib.pool import enum_volumes -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.common_util import parse_instance_id pasd_cn = 'ProcResourceAllocationSettingData' @@ -81,7 +81,8 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): libvirt_version = virsh_version(server, virt) - if virt == 'LXC' or (virt == 'XenFV' and libvirt_version < "0.6.3"): + if virt == 'LXC' or (virt == 'XenFV' and \ + virsh_version_cmp(libvirt_version, "0.6.3") < 0): point_device = "%s/%s" %(t_dom, "mouse:usb") elif virt == 'Xen': point_device = "%s/%s" %(t_dom, "mouse:xen") @@ -357,7 +358,8 @@ def get_exp_disk_rasd_len(virt, ip, rev, id): rev < libvirt_rasd_new_changes: exp_len = exp_base_num + exp_cdrom - elif rev >= libvirt_rasd_dpool_changes and libvirt_ver >= '0.4.1': + elif rev >= libvirt_rasd_dpool_changes and \ + virsh_version_cmp(libvirt_ver, '0.4.1') >= 0: volumes = enum_volumes(virt, ip) if rev >= libvirt_rasd_floppy_changes: exp_len = ((volumes * exp_base_num) + \ @@ -383,7 +385,7 @@ def get_exp_disk_rasd_len(virt, ip, rev, id): exp_len = (volumes * exp_base_num) + exp_cdrom - if virt != 'LXC' and libvirt_ver >= '0.4.1': + if virt != 'LXC' and virsh_version_cmp(libvirt_ver, '0.4.1') >= 0: if rev >= libvirt_rasd_storagepool_changes: exp_len += exp_storagevol_rasd diff --git a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py index f365a54..7749fb7 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # import os +import re from VirtLib import utils import socket from VirtLib.live import fv_cap @@ -223,6 +224,11 @@ def network_by_bridge(bridge, server, virt="Xen"): return None +def virsh_version_cmp(version1, version2): + def normalize(v): + return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")] + return cmp(normalize(version1), normalize(version2)) + def virsh_version(server, virt="KVM"): cmd = "virsh -c %s -v 2>/dev/null" % virt2uri(virt) ret, out = utils.run_remote(server, cmd) -- 1.8.1.4 From xiawenc at linux.vnet.ibm.com Wed Apr 10 04:55:41 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Wed, 10 Apr 2013 12:55:41 +0800 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: <20130409105417.GF22671@redhat.com> References: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5163F022.8070109@linux.vnet.ibm.com> <20130409105417.GF22671@redhat.com> Message-ID: <5164F0CD.6060803@linux.vnet.ibm.com> ? 2013-4-9 18:54, Daniel Veillard ??: > On Tue, Apr 09, 2013 at 06:40:34PM +0800, Wenchao Xia wrote: >> Hi, John >> Sorry to interrupt but still need you to review this patch, which >> make it work more flex on different version. >> By the way, I got only 3 fail and they seems small problems in test >> suit's code, do you think it is ready to release 0.6.2(with this patch >> pushed)? > > didn't we want to have the testsuite patches pushed too before the > release ? > > Daniel > I think Cimtest still have some problems and patches need more review, but works now, maybe we can release libvirt-cim first getting it ready for yum repositroy first We can improve it later, there will be a new guys working for it. From xiawenc at linux.vnet.ibm.com Wed Apr 10 08:26:33 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Wed, 10 Apr 2013 16:26:33 +0800 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <51643796.7080507@redhat.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> Message-ID: <51652239.6080105@linux.vnet.ibm.com> ? 2013-4-9 23:45, John Ferlan ??: > On 04/09/2013 10:40 AM, John Ferlan wrote: >> On 04/08/2013 06:16 AM, Wenchao Xia wrote: >>> This is a patch follows John's 9 patches for cimtest, after it >>> cimtest should only fail 3 case on RH6.4: >>> HostSystem - 01_enum.py: FAIL >>> HostSystem - 03_hs_to_settdefcap.py: FAIL >>> VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL >>> >>> This patch is only for review and test, it may need adjust and merge >>> with John's patch, and change to author name(not root :|), please >>> do not push directly. >>> >>> root (3): >>> test: common_util, use number to check version >>> test: rasd use int as comparation condtion for libvirt version >>> test: RPCS fix nfs issue >>> >>> .../12_create_netfs_storagevolume_errs.py | 2 +- >>> suites/libvirt-cim/lib/XenKvmLib/common_util.py | 32 ++++++++++++++++--- >>> suites/libvirt-cim/lib/XenKvmLib/pool.py | 8 ++-- >>> suites/libvirt-cim/lib/XenKvmLib/rasd.py | 7 ++-- >>> 4 files changed, 36 insertions(+), 13 deletions(-) >>> >>> >> >> While it seems the change resolves some issues I saw in my initial run, >> I think the official patch needs to describe the problem/symptom and >> resolution more clearly. In particular, is the change because cimtest >> was improperly handling the result of the "virsh -v"? Was this only a >> rhel64 issue? >> > > Uh, duh. Should have held off hitting send for just a few minutes. > > My version on rhel64 is "0.10.2" while on my f18 system it was "1.0.3", > so naturally when comparing against "0.4.1" I can "see" why the change > was necessary. I can also understand why this is a "new" regression > since probably the last time tests were run the virsh version was > "0.9.*" or "0.8.*"... > > While I agree what you did resolves some issues - I think the change is > incomplete. You've only changed a few places and my cscope tells me > there are 15 callers to virsh_version(). > > Let's see what I can come up with... > > John > Yes, this fix all bugs show on my machine, maybe there are other caller, but want to sent this first to make it work. I like your patches which compare two version string from libvirt. :> I got only 3 case fail now, may be you can paste some detail of your fail here. Something I know to make it work: 1 host must be able to resolve itself's name, that is ping [MACINENAME] must succeed. 2 two fake image must be created in /var/lib/libvirt/images 3 default disk-pool default must be "virsh pool-undefine". > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia From xiawenc at linux.vnet.ibm.com Wed Apr 10 08:29:50 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Wed, 10 Apr 2013 16:29:50 +0800 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: <51643C73.7080607@redhat.com> References: <1365503475-29796-1-git-send-email-xiawenc@linux.vnet.ibm.com> <5163F022.8070109@linux.vnet.ibm.com> <51643C73.7080607@redhat.com> Message-ID: <516522FE.1020402@linux.vnet.ibm.com> ? 2013-4-10 0:06, John Ferlan ??: > On 04/09/2013 06:40 AM, Wenchao Xia wrote: >> Hi, John >> Sorry to interrupt but still need you to review this patch, which >> make it work more flex on different version. >> By the way, I got only 3 fail and they seems small problems in test >> suit's code, do you think it is ready to release 0.6.2(with this patch >> pushed)? >> > > I don't have 'lldptool' installed on my system, so I cannot verify the > output or the fix. > > What concerns me though is the reliance on something that could (and > does) change between versions. What you have is just "two" versions of > differences. What if there's a 3rd version that had/has something > different? Is the output different on different archs/OS's? I think it is changed by lldptool itself, instead of OS, my commit message is wrong. So to make it work better, it need to be configurababl according to lldptool's behavior. > > Is there no way to make the vsi_search_string be an array in the > configuration file? Rather than two constant strings. > > I suppose what you have works, but it seems there has to be a better way > to do this. I also think the comments in the .conf file could be beefed > up so someone would know what to look for. Is that a specific field in > the output or is that string what is returned. Essentially how would > someone know what to look for in order to add a new/different string. > Yep, I agree configuration file should tip more. > Call this a "luke-warm" ACK. It works, but I think it's a shortcut. > > John > > > >> >> > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia From xiawenc at linux.vnet.ibm.com Wed Apr 10 08:32:05 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Wed, 10 Apr 2013 16:32:05 +0800 Subject: [Libvirt-cim] [libvirt] [PATCH 1/2] vxml: Add which volume could not be found to error message In-Reply-To: <1365532431-1009-2-git-send-email-jferlan@redhat.com> References: <1365532431-1009-1-git-send-email-jferlan@redhat.com> <1365532431-1009-2-git-send-email-jferlan@redhat.com> Message-ID: <51652385.1010907@linux.vnet.ibm.com> Reviewed-by: Wenchao Xia > --- > suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > index 51a4166..82ab501 100644 > --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py > @@ -921,7 +921,7 @@ class KVMXML(VirtXML, VirtCIM): > port_num='-1', keymap="en-us", irstype="mouse", > btype="ps2", vnc_passwd=None): > if not os.path.exists(disk_file_path): > - logger.error('Error: Disk image does not exist') > + logger.error('Error: Disk image %s does not exist', disk_file_path) > sys.exit(1) > VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus) > VirtCIM.__init__(self, 'KVM', test_dom, uuid, pae, acpi, apic, disk, > @@ -984,7 +984,7 @@ class XenFVXML(VirtXML, VirtCIM): > keymap="en-us", > irstype="mouse", btype="ps2", vnc_passwd=None): > if not os.path.exists(disk_file_path): > - logger.error('Error: Disk image does not exist') > + logger.error('Error: Disk image %s does not exist', disk_file_path) > sys.exit(1) > VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus) > VirtCIM.__init__(self, 'XenFV', test_dom, uuid, pae, acpi, apic, disk, > -- Best Regards Wenchao Xia From cngesaint at outlook.com Wed Apr 10 10:20:34 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 10 Apr 2013 10:20:34 +0000 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable Message-ID: I think the "vsi_search_string be an array" problem could be solved as following steps: 1. An item such as (vsi_support_key_string="{supported forwarding mode: (0x40) reflective relay, supported capabilities: (0x7) RTE ECP VDP}";) is configured well in the .conf file. 2. The application read this value from .conf file as a long string. 3. The application executes supporting function about VSI and check whether the output returned is a substring of vsi_support_key_string. If the output contains in the vsi_support_key_string, supporting of VSI is proved. Sincerely yours, Xu Wang >On 04/09/2013 06:40 AM, Wenchao Xia wrote: >> Hi, John >> Sorry to interrupt but still need you to review this patch, which >>make it work more flex on different version. >> By the way, I got only 3 fail and they seems small problems in test >> suit's code, do you think it is ready to release 0.6.2(with this patch >> pushed)? >> I don't have 'lldptool' installed on my system, so I cannot verify the output or the fix. > >What concerns me though is the reliance on something that could (and does) change between versions. >What you have is just "two" versions of differences. What if there's a 3rd version that had/has >something different? Is the output different on different archs/OS's? > >Is there no way to make the vsi_search_string be an array in the configuration file? Rather than two >constant strings. > >I suppose what you have works, but it seems there has to be a better way to do this. I also think the >comments in the .conf file could be beefed up so someone would know what to look for. Is that a >specific field in the output or is that string what is returned. Essentially how would someone know >what to look for in order to add a new/different string. > >Call this a "luke-warm" ACK. It works, but I think it's a shortcut. > >John > > > >>> In RH6.4 lldptool query command and output changed a bit, ...... -------------- next part -------------- An HTML attachment was scrubbed... URL: From jferlan at redhat.com Wed Apr 10 18:47:31 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 10 Apr 2013 14:47:31 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <51652239.6080105@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> Message-ID: <5165B3C3.8060204@redhat.com> On 04/10/2013 04:26 AM, Wenchao Xia wrote: > ? 2013-4-9 23:45, John Ferlan ??: >> On 04/09/2013 10:40 AM, John Ferlan wrote: >>> On 04/08/2013 06:16 AM, Wenchao Xia wrote: > > Yes, this fix all bugs show on my machine, maybe there are other > caller, but want to sent this first to make it work. I like > your patches which compare two version string from libvirt. :> > > I got only 3 case fail now, may be you can paste some detail > of your fail here. > > Something I know to make it work: > 1 host must be able to resolve itself's name, that is ping [MACINENAME] > must succeed. > 2 two fake image must be created in /var/lib/libvirt/images > 3 default disk-pool default must be "virsh pool-undefine". I'm *painfully* aware of #2 & #3!!! The "default" libvirt location is also /var/lib/libvirt/images and cimtest kept failing strangely until I remembered that two storage pools cannot use the same path to storage. The cimtest results were not very "helpful" at discerning that though with just the following: ElementAllocatedFromPool - 01_forward.py: FAIL ERROR - Expected at least one KVM_DiskPool instance ERROR - Exception details : Failed to get pool details CIM_ERR_NOT_FOUND: No such instance (cimtest-diskpool) I knew cimtest-diskpool wasn't being created, but I had no idea why. I have it on a list of things to do to generate better errors or use a different location (either configurable or chosen). As for the other errors - I'm running libvirt-cim in the rhel6.4 environment with libvirt 0.10.2 installed. I have no predefined domains which differs from my f18 environment. I'm thinking there's some amount of environment differences which I don't yet have the "history" to recognize right away. I presently have 22 failures - * 11 are because neither the Migration Service nor the Capabilities MOF is present. Whether that's not installed by design, I haven't yet figured out. ElementCapabilities - 02_reverse.py: FAIL ElementCapabilities - 04_reverse_errs.py: FAIL ElementCapabilities - 05_hostsystem_cap.py: FAIL ElementConforms - 01_forward.py: FAIL HostedService - 01_forward.py: FAIL HostedService - 02_reverse.py: FAIL HostedService - 04_reverse_errs.py: FAIL SettingsDefineCapabilities - 04_forward_vsmsdata.py: FAIL SettingsDefineCapabilities - 05_reverse_vsmcap.py: FAIL VirtualSystemMigrationCapabilities - 01_enum.py: FAIL VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: FAIL * 2 are because of the bad comparison in RPCS for RHEL versions, although I used a slightly different mechanism than you did: - (elems[0] == 'Red' and int(elems[i+1]) >= 7): + (elems[0] == 'Red' and float(elems[i+1]) >= 7.0): * 9 I still need to research some more: -------------------------------------------------------------------- ElementConforms - 02_reverse.py: FAIL ERROR - Failed to get associators information for KVM_ElementConformsToProfile ERROR - Exception: u'KVM_ComputerSystem' -------------------------------------------------------------------- ElementConforms - 03_ectp_fwd_errs.py: XFAIL ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyname' passed. ERROR - ------ FAILED: INVALID_InstID_Keyname------ ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyvalue' passed. ERROR - ------ FAILED: INVALID_InstID_Keyvalue------ ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyname' passed. ERROR - ------ FAILED: INVALID_InstID_Keyname------ ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyvalue' passed. ERROR - ------ FAILED: INVALID_InstID_Keyvalue------ -------------------------------------------------------------------- HostSystem - 03_hs_to_settdefcap.py: FAIL ERROR - Failed to get associatornames according to KVM_AllocationCapabilities ERROR - Exception: list index out of range -------------------------------------------------------------------- Profile - 01_enum.py: FAIL ERROR - Profile CIM:DSP1042-SystemVirtualization-1.0.0 is not found ERROR - Properties check for KVM_RegisteredProfile failed -------------------------------------------------------------------- Profile - 02_profile_to_elec.py: FAIL ERROR - KVM_RegisteredProfile with Virtual System Profile was not returned -------------------------------------------------------------------- Profile - 03_rprofile_gi_errs.py: FAIL ERROR - Unexpected errno 6, desc CIM_ERR_NOT_FOUND: KVM_RegisteredProfile.InstanceID="INVALID_Instid_KeyValue" ERROR - Expected No such instance 6 ERROR - NameError : global name 'tc' is not defined Traceback (most recent call last): File "/home/cimtest.work/suites/libvirt-cim/lib/XenKvmLib/const.py", line 141, in do_try rc = f() File "03_rprofile_gi_errs.py", line 85, in main logger.error("------ FAILED: %s %s ------", cn, tc) NameError: global name 'tc' is not defined ERROR - None -------------------------------------------------------------------- RedirectionService - 01_enum_crs.py: FAIL 01_enum_crs.py:29: DeprecationWarning: the sets module is deprecated from sets import Set ERROR - TypeError : __call__() takes exactly 1 argument (2 given) Traceback (most recent call last): File "/home/cimtest.work/suites/libvirt-cim/lib/XenKvmLib/const.py", line 141, in do_try rc = f() File "01_enum_crs.py", line 113, in main if res_val != exp_val: TypeError: __call__() takes exactly 1 argument (2 given) ERROR - None -------------------------------------------------------------------- ReferencedProfile - 01_verify_refprof.py: FAIL ERROR - KVM_RegisteredProfile returned 0 Profile objects, expected atleast 5 -------------------------------------------------------------------- ReferencedProfile - 02_refprofile_errs.py: FAIL ERROR - KVM_RegisteredProfile returned 0 Profile objects, expected atleast 5 -------------------------------------------------------------------- John From xiawenc at linux.vnet.ibm.com Thu Apr 11 02:51:09 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Thu, 11 Apr 2013 10:51:09 +0800 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <5165B3C3.8060204@redhat.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> Message-ID: <5166251D.7090502@linux.vnet.ibm.com> > On 04/10/2013 04:26 AM, Wenchao Xia wrote: >> ? 2013-4-9 23:45, John Ferlan ??: >>> On 04/09/2013 10:40 AM, John Ferlan wrote: >>>> On 04/08/2013 06:16 AM, Wenchao Xia wrote: >> >> Yes, this fix all bugs show on my machine, maybe there are other >> caller, but want to sent this first to make it work. I like >> your patches which compare two version string from libvirt. :> >> >> I got only 3 case fail now, may be you can paste some detail >> of your fail here. >> >> Something I know to make it work: >> 1 host must be able to resolve itself's name, that is ping [MACINENAME] >> must succeed. >> 2 two fake image must be created in /var/lib/libvirt/images >> 3 default disk-pool default must be "virsh pool-undefine". > > > I'm *painfully* aware of #2 & #3!!! The "default" libvirt location is > also /var/lib/libvirt/images and cimtest kept failing strangely until Me too, maybe we can skip this now and improve it in the future. > I remembered that two storage pools cannot use the same path to storage. > The cimtest results were not very "helpful" at discerning that though > with just the following: > > ElementAllocatedFromPool - 01_forward.py: FAIL > ERROR - Expected at least one KVM_DiskPool instance > ERROR - Exception details : Failed to get pool details > CIM_ERR_NOT_FOUND: No such instance (cimtest-diskpool) > > > I knew cimtest-diskpool wasn't being created, but I had no idea why. > I have it on a list of things to do to generate better errors or > use a different location (either configurable or chosen). > > As for the other errors - I'm running libvirt-cim in the rhel6.4 > environment with libvirt 0.10.2 installed. I have no predefined > domains which differs from my f18 environment. I'm thinking there's > some amount of environment differences which I don't yet have > the "history" to recognize right away. > > I presently have 22 failures - > > * 11 are because neither the Migration Service nor the Capabilities > MOF is present. Whether that's not installed by design, I haven't > yet figured out. > How do you installed libvirt-cim? I guess "make install" still have problem, could u try remove old libvirt-cim rpm and then "make rpm" in libvirt-cim source code and then rpm -ivh? Also have you installed pywbem rpm? softlink seems work innormal since pywbem have dependency library need to be installed. I suggest make the suit work normal now if some manually env clean/preparation can solve it, and add a README in the suit to tip about the issues, we can fix them one by one later. > ElementCapabilities - 02_reverse.py: FAIL > ElementCapabilities - 04_reverse_errs.py: FAIL > ElementCapabilities - 05_hostsystem_cap.py: FAIL > ElementConforms - 01_forward.py: FAIL > HostedService - 01_forward.py: FAIL > HostedService - 02_reverse.py: FAIL > HostedService - 04_reverse_errs.py: FAIL > SettingsDefineCapabilities - 04_forward_vsmsdata.py: FAIL > SettingsDefineCapabilities - 05_reverse_vsmcap.py: FAIL > VirtualSystemMigrationCapabilities - 01_enum.py: FAIL > VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: FAIL > > * 2 are because of the bad comparison in RPCS for RHEL versions, > although I used a slightly different mechanism than you did: > > - (elems[0] == 'Red' and int(elems[i+1]) >= 7): > + (elems[0] == 'Red' and float(elems[i+1]) >= 7.0): > > > * 9 I still need to research some more: > > -------------------------------------------------------------------- > > ElementConforms - 02_reverse.py: FAIL > ERROR - Failed to get associators information for KVM_ElementConformsToProfile > ERROR - Exception: u'KVM_ComputerSystem' > -------------------------------------------------------------------- > > ElementConforms - 03_ectp_fwd_errs.py: XFAIL > ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyname' passed. > ERROR - ------ FAILED: INVALID_InstID_Keyname------ > ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyvalue' passed. > ERROR - ------ FAILED: INVALID_InstID_Keyvalue------ > ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyname' passed. > ERROR - ------ FAILED: INVALID_InstID_Keyname------ > ERROR - 'KVM_ElementConformsToProfile' association failed to generate an exception and 'INVALID_InstID_Keyvalue' passed. > ERROR - ------ FAILED: INVALID_InstID_Keyvalue------ > -------------------------------------------------------------------- > > HostSystem - 03_hs_to_settdefcap.py: FAIL > ERROR - Failed to get associatornames according to KVM_AllocationCapabilities > ERROR - Exception: list index out of range > -------------------------------------------------------------------- > > Profile - 01_enum.py: FAIL > ERROR - Profile CIM:DSP1042-SystemVirtualization-1.0.0 is not found > ERROR - Properties check for KVM_RegisteredProfile failed > -------------------------------------------------------------------- > > Profile - 02_profile_to_elec.py: FAIL > ERROR - KVM_RegisteredProfile with Virtual System Profile was not returned > -------------------------------------------------------------------- > > Profile - 03_rprofile_gi_errs.py: FAIL > ERROR - Unexpected errno 6, desc CIM_ERR_NOT_FOUND: KVM_RegisteredProfile.InstanceID="INVALID_Instid_KeyValue" > ERROR - Expected No such instance 6 > ERROR - NameError : global name 'tc' is not defined > Traceback (most recent call last): > File "/home/cimtest.work/suites/libvirt-cim/lib/XenKvmLib/const.py", line 141, in do_try > rc = f() > File "03_rprofile_gi_errs.py", line 85, in main > logger.error("------ FAILED: %s %s ------", cn, tc) > NameError: global name 'tc' is not defined > ERROR - None > -------------------------------------------------------------------- > > RedirectionService - 01_enum_crs.py: FAIL > 01_enum_crs.py:29: DeprecationWarning: the sets module is deprecated > from sets import Set > ERROR - TypeError : __call__() takes exactly 1 argument (2 given) > Traceback (most recent call last): > File "/home/cimtest.work/suites/libvirt-cim/lib/XenKvmLib/const.py", line 141, in do_try > rc = f() > File "01_enum_crs.py", line 113, in main > if res_val != exp_val: > TypeError: __call__() takes exactly 1 argument (2 given) > ERROR - None > -------------------------------------------------------------------- > > ReferencedProfile - 01_verify_refprof.py: FAIL > ERROR - KVM_RegisteredProfile returned 0 Profile objects, expected atleast 5 > -------------------------------------------------------------------- > > ReferencedProfile - 02_refprofile_errs.py: FAIL > ERROR - KVM_RegisteredProfile returned 0 Profile objects, expected atleast 5 > -------------------------------------------------------------------- > > > John > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia From cngesaint at outlook.com Thu Apr 11 07:15:51 2013 From: cngesaint at outlook.com (WangXu) Date: Thu, 11 Apr 2013 07:15:51 +0000 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: References: , Message-ID: Dear John, What's your opinion about my solution? If no problem, we'll develop patch as described. ver. 0.6.2 has to be released as soon as possible:-) Sincerely yours, Xu Wang From: cngesaint at outlook.com To: libvirt-cim at redhat.com Date: Wed, 10 Apr 2013 10:20:34 +0000 Subject: Re: [Libvirt-cim] [PATCH] SwitchService: make command configurable I think the "vsi_search_string be an array" problem could be solved as following steps: 1. An item such as (vsi_support_key_string="{supported forwarding mode: (0x40) reflective relay, supported capabilities: (0x7) RTE ECP VDP}";) is configured well in the .conf file. 2. The application read this value from .conf file as a long string. 3. The application executes supporting function about VSI and check whether the output returned is a substring of vsi_support_key_string. If the output contains in the vsi_support_key_string, supporting of VSI is proved. Sincerely yours, Xu Wang >On 04/09/2013 06:40 AM, Wenchao Xia wrote: >> Hi, John >> Sorry to interrupt but still need you to review this patch, which >>make it work more flex on different version. >> By the way, I got only 3 fail and they seems small problems in test >> suit's code, do you think it is ready to release 0.6.2(with this patch >> pushed)? >> I don't have 'lldptool' installed on my system, so I cannot verify the output or the fix. > >What concerns me though is the reliance on something that could (and does) change between versions. >What you have is just "two" versions of differences. What if there's a 3rd version that had/has >something different? Is the output different on different archs/OS's? > >Is there no way to make the vsi_search_string be an array in the configuration file? Rather than two >constant strings. > >I suppose what you have works, but it seems there has to be a better way to do this. I also think the >comments in the .conf file could be beefed up so someone would know what to look for. Is that a >specific field in the output or is that string what is returned. Essentially how would someone know >what to look for in order to add a new/different string. > >Call this a "luke-warm" ACK. It works, but I think it's a shortcut. > >John > > > >>> In RH6.4 lldptool query command and output changed a bit, ...... _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From tyreld at us.ibm.com Thu Apr 11 10:04:02 2013 From: tyreld at us.ibm.com (Tyrel Datwyler) Date: Thu, 11 Apr 2013 04:04:02 -0600 Subject: [Libvirt-cim] Tyrel Datwyler is out of the office. Message-ID: I will be out of the office starting 04/11/2013 and will not return until 04/15/2013. During this time I will not have access to email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jferlan at redhat.com Thu Apr 11 10:44:40 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 11 Apr 2013 06:44:40 -0400 Subject: [Libvirt-cim] [PATCH] SwitchService: make command configurable In-Reply-To: References: , Message-ID: <51669418.3000802@redhat.com> On 04/11/2013 03:15 AM, WangXu wrote: > Dear John, > What's your opinion about my solution? If no problem, we'll develop > patch as described. ver. 0.6.2 has to be released as soon as possible:-) > > Sincerely yours, > Xu Wang > > I didn't realize you were looking/waiting for feedback. I think a non static length or number of strings is certainly better than just two. It provides for far more flexibility. Whether you do that by a comma (or some other delimiter) separated list or something that has a count and set of strings to look for doesn't really matter to me. The only concern about doing so in a list is choosing your element separator. As soon as you choose a comma is as soon as a comma shows up in the next round of output. For example, vsi_support_key_string_count=2 vsi_support_key_string[0]="String #1" vsi_support_key_string[1]="String #2" Beyond that adding something to the .conf file to describe what a "customer" would need to run and where to look in order to find the desired string that would be added to the existing list of strings would be helpful. John > > ------------------------------------------------------------------------ > From: cngesaint at outlook.com > To: libvirt-cim at redhat.com > Date: Wed, 10 Apr 2013 10:20:34 +0000 > Subject: Re: [Libvirt-cim] [PATCH] SwitchService: make command configurable > > I think the "vsi_search_string be an array" problem could be solved as > following steps: > 1. An item such as (vsi_support_key_string="{supported forwarding > mode: (0x40) reflective relay, supported capabilities: (0x7) RTE ECP > VDP}";) is configured well in the .conf file. > 2. The application read this value from .conf file as a long string. > 3. The application executes supporting function about VSI and check > whether the output returned is a substring of vsi_support_key_string. If > the output contains in the vsi_support_key_string, supporting of VSI is > proved. > > Sincerely yours, > Xu Wang > > > >>On 04/09/2013 06:40 AM, Wenchao Xia wrote: >>> Hi, John >>> Sorry to interrupt but still need you to review this patch, which >>>make it work more flex on different version. >>> By the way, I got only 3 fail and they seems small problems in test >>> suit's code, do you think it is ready to release 0.6.2(with this patch >>> pushed)? >>> I don't have 'lldptool' installed on my system, so I cannot verify > the output or the fix. >> >>What concerns me though is the reliance on something that could (and > does) change between versions. >What you have is just "two" versions of > differences. What if there's a 3rd version that had/has >something > different? Is the output different on different archs/OS's? >> >>Is there no way to make the vsi_search_string be an array in the > configuration file? Rather than two >constant strings. >> >>I suppose what you have works, but it seems there has to be a better > way to do this. I also think the >comments in the .conf file could be > beefed up so someone would know what to look for. Is that a >specific > field in the output or is that string what is returned. Essentially how > would someone know >what to look for in order to add a new/different > string. >> >>Call this a "luke-warm" ACK. It works, but I think it's a shortcut. >> >>John >> >> >> >>>> In RH6.4 lldptool query command and output changed a bit, > ...... > > _______________________________________________ Libvirt-cim mailing list > Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim From jferlan at redhat.com Thu Apr 11 20:35:09 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 11 Apr 2013 16:35:09 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <5166251D.7090502@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> <5166251D.7090502@linux.vnet.ibm.com> Message-ID: <51671E7D.8090102@redhat.com> On 04/10/2013 10:51 PM, Wenchao Xia wrote: >> On 04/10/2013 04:26 AM, Wenchao Xia wrote: >>> ? 2013-4-9 23:45, John Ferlan ??: >>>> On 04/09/2013 10:40 AM, John Ferlan wrote: >>>>> On 04/08/2013 06:16 AM, Wenchao Xia wrote: >> I'm *painfully* aware of #2 & #3!!! The "default" libvirt location is >> also /var/lib/libvirt/images and cimtest kept failing strangely until > Me too, maybe we can skip this now and improve it in the future. > Right - I'm not going to solve the problem - just have it noted. > How do you installed libvirt-cim? I guess "make install" still > have problem, could u try remove old libvirt-cim rpm and then "make rpm" > in libvirt-cim source code and then rpm -ivh? > Also have you installed pywbem rpm? softlink seems work innormal since > pywbem have dependency library need to be installed. What's interesting about the RH64 system is I used yum/rpm install only... The rest is a bit lengthy as I've added to it during the day, but perhaps it's good to know/record the steps/process used. I yum localinstall'd libvirt-cim... pywbem was installed... I erased and reinstalled libvirt-cim today (sometimes that helps) and yet still the MigrationService was still missing, although MigrationCapabilities miraculously showed up. A 'wbemcli ecn http://root:password at localhost/root/virt | grep Migration' did not find a CIM_VirtualSystemMigrationService. After digging through the various scripts I believe that means the {KVM|LXC|XEN} versions of the mof won't be installed/loaded Why it's not there - I have no clue. Per the libvirt.org/CIM/schema webpage, I installed the v216 experimental schema on my RH64 box. That schema doesn't have that class/mof; however, on my F18 box it seems I have a later schema installed (v2.33) which does have it. Not sure how I installed that... According to everything I found online the migration schema was added in v2.17. After spending some time thinking about and investigating the differences between the two systems - I tried using the 'make {preinstall|install|postinstall}' options and had some interesting results (with a restart of tog-pegasus between each make option). Interesting as in things now work (except for one small bug in 'enum_volumes' where 'None' was returned for an empty storage pool causing an exception - I have a fix for it). Of most interest is somehow CIM_VirtualSystemMigrationService is now present. What I noted as part of that installation which went to /usr/lib64/share/libvirt-cim is that there is a 2.21 schema zip file in that directory which gets inflated and installed as part of the 'make' processing (by one of the two scripts). Since 2.21 > 2.17 that migration mof is there, so now it's on that system. Why this doesn't happen as part of RPM install - I'm not sure. So to summarize - 1. Now I have no test failures on my RH64 system other than the already failing Indications tests. 2. I believe there's some disconnect between what happens via the rpm install and what happens during the 'make' options, but I don't know where to look and right now I really don't have the cycles to investigate. I'm guessing that somewhere along the line 2.21 was made the default, but the web pages didn't get updated and something in the RPM install process didn't quite work right, but it didn't matter or wasn't noticed because perhaps no one went through the pain of a clean installation environment while strictly following the web pages. John From xiawenc at linux.vnet.ibm.com Fri Apr 12 02:55:07 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Fri, 12 Apr 2013 10:55:07 +0800 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <51671E7D.8090102@redhat.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> <5166251D.7090502@linux.vnet.ibm.com> <51671E7D.8090102@redhat.com> Message-ID: <5167778B.9050908@linux.vnet.ibm.com> ? 2013-4-12 4:35, John Ferlan ??: > On 04/10/2013 10:51 PM, Wenchao Xia wrote: >>> On 04/10/2013 04:26 AM, Wenchao Xia wrote: >>>> ? 2013-4-9 23:45, John Ferlan ??: >>>>> On 04/09/2013 10:40 AM, John Ferlan wrote: >>>>>> On 04/08/2013 06:16 AM, Wenchao Xia wrote: >>> I'm *painfully* aware of #2 & #3!!! The "default" libvirt location is >>> also /var/lib/libvirt/images and cimtest kept failing strangely until >> Me too, maybe we can skip this now and improve it in the future. >> > > Right - I'm not going to solve the problem - just have it noted. > > >> How do you installed libvirt-cim? I guess "make install" still >> have problem, could u try remove old libvirt-cim rpm and then "make rpm" >> in libvirt-cim source code and then rpm -ivh? >> Also have you installed pywbem rpm? softlink seems work innormal since >> pywbem have dependency library need to be installed. > > What's interesting about the RH64 system is I used yum/rpm install > only... The rest is a bit lengthy as I've added to it during the day, > but perhaps it's good to know/record the steps/process used. > > I yum localinstall'd libvirt-cim... pywbem was installed... I erased and > reinstalled libvirt-cim today (sometimes that helps) and yet still the > MigrationService was still missing, although MigrationCapabilities > miraculously showed up. > > A 'wbemcli ecn http://root:password at localhost/root/virt | grep > Migration' did not find a CIM_VirtualSystemMigrationService. > > After digging through the various scripts I believe that means the > {KVM|LXC|XEN} versions of the mof won't be installed/loaded > > Why it's not there - I have no clue. Per the libvirt.org/CIM/schema > webpage, I installed the v216 experimental schema on my RH64 box. That > schema doesn't have that class/mof; however, on my F18 box it seems I > have a later schema installed (v2.33) which does have it. Not sure how I > installed that... According to everything I found online the migration > schema was added in v2.17. > > After spending some time thinking about and investigating the > differences between the two systems - I tried using the 'make > {preinstall|install|postinstall}' options and had some interesting > results (with a restart of tog-pegasus between each make option). > Interesting as in things now work (except for one small bug in > 'enum_volumes' where 'None' was returned for an empty storage pool > causing an exception - I have a fix for it). Of most interest is somehow > CIM_VirtualSystemMigrationService is now present. What I noted as part > of that installation which went to /usr/lib64/share/libvirt-cim is that > there is a 2.21 schema zip file in that directory which gets inflated > and installed as part of the 'make' processing (by one of the two > scripts). Since 2.21 > 2.17 that migration mof is there, so now it's on > that system. Why this doesn't happen as part of RPM install - I'm not sure. > > So to summarize - > 1. Now I have no test failures on my RH64 system other than the already > failing Indications tests. > Strange, I still get success on those cases, could u try upstream cimtest on it? I found it fail after applying the 9 patches of your but succeed before, and it succeed again after applying mine these 3 patches. > 2. I believe there's some disconnect between what happens via the rpm > install and what happens during the 'make' options, but I don't know > where to look and right now I really don't have the cycles to > investigate. I'm guessing that somewhere along the line 2.21 was made > the default, but the web pages didn't get updated and something in the > RPM install process didn't quite work right, but it didn't matter or > wasn't noticed because perhaps no one went through the pain of a clean > installation environment while strictly following the web pages. > libvirt-cim make process automatically download 2.21 base schema and install it, it seems root cause are yum install script are missing that part. So rpm -ivh would succeed, yum upgrade would succeed(haven't check), but yum install fail. This is a bug need to be solved, since user are tend to use yum when it is available. > John > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia From xiawenc at linux.vnet.ibm.com Fri Apr 12 06:41:56 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Fri, 12 Apr 2013 14:41:56 +0800 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <5167778B.9050908@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> <5166251D.7090502@linux.vnet.ibm.com> <51671E7D.8090102@redhat.com> <5167778B.9050908@linux.vnet.ibm.com> Message-ID: <5167ACB4.80103@linux.vnet.ibm.com> ? 2013-4-12 10:55, Wenchao Xia ??: > ? 2013-4-12 4:35, John Ferlan ??: >> On 04/10/2013 10:51 PM, Wenchao Xia wrote: >>>> On 04/10/2013 04:26 AM, Wenchao Xia wrote: >>>>> ? 2013-4-9 23:45, John Ferlan ??: >>>>>> On 04/09/2013 10:40 AM, John Ferlan wrote: >>>>>>> On 04/08/2013 06:16 AM, Wenchao Xia wrote: >>>> I'm *painfully* aware of #2 & #3!!! The "default" libvirt location is >>>> also /var/lib/libvirt/images and cimtest kept failing strangely until >>> Me too, maybe we can skip this now and improve it in the future. >>> >> >> Right - I'm not going to solve the problem - just have it noted. >> >> >>> How do you installed libvirt-cim? I guess "make install" still >>> have problem, could u try remove old libvirt-cim rpm and then "make rpm" >>> in libvirt-cim source code and then rpm -ivh? >>> Also have you installed pywbem rpm? softlink seems work innormal >>> since >>> pywbem have dependency library need to be installed. >> >> What's interesting about the RH64 system is I used yum/rpm install >> only... The rest is a bit lengthy as I've added to it during the day, >> but perhaps it's good to know/record the steps/process used. >> >> I yum localinstall'd libvirt-cim... pywbem was installed... I erased and >> reinstalled libvirt-cim today (sometimes that helps) and yet still the >> MigrationService was still missing, although MigrationCapabilities >> miraculously showed up. >> >> A 'wbemcli ecn http://root:password at localhost/root/virt | grep >> Migration' did not find a CIM_VirtualSystemMigrationService. >> >> After digging through the various scripts I believe that means the >> {KVM|LXC|XEN} versions of the mof won't be installed/loaded >> >> Why it's not there - I have no clue. Per the libvirt.org/CIM/schema >> webpage, I installed the v216 experimental schema on my RH64 box. That >> schema doesn't have that class/mof; however, on my F18 box it seems I >> have a later schema installed (v2.33) which does have it. Not sure how I >> installed that... According to everything I found online the migration >> schema was added in v2.17. I guess your use yum update to install RH6.4 right? manually install of V216 base schema is sure a cause, but I am not sure in yum install tog-pegasus/libvirt-cim if base_schema will have its chance to be registered, one thing I am sure is that installation from image disk is OK. Summrize: To fix this problem, only thing need to do, is uninstall base-sc experimental schema and try yum install libvirt-cim, to see if base schema exist. If not, check yum section in spec file. By the way, it is embarrassing that the web page misguide user, may be you can share the link and we should modify it when time allows. >> >> After spending some time thinking about and investigating the >> differences between the two systems - I tried using the 'make >> {preinstall|install|postinstall}' options and had some interesting >> results (with a restart of tog-pegasus between each make option). >> Interesting as in things now work (except for one small bug in >> 'enum_volumes' where 'None' was returned for an empty storage pool >> causing an exception - I have a fix for it). Of most interest is somehow >> CIM_VirtualSystemMigrationService is now present. What I noted as part >> of that installation which went to /usr/lib64/share/libvirt-cim is that >> there is a 2.21 schema zip file in that directory which gets inflated >> and installed as part of the 'make' processing (by one of the two >> scripts). Since 2.21 > 2.17 that migration mof is there, so now it's on >> that system. Why this doesn't happen as part of RPM install - I'm not >> sure. >> >> So to summarize - >> 1. Now I have no test failures on my RH64 system other than the already >> failing Indications tests. >> > Strange, I still get success on those cases, could u try upstream > cimtest on it? I found it fail after applying the 9 patches > of your but succeed before, and it succeed again after applying mine > these 3 patches. > >> 2. I believe there's some disconnect between what happens via the rpm >> install and what happens during the 'make' options, but I don't know >> where to look and right now I really don't have the cycles to >> investigate. I'm guessing that somewhere along the line 2.21 was made >> the default, but the web pages didn't get updated and something in the >> RPM install process didn't quite work right, but it didn't matter or >> wasn't noticed because perhaps no one went through the pain of a clean >> installation environment while strictly following the web pages. >> > libvirt-cim make process automatically download 2.21 base schema and > install it, it seems root cause are yum install script are missing that > part. > So rpm -ivh would succeed, yum upgrade would succeed(haven't check), > but yum install fail. This is a bug need to be solved, since user > are tend to use yum when it is available. > >> John >> >> _______________________________________________ >> Libvirt-cim mailing list >> Libvirt-cim at redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-cim >> > > -- Best Regards Wenchao Xia From jferlan at redhat.com Fri Apr 12 11:39:42 2013 From: jferlan at redhat.com (John Ferlan) Date: Fri, 12 Apr 2013 07:39:42 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <5167778B.9050908@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> <5166251D.7090502@linux.vnet.ibm.com> <51671E7D.8090102@redhat.com> <5167778B.9050908@linux.vnet.ibm.com> Message-ID: <5167F27E.8080505@redhat.com> On 04/11/2013 10:55 PM, Wenchao Xia wrote: > ? 2013-4-12 4:35, John Ferlan ??: >> So to summarize - >> 1. Now I have no test failures on my RH64 system other than the already >> failing Indications tests. >> > Strange, I still get success on those cases, could u try upstream > cimtest on it? I found it fail after applying the 9 patches > of your but succeed before, and it succeed again after applying mine > these 3 patches. > Took me a bit to find the previous email on this, but I think this is a "network configuration issue" on my end rather than a test issue. The 'cimconfig -c -l' returns ' enableIndicationService=true'; however, the value 'fullyQualifiedHostName=' is not (at best) correct. It's not pingable or connectable - it's an address/name that I assume is handled elsewhere in the Red Hat corporate address translation world. >> 2. I believe there's some disconnect between what happens via the rpm >> install and what happens during the 'make' options, but I don't know >> where to look and right now I really don't have the cycles to >> investigate. I'm guessing that somewhere along the line 2.21 was made >> the default, but the web pages didn't get updated and something in the >> RPM install process didn't quite work right, but it didn't matter or >> wasn't noticed because perhaps no one went through the pain of a clean >> installation environment while strictly following the web pages. >> > libvirt-cim make process automatically download 2.21 base schema and > install it, it seems root cause are yum install script are missing that > part. > So rpm -ivh would succeed, yum upgrade would succeed(haven't check), > but yum install fail. This is a bug need to be solved, since user > are tend to use yum when it is available. > Whether rpm -ivh would do the right thing - I have no idea. I used 'yum localinstall' from the result of a 'make rpm' - I'm not a yum expert - just a user, so I have no idea "internally" what the difference between yum install & update is. As a consumer/user of libvirt-cim - if the right cim schema isn't installed, then I'd expect it to be installed regardless of which yum option I used. John From jferlan at redhat.com Fri Apr 12 11:54:27 2013 From: jferlan at redhat.com (John Ferlan) Date: Fri, 12 Apr 2013 07:54:27 -0400 Subject: [Libvirt-cim] [PATCH 0/3] cimtest follow patch In-Reply-To: <5167ACB4.80103@linux.vnet.ibm.com> References: <1365416183-1084-1-git-send-email-xiawenc@linux.vnet.ibm.com> <51642871.7080001@redhat.com> <51643796.7080507@redhat.com> <51652239.6080105@linux.vnet.ibm.com> <5165B3C3.8060204@redhat.com> <5166251D.7090502@linux.vnet.ibm.com> <51671E7D.8090102@redhat.com> <5167778B.9050908@linux.vnet.ibm.com> <5167ACB4.80103@linux.vnet.ibm.com> Message-ID: <5167F5F3.7050005@redhat.com> On 04/12/2013 02:41 AM, Wenchao Xia wrote: >>> >>> Why it's not there - I have no clue. Per the libvirt.org/CIM/schema >>> webpage, I installed the v216 experimental schema on my RH64 box. That >>> schema doesn't have that class/mof; however, on my F18 box it seems I >>> have a later schema installed (v2.33) which does have it. Not sure how I >>> installed that... According to everything I found online the migration >>> schema was added in v2.17. > I guess your use yum update to install RH6.4 right? manually install > of V216 base schema is sure a cause, but I am not sure in yum install > tog-pegasus/libvirt-cim if base_schema will have its chance to be > registered, one thing I am sure is that installation from image disk > is OK. Not sure of the question. I didn't install the 6.4 base system; however, that shouldn't matter. I believe the install was done via some provisioning tool like cobbler. Installation of other necessary packages to make things work has been mostly a hunt and gather exercise, then use rpm -ivh in order to install since by default the yum.repos.d are devoid of any way to yum update. > Summrize: > To fix this problem, only thing need to do, is uninstall base-sc > experimental schema and try yum install libvirt-cim, to see > if base schema exist. If not, check yum section in spec file. Right, when/if I find more time in order to try various different options. I'd probably start from scratch and be more careful about documenting everything I had to do. > > By the way, it is embarrassing that the web page misguide user, > may be you can share the link and we should modify it when time allows. > > The two primary pages I've looked at are: http://libvirt.org/CIM/schema.html http://wiki.libvirt.org/page/Libvirt-cim_setup Beyond that the 'README' from the 'libvirt-cim' git repository provided some tips. Generally speaking though anything from the /CIM/ pages is probably a bit old. Figuring all the steps and packages one should take would be a nice exercise; however, it doesn't seem there are that many new users out there so it's not a "top of the list" type item to undertake. John From veillard at redhat.com Mon Apr 15 10:06:46 2013 From: veillard at redhat.com (Daniel Veillard) Date: Mon, 15 Apr 2013 18:06:46 +0800 Subject: [Libvirt-cim] Release of libcmpiutil-0.5.7 Message-ID: <20130415100646.GI21090@redhat.com> I pushed on the FTP server and tagged in git that release it can be found at: ftp://libvirt.org/libvirt-cim/ It includes only the couple of patches from Wenchao Xia about log fix and improvement. I also pushed on git but after the release a patch which was applied to Fedora to allow compilation on arm, it was uncontroversial, Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From veillard at redhat.com Mon Apr 15 10:12:51 2013 From: veillard at redhat.com (Daniel Veillard) Date: Mon, 15 Apr 2013 18:12:51 +0800 Subject: [Libvirt-cim] Release of libvirt-cim-0.6.2 Message-ID: <20130415101251.GJ21090@redhat.com> Based on feedback last week, I also release libvirt-cim-0.6.2 it is tagged in git and pushed on the ftp: ftp://libvirt.org/libvirt-cim/ It includes the recent set of patches made by Wenchao Xia and John Ferlan plus of a few older patches from last year: libxkutil: set domain->dype to unknown by default (Wenchao Xia) register: Adjust the chatter output (John Ferlan) DevicePool: Use the virConnectListAll interfaces (John Ferlan) libxkutil: Use virConnectListAllDomains() to fetch domains (John Ferlan) xmlgen: Only support script on bridge for xen domains (John Ferlan) Remove empty newline at bottom (John Ferlan) libvirt-cim.spec: Use systemctl for tog-pegasus restart (John Ferlan) Makefile.am: Remove the $(top_srcdir) from subst command (John Ferlan) migration: allow ssh based migration with non root's key file (Wenchao Xia) misc_util: better way to read config (Wenchao Xia) VSSD: report success if not all VS fail in enum (Wenchao Xia) CSI: Move native CSI code together (Wenchao Xia) CSI Discard libvirt event by default (Wenchao Xia) device parsing, add debug print (Wenchao Xia) DevicePool, reimplement get_diskpool_config with libvirt (Wenchao Xia) CSI, add lock to protect shared data in lifecycle_thread (Wenchao Xia) CSI, DevicePool, RASDIndication: fix debug print crash (Wenchao Xia) do not deregister virt classes in yum upgrade (Wenchao Xia) SDC: use property BootDevices instead of BootDevice (Wenchao Xia) SDC: Fix spelling for property IsFullVirt (Wenchao Xia) Remove property CreationClassName in some instance (Wenchao Xia) fix id parsing with white space (Wenchao Xia) Fix an incomplete substitution in Makefile (Klaus Kaempf) distinguish running or inactive state (Wenchao Xia) Fix possible memory leaks (Eduardo Lima (Etrunko)) Pool Refresh Patch2 (Gareth S. Bestor) CSI: Only execute callback if indications are enabled (Eduardo Lima (Etrunko)) CSI: Fix log messages (Eduardo Lima (Etrunko)) CSI: Cleanup code (Eduardo Lima (Etrunko)) Plan9fs (aka 9pfs, VirtFS) support for QEMU/KVM environment (Deepak C Shetty) I also pushed an uncontroversial spec file update based on the Fedora spec file, but it is not included in the release in case some adjustments are needed, thanks everybody for your contributions ! Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ From cngesaint at outlook.com Tue Apr 23 09:30:37 2013 From: cngesaint at outlook.com (cngesaint at outlook.com) Date: Tue, 23 Apr 2013 17:30:37 +0800 Subject: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable In-Reply-To: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> Message-ID: <1366709437-4008-3-git-send-email-cngesaint@outlook.com> From: Xu Wang Signed-off-by: Xu Wang --- libvirt-cim.conf | 14 ++++++++++ libxkutil/misc_util.c | 18 +++++++++++++ libxkutil/misc_util.h | 2 + src/Virt_SwitchService.c | 63 ++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 86 insertions(+), 11 deletions(-) diff --git a/libvirt-cim.conf b/libvirt-cim.conf index 3244ee3..396dac9 100644 --- a/libvirt-cim.conf +++ b/libvirt-cim.conf @@ -38,3 +38,17 @@ # Default value: false # # force_use_qemu = false; + +# lldptool_query_options (string) +# Defines the command used in SwitchService to query VEPA support, will be +# used as "lldptool -i [INTERFACE] [OPTIONS]" +# +# lldptool_query_options = "-t -g ncb -V evbcfg"; + +# vsi_support_key_string (string) +# Defines the string used in SwitchService to search in lldptool's output +# When lldptool updates its output, please update the new output into the +# output set. add comma between items. +# +# vsi_support_key_string = "{ supported forwarding mode: (0x40) reflective relay," +# " supported capabilities: (0x7) RTE ECP VDP}"; diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c index 4c0b0a1..6ce8dca 100644 --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -244,6 +244,24 @@ const char *get_mig_ssh_tmp_key(void) return prop.value_string; } +const char *get_lldptool_query_options(void) +{ + static LibvirtcimConfigProperty prop = { + "lldptool_query_options", CONFIG_STRING, {0}, 0}; + + libvirt_cim_config_get(&prop); + return prop.value_string; +} + +const char *get_vsi_support_key_string(void) +{ + static LibvirtcimConfigProperty prop = { + "vsi_support_key_string", CONFIG_STRING, {0}, 0};; + + libvirt_cim_config_get(&prop); + return prop.value_string; +} + virConnectPtr connect_by_classname(const CMPIBroker *broker, const char *classname, CMPIStatus *s) diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h index 9e6b419..4eb588d 100644 --- a/libxkutil/misc_util.h +++ b/libxkutil/misc_util.h @@ -155,6 +155,8 @@ int virt_set_status(const CMPIBroker *broker, /* get libvirt-cim config */ const char *get_mig_ssh_tmp_key(void); bool get_force_use_qemu(void); +const char *get_lldptool_query_options(void); +const char *get_vsi_support_key_string(void); /* * Local Variables: diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c index 8991426..f7bafbf 100644 --- a/src/Virt_SwitchService.c +++ b/src/Virt_SwitchService.c @@ -46,12 +46,26 @@ static CMPIStatus check_vsi_support(char *command) CMPIStatus s = {CMPI_RC_OK, NULL}; char buff[MAX_LEN]; FILE *stream = NULL; - const char *searchStr[] = {" supported forwarding mode: " - "(0x40) reflective relay", - " supported capabilities: " - "(0x07) RTE ECP VDP", - NULL}; - int matched = 0; + char *searchStr[8]; /* maximum items of vsi support output */ + int count = 0; + const char *user_settings = get_vsi_support_key_string(); + char *vsi_support_key_string = NULL; + char *delim = "{},"; + int matched = 0; + char *temp = NULL; + + if (!user_settings) { + user_settings = "{ supported forwarding mode: " + "(0x40) reflective relay," + " supported capabilities: " + "(0x7) RTE ECP VDP}"; + } + + vsi_support_key_string = strdup(user_settings); + if (vsi_support_key_string == NULL) { + CU_DEBUG("strdup vsi_support_key_string failed!"); + goto out; + } // Run lldptool command to find vsi support. stream = popen(command, "r"); @@ -63,6 +77,25 @@ static CMPIStatus check_vsi_support(char *command) goto out; } + /* Slice vsi_support_key_string into items */ + searchStr[count] = strtok_r(vsi_support_key_string, delim, &temp); + if (searchStr[count] == NULL) { + CU_DEBUG("searchStr fetch failed when calling strtok_r!"); + } else { + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); + count++; + } + + while ((searchStr[count] = strtok_r(NULL, delim, &temp))) { + if (count >= 7) { + CU_DEBUG("WARN: searchStr is full, left aborted!"); + break; + } else { + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); + count++; + } + } + // Read the output of the command. while (fgets(buff, MAX_LEN, stream) != NULL) { int i = 0; @@ -81,16 +114,18 @@ static CMPIStatus check_vsi_support(char *command) } /* All the search strings were found in the output of this command. */ - if (matched == 2) { + if (matched == count) { cu_statusf(_BROKER, &s, CMPI_RC_OK, "VSI supported"); - goto out;; + goto out; } } + cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, "No VSI Support found"); - out: + out: + free(vsi_support_key_string); if (stream != NULL) pclose(stream); return s; @@ -214,6 +249,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, int i; char **if_list; char cmd[MAX_LEN]; + const char *lldptool_query_options = NULL; *_inst = NULL; conn = connect_by_classname(broker, CLASSNAME(reference), &s); @@ -257,10 +293,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, CU_DEBUG("Found %d interfaces", count); + lldptool_query_options = get_lldptool_query_options(); + if (!lldptool_query_options) { + lldptool_query_options = "-t -g ncb -V evbcfg"; + } for (i=0; i References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> Message-ID: <1366709437-4008-2-git-send-email-cngesaint@outlook.com> From: Xu Wang Original code will report xml text missing when a disk is not accessable, make user confuse. This patch will report the real error to tip user check its system health state on the server. Signed-off-by: Xu Wang --- src/Virt_VirtualSystemManagementService.c | 65 +++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 4e93ef0..d252e12 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -964,11 +964,13 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, } static const char *disk_rasd_to_vdev(CMPIInstance *inst, - struct virt_device *dev) + struct virt_device *dev, + char **p_error) { const char *val = NULL; uint16_t type; bool read = false; + int rc; CU_DEBUG("Enter disk_rasd_to_vdev"); if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) @@ -984,6 +986,17 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, dev->dev.disk.source = strdup(val); dev->dev.disk.disk_type = disk_type_from_file(val); + if (dev->dev.disk.disk_type == DISK_UNKNOWN) { + /* on success or fail caller should try free it */ + rc = asprintf(p_error, "Device %s, Address %s, " + "make sure Address can be accessed on host system.", + dev->dev.disk.virtual_dev, dev->dev.disk.source); + if (rc == -1) { + CU_DEBUG("error during recording exception!"); + } + return "Can't get a valid disk type, "; + } + if (cu_get_u16_prop(inst, "EmulatedType", &type) != CMPI_RC_OK) type = VIRT_DISK_TYPE_DISK; @@ -1452,10 +1465,11 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, uint16_t type, - const char *ns) + const char *ns, + char **p_error) { if (type == CIM_RES_TYPE_DISK) { - return disk_rasd_to_vdev(inst, dev); + return disk_rasd_to_vdev(inst, dev, p_error); } else if (type == CIM_RES_TYPE_NET) { return net_rasd_to_vdev(inst, dev, ns); } else if (type == CIM_RES_TYPE_MEM) { @@ -1494,7 +1508,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, static const char *rasd_to_vdev(CMPIInstance *inst, struct domain *domain, struct virt_device *dev, - const char *ns) + const char *ns, + char **p_error) { uint16_t type; CMPIObjectPath *op; @@ -1516,7 +1531,7 @@ static const char *rasd_to_vdev(CMPIInstance *inst, if (domain->type == DOMAIN_LXC) msg = _container_rasd_to_vdev(inst, dev, type, ns); else - msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns); + msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns, p_error); out: if (msg && op) CU_DEBUG("rasd_to_vdev(%s): %s", CLASSNAME(op), msg); @@ -1560,7 +1575,8 @@ static char *add_device_nodup(struct virt_device *dev, static const char *classify_resources(CMPIArray *resources, const char *ns, - struct domain *domain) + struct domain *domain, + char **p_error) { int i; uint16_t type; @@ -1613,13 +1629,15 @@ static const char *classify_resources(CMPIArray *resources, msg = rasd_to_vdev(inst, domain, &domain->dev_vcpu[0], - ns); + ns, + p_error); } else if (type == CIM_RES_TYPE_MEM) { domain->dev_mem_ct = 1; msg = rasd_to_vdev(inst, domain, &domain->dev_mem[0], - ns); + ns, + p_error); } else if (type == CIM_RES_TYPE_DISK) { struct virt_device dev; int dcount = count + domain->dev_disk_ct; @@ -1628,7 +1646,8 @@ static const char *classify_resources(CMPIArray *resources, msg = rasd_to_vdev(inst, domain, &dev, - ns); + ns, + p_error); if (msg == NULL) msg = add_device_nodup(&dev, domain->dev_disk, @@ -1646,7 +1665,8 @@ static const char *classify_resources(CMPIArray *resources, msg = rasd_to_vdev(inst, domain, &dev, - ns); + ns, + p_error); if (msg == NULL) msg = add_device_nodup(&dev, domain->dev_net, @@ -1676,7 +1696,8 @@ static const char *classify_resources(CMPIArray *resources, msg = rasd_to_vdev(inst, domain, &dev, - ns); + ns, + p_error); if (msg == NULL) msg = add_device_nodup(&dev, domain->dev_graphics, @@ -1687,7 +1708,8 @@ static const char *classify_resources(CMPIArray *resources, msg = rasd_to_vdev(inst, domain, &domain->dev_input[0], - ns); + ns, + p_error); } if (msg != NULL) return msg; @@ -2083,6 +2105,7 @@ static CMPIInstance *create_system(const CMPIContext *context, struct inst_list list; const char *props[] = {NULL}; struct domain *domain = NULL; + char *error_msg = NULL; inst_list_init(&list); @@ -2113,12 +2136,13 @@ static CMPIInstance *create_system(const CMPIContext *context, if (s->rc != CMPI_RC_OK) goto out; - msg = classify_resources(resources, NAMESPACE(ref), domain); + msg = classify_resources(resources, NAMESPACE(ref), domain, &error_msg); if (msg != NULL) { - CU_DEBUG("Failed to classify resources: %s", msg); + CU_DEBUG("Failed to classify resources: %s, %s", + msg, error_msg); cu_statusf(_BROKER, s, CMPI_RC_ERR_FAILED, - "ResourceSettings Error: %s", msg); + "ResourceSettings Error: %s, %s", msg, error_msg); goto out; } @@ -2159,6 +2183,7 @@ static CMPIInstance *create_system(const CMPIContext *context, out: + free(error_msg); cleanup_dominfo(&domain); free(xml); inst_list_free(&list); @@ -2638,6 +2663,7 @@ static CMPIStatus resource_add(struct domain *dominfo, struct virt_device *dev; int *count = NULL; const char *msg = NULL; + char *error_msg = NULL; op = CMGetObjectPath(rasd, &s); if ((op == NULL) || (s.rc != CMPI_RC_OK)) @@ -2677,7 +2703,7 @@ static CMPIStatus resource_add(struct domain *dominfo, dev = &list[*count]; dev->type = type; - msg = rasd_to_vdev(rasd, dominfo, dev, ns); + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); if (msg != NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -2702,6 +2728,8 @@ static CMPIStatus resource_add(struct domain *dominfo, (*count)++; out: + free(error_msg); + return s; } @@ -2718,6 +2746,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, int *count; int i; const char *msg = NULL; + char *error_msg = NULL; CU_DEBUG("Enter resource_mod"); if (devid == NULL) { @@ -2749,7 +2778,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, struct virt_device *dev = &list[i]; if (STREQ(dev->id, devid)) { - msg = rasd_to_vdev(rasd, dominfo, dev, ns); + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); if (msg != NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -2793,6 +2822,8 @@ static CMPIStatus resource_mod(struct domain *dominfo, } out: + free(error_msg); + return s; } -- 1.7.1 From cngesaint at outlook.com Tue Apr 23 09:30:35 2013 From: cngesaint at outlook.com (cngesaint at outlook.com) Date: Tue, 23 Apr 2013 17:30:35 +0800 Subject: [Libvirt-cim] [PATCH 1/3] make force use qemu configurable Message-ID: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> From: Wenchao Xia Since in nested KVM, libvirt-cim doesn't handle it well now, add this option to make it run well with qemu wchi help development and test. Signed-off-by: Xu Wang --- libvirt-cim.conf | 8 ++++++++ libxkutil/misc_util.c | 8 ++++++++ libxkutil/misc_util.h | 1 + src/Virt_VirtualSystemManagementService.c | 7 +++++++ 4 files changed, 24 insertions(+), 0 deletions(-) diff --git a/libvirt-cim.conf b/libvirt-cim.conf index 37d7b0f..3244ee3 100644 --- a/libvirt-cim.conf +++ b/libvirt-cim.conf @@ -30,3 +30,11 @@ # Default value: NULL, that is not set. # # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; + +# force_use_qemu (bool) +# Since in nested KVM, libvirt-cim doesn't handler it well now, so add this +# option to make it run well with qemu which help development and test. +# Possible values: {true,false} +# Default value: false +# +# force_use_qemu = false; diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c index 00eb4b1..4c0b0a1 100644 --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -227,6 +227,14 @@ static int is_read_only(void) return prop.value_bool; } +bool get_force_use_qemu(void) +{ + static LibvirtcimConfigProperty prop = { + "force_use_qemu", CONFIG_BOOL, {0}, 0}; + libvirt_cim_config_get(&prop); + return prop.value_bool; +} + const char *get_mig_ssh_tmp_key(void) { static LibvirtcimConfigProperty prop = { diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h index 0f52290..9e6b419 100644 --- a/libxkutil/misc_util.h +++ b/libxkutil/misc_util.h @@ -154,6 +154,7 @@ int virt_set_status(const CMPIBroker *broker, /* get libvirt-cim config */ const char *get_mig_ssh_tmp_key(void); +bool get_force_use_qemu(void); /* * Local Variables: diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index cbb646d..4e93ef0 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -394,6 +394,13 @@ static bool system_has_kvm(const char *pfx) virConnectPtr conn; char *caps = NULL; bool kvm = false; + bool force_use_qemu = get_force_use_qemu(); + + /* hack for nested KVM */ + if (force_use_qemu) { + CU_DEBUG("Enter force use qemu mode!"); + return false; + } conn = connect_by_classname(_BROKER, pfx, &s); if ((conn == NULL) || (s.rc != CMPI_RC_OK)) { -- 1.7.1 From cngesaint at outlook.com Wed Apr 24 05:31:09 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 05:31:09 +0000 Subject: [Libvirt-cim] [PATCH 1/9] Need to check "slp=true", not just "slp" since "slp=false" is possible Message-ID: Reviewed-by: Xu Wang > .../libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py > index f6cf5b1..f08d157 100644 > --- a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py > +++ b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py > @@ -64,7 +64,7 @@ def get_slp_info(server): > logger.info("Test not supported for sfcb yet ... hence skipping") > return SKIP > > - cmd = "cimconfig -l -p | grep slp" > + cmd = "cimconfig -l -p | grep slp=true" > rc, out = run_remote(server, cmd) > if rc != 0: > logger.error("SLP is not enabled for the cimserver on '%s'", server) > -- > 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 06:25:04 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 06:25:04 +0000 Subject: [Libvirt-cim] [PATCH 2/9] Change the MAC from "99:" to "88:" In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang From: cngesaint at outlook.com To: cngesaint at outlook.com Subject: [Libvirt-cim] [PATCH 2/9] Change the MAC from "99:" to "88:" Date: Wed, 24 Apr 2013 06:19:43 +0000 Using a MAC starting with "99:" is not legal. That ends up being a Multicast Address since the low order bit of the first byte of the address (in hex) is one. That is "99" is 0x10011001" in hex, where the least significant bit is a "1" (one) indicating a multicast. --- suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../cimtest/VirtualSystemManagementService/06_addresource.py | 2 +- .../cimtest/VirtualSystemManagementService/08_modifyresource.py | 4 ++-- .../VirtualSystemManagementService/13_refconfig_additional_devs.py | 4 ++-- .../cimtest/VirtualSystemManagementService/18_define_sys_bridge.py | 2 +- .../VirtualSystemManagementService/22_addmulti_brg_interface.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py index c5d8a22..be82335 100644 --- a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py +++ b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py @@ -40,7 +40,7 @@ from XenKvmLib.const import get_provider_version sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'uuid_domain' test_dom = 'test_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' duplicate_uuid_support = 915 def get_vssd(ip, virt, dom): diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py index fdcb84a..ac18c69 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py @@ -38,7 +38,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'rstest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' ntype = 'network' npool_name = default_network_name + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py index df58d1f..a7c3871 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py @@ -43,9 +43,9 @@ cpu = 2 ncpu = 1 nmem = 131072 new_int = randint(10, 99) -new_mac1 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac1 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) new_int += 1 -new_mac2 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac2 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) def cleanup_env(ip, cxml): cxml.destroy(ip) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py index 6274527..a47db8f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py @@ -38,8 +38,8 @@ from XenKvmLib.vxml import get_class sup_types = ['Xen', 'XenFV', 'KVM'] test_dom = 'rstest_domain' test_dom2 = 'rstest_domain2' -mac1 = '99:aa:bb:cc:ee:ff' -mac2 = '99:aa:bb:cc:ee:aa' +mac1 = '88:aa:bb:cc:ee:ff' +mac2 = '88:aa:bb:cc:ee:aa' REQUESTED_STATE = 2 TIME = "00000000000000.000000:000" diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py index e02de29..66b3e45 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py @@ -32,7 +32,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py index 9abb21b..36d1873 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py @@ -36,7 +36,7 @@ sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "my_domain1" default_net = "my_network0" test_net = "my_network1" -test_mac = '99:aa:bb:cc:ee:ff' +test_mac = '88:aa:bb:cc:ee:ff' default_mac = "00:11:33:33:44:55" ntype = 'bridge' default_brg = 'mybr0' diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py b/suites/libvirt-cim/lib/XenKvmLib/const.py index 6dea644..6701d36 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/const.py +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py @@ -80,7 +80,7 @@ Xen_init_path = os.path.join(_image_dir, 'default-xen-initrd') Xen_disk_path = os.path.join(_image_dir, 'default-xen-dimage') Xen_secondary_disk_path = os.path.join(_image_dir, 'default-xen-dimage.2ND') Xen_default_disk_dev = 'xvda' -Xen_default_mac = '11:22:33:aa:bb:cc' +Xen_default_mac = '88:22:33:aa:bb:cc' # vxml.KVMXML KVM_default_emulator = '/usr/bin/qemu-system-x86_64' @@ -88,7 +88,7 @@ KVM_disk_path = os.path.join(_image_dir, 'default-kvm-dimage') KVM_secondary_disk_path = os.path.join(_image_dir, 'default-kvm-dimage.2ND') KVM_default_disk_dev = 'hda' KVM_default_cdrom_dev = 'hdc' -KVM_default_mac = '11:22:33:aa:bb:cc' +KVM_default_mac = '88:22:33:aa:bb:cc' # vxml.XenFVXML s, o = platform.architecture() @@ -109,7 +109,7 @@ LXC_default_emulator = '/usr/libexec/libvirt_lxc' LXC_default_tty = '/dev/ptmx' LXC_default_mp = '/tmp' LXC_default_source = '/var/lib/libvirt/images/lxc_files' -LXC_default_mac = '11:22:33:aa:bb:cc' +LXC_default_mac = '88:22:33:aa:bb:cc' LXC_netns_support = False parser = OptionParser() diff --git a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py index b32ae4c..914dbb0 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py @@ -42,7 +42,7 @@ kernel_path = os.path.join(image_dir, 'default-xen-kernel') init_path = os.path.join(image_dir, 'default-xen-initrd') disk_path = os.path.join(image_dir, 'default-xen-dimage') -default_mac = '11:22:33:aa:bb:cc' +default_mac = '88:22:33:aa:bb:cc' def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, disk_file_path = disk_path, disk = "xvda"): -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 06:50:08 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 06:50:08 +0000 Subject: [Libvirt-cim] [PATCH 3/9] Create a temporary directory for disk pool tests In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang From: cngesaint at outlook.com To: cngesaint at outlook.com Subject: [Libvirt-cim] [PATCH 3/9] Create a temporary directory for disk pool tests Date: Wed, 24 Apr 2013 06:42:05 +0000 We cannot have two storage pools referencing the same path. Since the cimtest-diskpool is already created at /var/lib/libvirt/images, we'll use that (e.g. _image_dir symbol) to create a subdirectory for the test. We'll also delete that directory when we're done. --- .../08_CreateDiskResourcePool.py | 26 +++++++++++++++++----- .../09_DeleteDiskPool.py | 19 +++++++++++----- .../15_DiskPoolAutostart.py | 11 ++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py index c82b5b0..636f59c 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py @@ -48,6 +48,7 @@ # -Date: 26.05.2009 import sys +import os from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version from CimTest.ReturnCodes import FAIL, PASS, SKIP @@ -55,8 +56,9 @@ from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class from XenKvmLib.common_util import destroy_diskpool, nfs_netfs_setup, \ netfs_cleanup -from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool -from XenKvmLib.const import get_provider_version +from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool, \ + DIR_POOL, NETFS_POOL +from XenKvmLib.const import get_provider_version, _image_dir libvirt_disk_pool_support=837 libvirt_netfs_pool_support=869 @@ -94,19 +96,20 @@ def main(): curr_cim_rev, changeset = get_provider_version(virt, server) if curr_cim_rev >= libvirt_disk_pool_support: - dp_types["DISK_POOL_DIR"] = 1 + dp_types["DISK_POOL_DIR"] = DIR_POOL if curr_cim_rev >= libvirt_netfs_pool_support: - dp_types["DISK_POOL_NETFS"] = 3 + dp_types["DISK_POOL_NETFS"] = NETFS_POOL if len(dp_types) == 0 : - logger.info("No disk pool types in list , hence skipping the test...") + logger.info("No disk pool types in list, hence skipping the test...") return SKIP status = FAIL pool_attr = None # For now the test case support only the creation of # dir type disk pool, netfs later change to fs and disk pooltypes etc - for key, value in dp_types.iteritems(): + for key, value in dp_types.iteritems(): + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key @@ -115,6 +118,15 @@ def main(): if status != PASS: return FAIL + # Cannot have two pools that use the same location/path, so + # since cimtest-diskpool already exists + if key == 'DISK_POOL_DIR': + path = os.path.join(_image_dir, 'temppool') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr["Path"] = path + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -152,6 +164,8 @@ def main(): if key == 'DISK_POOL_NETFS': netfs_cleanup(server, pool_attr) + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py index 31e3f22..8bd15e2 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py @@ -44,6 +44,7 @@ # -Date: 26.05.2009 import sys +import os import pywbem from XenKvmLib import rpcs_service from CimTest.Globals import logger @@ -88,13 +89,17 @@ def main(): elif curr_cim_rev >= libvirt_cim_child_pool_rev: + del_path = False try: - pool_attr = { "Path" : _image_dir } + path = os.path.join(_image_dir, 'deltest') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr = { "Path" : path } status = create_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool", mode_type=TYPE) if status != PASS: - logger.error("Failed to create diskpool '%s'", test_pool) - return status + raise Exception("Failed to create diskpool '%s'" % test_pool) status = verify_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool") @@ -112,8 +117,8 @@ def main(): break if pool_settings == None: - logger.error("Failed to get poolsettings for '%s'", test_pool) - return FAIL + raise Exception("Failed to get poolsettings for '%s'" \ + % test_pool) rpcs_conn.DeleteResourcePool(Pool = pool_settings) pool = EnumInstances(server, dp) @@ -127,8 +132,10 @@ def main(): logger.error("Exception details: %s", details) destroy_diskpool(server, virt, test_pool) undefine_diskpool(server, virt, test_pool) - return FAIL + status = FAIL + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py index b6b758c..b7e72a8 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py @@ -23,6 +23,7 @@ # -Date: 04.14.2011 import sys +import os from pywbem import cim_types from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version @@ -77,12 +78,17 @@ def main(): pool_attr = None key = 'DISK_POOL_DIR' value = 1 + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key - pool_attr = { "Path" : "/var/lib/libvirt/images", + pool_attr = { "Path" : "/var/lib/libvirt/images/autotest", "Autostart" : cim_types.Uint16(1) } + if not os.path.exists(pool_attr["Path"]): + os.mkdir(pool_attr["Path"]) + del_path = True + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -112,6 +118,9 @@ def main(): status = FAIL logger.error("Exception details: %s", details) + if del_path: + os.rmdir(pool_attr["Path"]) + return status if __name__ == "__main__": -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 06:51:54 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 06:51:54 +0000 Subject: [Libvirt-cim] [PATCH 4/9] Use symbols as named in libvirt-cim for easier reference In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang --- .../VirtualSystemManagementService/15_mod_system_settings.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py index e576fca..0be3ae0 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py @@ -37,7 +37,10 @@ from XenKvmLib.xm_virt_util import domain_list, active_domain_list, \ sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'rstest_domain' cpu = 2 -RECOVERY_VAL = 3 +# AutomaticRecoveryAction +NONE_VAL = 2 +RESTART_VAL = 3 + DEFINED_STATE = 3 bug = "00008" f9_bug = "00010" @@ -113,7 +116,7 @@ def main(): raise Expcetion("Failed to get the VSSD instance for %s" % \ default_dom) - val = pywbem.cim_types.Uint16(RECOVERY_VAL) + val = pywbem.cim_types.Uint16(RESTART_VAL) inst['AutomaticRecoveryAction'] = val vssd = inst_to_mof(inst) @@ -135,9 +138,9 @@ def main(): raise Exception("Failed to get the VSSD instance for %s" % \ default_dom) - if inst.AutomaticRecoveryAction != RECOVERY_VAL: + if inst.AutomaticRecoveryAction != RESTART_VAL: logger.error("Exp AutomaticRecoveryAction=%d, got %d", - RECOVERY_VAL, inst.AutomaticRecoveryAction) + RESTART_VAL, inst.AutomaticRecoveryAction) raise Exception("%s not updated properly" % default_dom) status = PASS -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 07:09:51 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 07:09:51 +0000 Subject: [Libvirt-cim] [PATCH 5/9] Fix nfs-server lookup code In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang I have a small confusing about checking linux version under /etc/issue. Can we use search() to find if 'Red Hat' or 'Fedora'is contained in the output? It seems to make code shorter and logic simpler:-) The 'get_nfs_bin()', 'nfs_config()', and 'nfs_netfs_setup()' API's needed adjustment to handle using systemd rather than looking for /etc/init.d/nfs --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 77 ++++++++++++++++++++----- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index f145811..43e5e2c 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -493,27 +493,65 @@ def parse_instance_id(instid): def get_nfs_bin(server): cmd = 'cat /etc/issue | grep -v ^$ | egrep "Red Hat|Fedora"' rc, out = utils.run_remote(server, cmd) + is_systemd = 0 if rc != 0: #SLES nfs_server_bin = "/etc/init.d/nfsserver" else: + # Default, but allow it to be changed nfs_server_bin = "/etc/init.d/nfs" - return nfs_server_bin - -def nfs_config(server, nfs_server_bin): - cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + # Check for 'systemd' being used + # Fedora 15 seems to have been the first place this was the default + # RHEL 7 and beyond will also use the mechanism. + # Since 'out' returns the fetched string, let's parse it a bit more + # looking for the number after the string 'release' which happens to + # be the version. On Fedora systems it's + # "Fedora release 18 (Spherical Cow)" while on RHEL systems it's: + # "Red Hat Enterprise Linux Server release 6.4 (Santiago)" + # + elems = out.split() + if elems[0] == 'Fedora' or (elems[0] == 'Red' and elems[1] == 'Hat'): + for i in range(1, len(elems)): + if elems[i] == 'release': + if (elems[0] == 'Fedora' and int(elems[i+1]) >= 15) or \ + (elems[0] == 'Red' and int(elems[i+1]) >= 7): + # Handle this differently - the command would be + # "systemctl {start|restart|status} nfs" + nfs_server_bin = "systemctl %s nfs" + is_systemd = 1 + break + + return nfs_server_bin, is_systemd + +def nfs_config(server, nfs_server_bin, is_systemd): + if is_systemd == 0: + cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + 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 rc != PASS : # Check if NFS server is installed ... - if not os.path.exists(nfs_server_bin): - logger.error("NFS server '%s' does not seem to be installed "\ - "on '%s'", nfs_server_bin, server) - return SKIP + if is_systemd == 0: + if not os.path.exists(nfs_server_bin): + logger.error("NFS server '%s' does not seem to be installed "\ + "on '%s'", nfs_server_bin, server) + return SKIP + else: + # Works on Fedora and RHEL6 + cmd = "rpm -q nfs-utils" + rc, out = utils.run_remote(server, cmd) + if rc != PASS : + logger.error("NFS server package nfs-utils does not seem "\ + "to be installed on '%s'", server) + return SKIP # Start the nfs server ... - nfs_server_cmd = "%s start" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s start" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "start" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not start the nfsserver on '%s'", server) @@ -573,13 +611,16 @@ def netfs_cleanup(server, pool_attr): move_file(back_exports_file, exports_file) # restart the nfs server - nfs_server_bin = get_nfs_bin(server) - nfs_server_cmd = "%s restart" % nfs_server_bin + nfs_server_bin, is_systemd = get_nfs_bin(server) + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not restart NFS server on '%s'" % server) -def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): +def netfs_config(server, nfs_server_bin, dest_dir_to_mnt, is_systemd): src_dir_for_mnt = mkdtemp() try: @@ -601,7 +642,10 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): % (src_dir_for_mnt, dest_dir_to_mnt)) # Restart the nfs server.... - nfs_server_cmd = "%s restart" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: raise Exception("Could not restart NFS server on '%s'" % server) @@ -615,12 +659,12 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): return PASS, src_dir_for_mnt def nfs_netfs_setup(server): - nfs_server_bin = get_nfs_bin(server) + nfs_server_bin, is_systemd = get_nfs_bin(server) dest_dir = mkdtemp() # Before going ahead verify that nfs server is available on machine.. - ret = nfs_config(server, nfs_server_bin) + ret = nfs_config(server, nfs_server_bin, is_systemd) if ret != PASS: logger.error("Failed to configure NFS on '%s'", server) logger.info("Trying to look for nfs mounted dir on '%s'...", server) @@ -631,7 +675,8 @@ def nfs_netfs_setup(server): else: return PASS, server, src_dir, dest_dir else: - ret, src_dir = netfs_config(server, nfs_server_bin, dest_dir) + ret, src_dir = netfs_config(server, nfs_server_bin, \ + dest_dir, is_systemd) if ret != PASS: logger.error("Failed to configure netfs on '%s'", server) return ret, None, None, None -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 07:11:14 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 07:11:14 +0000 Subject: [Libvirt-cim] [PATCH 6/9] Fix os_status passing to reporter functions In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang If the status returned is an errno value, then os_status will be set outside of the bounds of the 'rc' array in Reporter.py which will cause a KeyError exception. Find, message, and adjust - we're failing anyway. --- suites/libvirt-cim/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/suites/libvirt-cim/main.py b/suites/libvirt-cim/main.py index a4e33e6..e5f3526 100644 --- a/suites/libvirt-cim/main.py +++ b/suites/libvirt-cim/main.py @@ -23,12 +23,14 @@ # from time import time +from time import sleep from optparse import OptionParser import os import sys sys.path.append('../../lib') import TestSuite from CimTest.Globals import logger, log_param +from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP import commands from VirtLib import groups import ConfigParser @@ -274,6 +276,14 @@ def main(options, args): os_status = os.WEXITSTATUS(status) + # status should be from our test; however, if there's an OS level + # failure, it could be set to errno. But that's included in our + # output, so just set it to FAIL; otherwise, we get a KeyError + # in Reporter.py when trying to index it's 'rc' record + if os_status not in (PASS, FAIL, XFAIL, SKIP): + logger.error("Changing os_status from %d to FAIL", os_status) + os_status = FAIL + testsuite.print_results(test['group'], test['test'], os_status, output) exec_time = end_time - start_time @@ -282,6 +292,11 @@ def main(options, args): if options.print_exec_time: print_exec_time(testsuite, exec_time, " Test execution time:") + # Give ourselves a 3 second pause before running the next + # test to help ensure we have cleaned things up properly just + # in case the cimserver is a little slow to respond + sleep(3) + testsuite.debug("%s\n" % div) if options.print_exec_time: -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 07:15:00 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 07:15:00 +0000 Subject: [Libvirt-cim] [PATCH 7/9] Resolve issues found in test. In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang 1. Use a MAC that isn't a multicast MAC. 2. Error messages changed in libvirt "0.9.8", so we need to account for that --- .../19_definenetwork_ers.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index ad7c1ce..4cda327 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -37,7 +37,7 @@ from XenKvmLib.xm_virt_util import virsh_version sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) @@ -89,11 +89,16 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: + logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network - expected_values['invalid']['bridge'] = " Failed to add tap "\ - "interface to bridge" + if libvirt_version >= "0.9.8": + expected_values['invalid']['bridge'] = "Cannot get interface "\ + "MTU on 'invalid'" + else: + expected_values['invalid']['bridge'] = " Failed to add tap "\ + "interface to bridge" tc_scen = { @@ -114,7 +119,8 @@ def main(): status = PASS for nettype in nettypes: for tc, field in tc_scen.iteritems(): - logger.error("DEBUG nettype is %s, field is %s, tc is %s", nettype, field, tc) + logger.error("DEBUG nettype is %s, field is %s, tc is %s", + nettype, field, tc) cxml = vxml.get_class(options.virt)(default_dom, mac=nmac, ntype=nettype, net_name=field) @@ -122,7 +128,7 @@ def main(): try: ret = cxml.cim_define(options.ip) - if not ret: + if not ret: status = verify_error(exp_rc, exp_desc, cxml) if status != PASS: # There are few libvirt version between 0.7.0 @@ -138,7 +144,7 @@ def main(): cxml.err_rc, cxml.err_desc)) continue ret = cxml.cim_start(options.ip) - if ret: + if ret: status = verify_error(exp_rc, exp_desc, cxml) cxml.undefine(options.ip) if status != PASS: -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 07:16:43 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 07:16:43 +0000 Subject: [Libvirt-cim] [PATCH 8/9] On Fedora systems default to using 'em1' instead of 'eth1' In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang Fedora changed the default device naming scheme, see http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming So if we're running on Fedora, let's "default" to "em1" although that doesn't guarantee that we will find what we're looking for. This code probably needs some mechanism to detect with interfaces are available, then query those interfaces to find one that supports the feature we want. --- .../27_definesystem_macvtap_dev.py | 19 ++++++++++++++++++- .../28_definesystem_with_vsi_profile.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py index 8c20781..36bf52f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py @@ -32,6 +32,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -101,6 +102,7 @@ def verify_net_rasd(ip, virt, target_dev, source_dev, guest_name): @do_main(sup_types) def main(): options = main.options + server = options.ip status = FAIL @@ -113,7 +115,22 @@ def main(): cxml = get_class(options.virt)(test_dom) target_dev = "vepa" - source_dev = "eth1" + + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + source_dev = "em1" + else: + source_dev = "eth1" guest_defined = False diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py index d14dda3..2b108f9 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py @@ -35,6 +35,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -173,6 +174,20 @@ def main(): 'VSITypeIDVersion' : "1" } + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + vsi_defaults['SourceDevice'] = "em1" + nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') status = FAIL cxml = None -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Wed Apr 24 07:17:46 2013 From: cngesaint at outlook.com (WangXu) Date: Wed, 24 Apr 2013 07:17:46 +0000 Subject: [Libvirt-cim] [PATCH 9/9] 19 - resolve issues found in test In-Reply-To: References: Message-ID: Reviewed-by: Xu Wang --- .../cimtest/VirtualSystemManagementService/19_definenetwork_ers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index 4cda327..cf461d1 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -89,7 +89,6 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: - logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network -- 1.8.1.4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jferlan at redhat.com Wed Apr 24 14:09:02 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:02 -0400 Subject: [Libvirt-cim] [PATCH v2 00/12] cimtest updates Message-ID: <1366812554-6591-1-git-send-email-jferlan@redhat.com> This is primarily a repost of the previous series: https://www.redhat.com/archives/libvirt-cim/2013-March/msg00051.html and https://www.redhat.com/archives/libvirt-cim/2013-April/msg00014.html The primary difference in this patch vs. the previous sets is to fix the version string checking for nfs server checking in common_util.py and to add patch 12/12 which handles a problem in 'enum_volumes()' in pool.py. I assume patches 1-4 and 6-9 were reviewed without issue. So focus on 5/12 and 10-12/12. John Ferlan (12): Need to check "slp=true", not just "slp" since "slp=false" is possible Change the MAC from "99:" to "88:" Create a temporary directory for disk pool tests Use symbols as named in libvirt-cim for easier reference Fix nfs-server lookup code Fix os_status passing to reporter functions Resolve issues found in test. On Fedora systems default to using 'em1' instead of 'eth1' 19 - resolve issues found in test vxml: Add which volume could not be found to error message Add and utilize virsh_version_cmp pool: Need to handle when there are no volumes in the default pool .../Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- .../08_CreateDiskResourcePool.py | 30 +++++-- .../09_DeleteDiskPool.py | 19 +++-- .../10_create_storagevolume.py | 6 +- .../11_create_dir_storagevolume_errs.py | 5 +- .../12_create_netfs_storagevolume_errs.py | 5 +- .../13_delete_storagevolume.py | 5 +- .../14_delete_storagevolume_errs.py | 5 +- .../15_DiskPoolAutostart.py | 15 +++- .../SettingsDefineCapabilities/01_forward.py | 1 - .../libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../06_addresource.py | 2 +- .../08_modifyresource.py | 4 +- .../13_refconfig_additional_devs.py | 4 +- .../15_mod_system_settings.py | 11 ++- .../18_define_sys_bridge.py | 2 +- .../19_definenetwork_ers.py | 23 +++--- .../22_addmulti_brg_interface.py | 2 +- .../27_definesystem_macvtap_dev.py | 19 ++++- .../28_definesystem_with_vsi_profile.py | 15 ++++ suites/libvirt-cim/lib/XenKvmLib/common_util.py | 93 +++++++++++++++++----- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +- suites/libvirt-cim/lib/XenKvmLib/pool.py | 10 +-- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 10 ++- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 +- suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py | 6 ++ suites/libvirt-cim/main.py | 15 ++++ 28 files changed, 237 insertions(+), 86 deletions(-) -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:03 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:03 -0400 Subject: [Libvirt-cim] [PATCH v2 01/12] Need to check "slp=true", not just "slp" since "slp=false" is possible In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-2-git-send-email-jferlan@redhat.com> --- .../libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py index f6cf5b1..f08d157 100644 --- a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py +++ b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py @@ -64,7 +64,7 @@ def get_slp_info(server): logger.info("Test not supported for sfcb yet ... hence skipping") return SKIP - cmd = "cimconfig -l -p | grep slp" + cmd = "cimconfig -l -p | grep slp=true" rc, out = run_remote(server, cmd) if rc != 0: logger.error("SLP is not enabled for the cimserver on '%s'", server) -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:06 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:06 -0400 Subject: [Libvirt-cim] [PATCH v2 04/12] Use symbols as named in libvirt-cim for easier reference In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-5-git-send-email-jferlan@redhat.com> --- .../VirtualSystemManagementService/15_mod_system_settings.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py index e576fca..0be3ae0 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/15_mod_system_settings.py @@ -37,7 +37,10 @@ from XenKvmLib.xm_virt_util import domain_list, active_domain_list, \ sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'rstest_domain' cpu = 2 -RECOVERY_VAL = 3 +# AutomaticRecoveryAction +NONE_VAL = 2 +RESTART_VAL = 3 + DEFINED_STATE = 3 bug = "00008" f9_bug = "00010" @@ -113,7 +116,7 @@ def main(): raise Expcetion("Failed to get the VSSD instance for %s" % \ default_dom) - val = pywbem.cim_types.Uint16(RECOVERY_VAL) + val = pywbem.cim_types.Uint16(RESTART_VAL) inst['AutomaticRecoveryAction'] = val vssd = inst_to_mof(inst) @@ -135,9 +138,9 @@ def main(): raise Exception("Failed to get the VSSD instance for %s" % \ default_dom) - if inst.AutomaticRecoveryAction != RECOVERY_VAL: + if inst.AutomaticRecoveryAction != RESTART_VAL: logger.error("Exp AutomaticRecoveryAction=%d, got %d", - RECOVERY_VAL, inst.AutomaticRecoveryAction) + RESTART_VAL, inst.AutomaticRecoveryAction) raise Exception("%s not updated properly" % default_dom) status = PASS -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:04 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:04 -0400 Subject: [Libvirt-cim] [PATCH v2 02/12] Change the MAC from "99:" to "88:" In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-3-git-send-email-jferlan@redhat.com> Using a MAC starting with "99:" is not legal. That ends up being a Multicast Address since the low order bit of the first byte of the address (in hex) is one. That is "99" is 0x10011001" in hex, where the least significant bit is a "1" (one) indicating a multicast. --- suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- .../cimtest/VirtualSystemManagementService/06_addresource.py | 2 +- .../cimtest/VirtualSystemManagementService/08_modifyresource.py | 4 ++-- .../VirtualSystemManagementService/13_refconfig_additional_devs.py | 4 ++-- .../cimtest/VirtualSystemManagementService/18_define_sys_bridge.py | 2 +- .../VirtualSystemManagementService/22_addmulti_brg_interface.py | 2 +- suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py index c5d8a22..be82335 100644 --- a/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py +++ b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py @@ -40,7 +40,7 @@ from XenKvmLib.const import get_provider_version sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] default_dom = 'uuid_domain' test_dom = 'test_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' duplicate_uuid_support = 915 def get_vssd(ip, virt, dom): diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py index fdcb84a..ac18c69 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py @@ -38,7 +38,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'rstest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' ntype = 'network' npool_name = default_network_name + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py index df58d1f..a7c3871 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py @@ -43,9 +43,9 @@ cpu = 2 ncpu = 1 nmem = 131072 new_int = randint(10, 99) -new_mac1 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac1 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) new_int += 1 -new_mac2 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) +new_mac2 = "88:%s:22:%s:33:%s" % (new_int, new_int, new_int) def cleanup_env(ip, cxml): cxml.destroy(ip) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py index 6274527..a47db8f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/13_refconfig_additional_devs.py @@ -38,8 +38,8 @@ from XenKvmLib.vxml import get_class sup_types = ['Xen', 'XenFV', 'KVM'] test_dom = 'rstest_domain' test_dom2 = 'rstest_domain2' -mac1 = '99:aa:bb:cc:ee:ff' -mac2 = '99:aa:bb:cc:ee:aa' +mac1 = '88:aa:bb:cc:ee:ff' +mac2 = '88:aa:bb:cc:ee:aa' REQUESTED_STATE = 2 TIME = "00000000000000.000000:000" diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py index e02de29..66b3e45 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/18_define_sys_bridge.py @@ -32,7 +32,7 @@ from XenKvmLib.common_util import create_netpool_conf, destroy_netpool sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py index 9abb21b..36d1873 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/22_addmulti_brg_interface.py @@ -36,7 +36,7 @@ sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "my_domain1" default_net = "my_network0" test_net = "my_network1" -test_mac = '99:aa:bb:cc:ee:ff' +test_mac = '88:aa:bb:cc:ee:ff' default_mac = "00:11:33:33:44:55" ntype = 'bridge' default_brg = 'mybr0' diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py b/suites/libvirt-cim/lib/XenKvmLib/const.py index 6dea644..6701d36 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/const.py +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py @@ -80,7 +80,7 @@ Xen_init_path = os.path.join(_image_dir, 'default-xen-initrd') Xen_disk_path = os.path.join(_image_dir, 'default-xen-dimage') Xen_secondary_disk_path = os.path.join(_image_dir, 'default-xen-dimage.2ND') Xen_default_disk_dev = 'xvda' -Xen_default_mac = '11:22:33:aa:bb:cc' +Xen_default_mac = '88:22:33:aa:bb:cc' # vxml.KVMXML KVM_default_emulator = '/usr/bin/qemu-system-x86_64' @@ -88,7 +88,7 @@ KVM_disk_path = os.path.join(_image_dir, 'default-kvm-dimage') KVM_secondary_disk_path = os.path.join(_image_dir, 'default-kvm-dimage.2ND') KVM_default_disk_dev = 'hda' KVM_default_cdrom_dev = 'hdc' -KVM_default_mac = '11:22:33:aa:bb:cc' +KVM_default_mac = '88:22:33:aa:bb:cc' # vxml.XenFVXML s, o = platform.architecture() @@ -109,7 +109,7 @@ LXC_default_emulator = '/usr/libexec/libvirt_lxc' LXC_default_tty = '/dev/ptmx' LXC_default_mp = '/tmp' LXC_default_source = '/var/lib/libvirt/images/lxc_files' -LXC_default_mac = '11:22:33:aa:bb:cc' +LXC_default_mac = '88:22:33:aa:bb:cc' LXC_netns_support = False parser = OptionParser() diff --git a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py index b32ae4c..914dbb0 100755 --- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py @@ -42,7 +42,7 @@ kernel_path = os.path.join(image_dir, 'default-xen-kernel') init_path = os.path.join(image_dir, 'default-xen-initrd') disk_path = os.path.join(image_dir, 'default-xen-dimage') -default_mac = '11:22:33:aa:bb:cc' +default_mac = '88:22:33:aa:bb:cc' def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, disk_file_path = disk_path, disk = "xvda"): -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:05 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:05 -0400 Subject: [Libvirt-cim] [PATCH v2 03/12] Create a temporary directory for disk pool tests In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-4-git-send-email-jferlan@redhat.com> We cannot have two storage pools referencing the same path. Since the cimtest-diskpool is already created at /var/lib/libvirt/images, we'll use that (e.g. _image_dir symbol) to create a subdirectory for the test. We'll also delete that directory when we're done. --- .../08_CreateDiskResourcePool.py | 26 +++++++++++++++++----- .../09_DeleteDiskPool.py | 19 +++++++++++----- .../15_DiskPoolAutostart.py | 11 ++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py index c82b5b0..636f59c 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py @@ -48,6 +48,7 @@ # -Date: 26.05.2009 import sys +import os from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version from CimTest.ReturnCodes import FAIL, PASS, SKIP @@ -55,8 +56,9 @@ from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class from XenKvmLib.common_util import destroy_diskpool, nfs_netfs_setup, \ netfs_cleanup -from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool -from XenKvmLib.const import get_provider_version +from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool, \ + DIR_POOL, NETFS_POOL +from XenKvmLib.const import get_provider_version, _image_dir libvirt_disk_pool_support=837 libvirt_netfs_pool_support=869 @@ -94,19 +96,20 @@ def main(): curr_cim_rev, changeset = get_provider_version(virt, server) if curr_cim_rev >= libvirt_disk_pool_support: - dp_types["DISK_POOL_DIR"] = 1 + dp_types["DISK_POOL_DIR"] = DIR_POOL if curr_cim_rev >= libvirt_netfs_pool_support: - dp_types["DISK_POOL_NETFS"] = 3 + dp_types["DISK_POOL_NETFS"] = NETFS_POOL if len(dp_types) == 0 : - logger.info("No disk pool types in list , hence skipping the test...") + logger.info("No disk pool types in list, hence skipping the test...") return SKIP status = FAIL pool_attr = None # For now the test case support only the creation of # dir type disk pool, netfs later change to fs and disk pooltypes etc - for key, value in dp_types.iteritems(): + for key, value in dp_types.iteritems(): + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key @@ -115,6 +118,15 @@ def main(): if status != PASS: return FAIL + # Cannot have two pools that use the same location/path, so + # since cimtest-diskpool already exists + if key == 'DISK_POOL_DIR': + path = os.path.join(_image_dir, 'temppool') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr["Path"] = path + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -152,6 +164,8 @@ def main(): if key == 'DISK_POOL_NETFS': netfs_cleanup(server, pool_attr) + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py index 31e3f22..8bd15e2 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/09_DeleteDiskPool.py @@ -44,6 +44,7 @@ # -Date: 26.05.2009 import sys +import os import pywbem from XenKvmLib import rpcs_service from CimTest.Globals import logger @@ -88,13 +89,17 @@ def main(): elif curr_cim_rev >= libvirt_cim_child_pool_rev: + del_path = False try: - pool_attr = { "Path" : _image_dir } + path = os.path.join(_image_dir, 'deltest') + if not os.path.exists(path): + os.mkdir(path) + del_path = True + pool_attr = { "Path" : path } status = create_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool", mode_type=TYPE) if status != PASS: - logger.error("Failed to create diskpool '%s'", test_pool) - return status + raise Exception("Failed to create diskpool '%s'" % test_pool) status = verify_pool(server, virt, test_pool, pool_attr, pool_type="DiskPool") @@ -112,8 +117,8 @@ def main(): break if pool_settings == None: - logger.error("Failed to get poolsettings for '%s'", test_pool) - return FAIL + raise Exception("Failed to get poolsettings for '%s'" \ + % test_pool) rpcs_conn.DeleteResourcePool(Pool = pool_settings) pool = EnumInstances(server, dp) @@ -127,8 +132,10 @@ def main(): logger.error("Exception details: %s", details) destroy_diskpool(server, virt, test_pool) undefine_diskpool(server, virt, test_pool) - return FAIL + status = FAIL + if del_path: + os.rmdir(path) return status if __name__ == "__main__": diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py index b6b758c..b7e72a8 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py @@ -23,6 +23,7 @@ # -Date: 04.14.2011 import sys +import os from pywbem import cim_types from CimTest.Globals import logger from XenKvmLib.xm_virt_util import virsh_version @@ -77,12 +78,17 @@ def main(): pool_attr = None key = 'DISK_POOL_DIR' value = 1 + del_path = False try: logger.info("Verifying '%s'.....", key) test_pool = key - pool_attr = { "Path" : "/var/lib/libvirt/images", + pool_attr = { "Path" : "/var/lib/libvirt/images/autotest", "Autostart" : cim_types.Uint16(1) } + if not os.path.exists(pool_attr["Path"]): + os.mkdir(pool_attr["Path"]) + del_path = True + status = create_pool(server, virt, test_pool, pool_attr, mode_type=value, pool_type= "DiskPool") @@ -112,6 +118,9 @@ def main(): status = FAIL logger.error("Exception details: %s", details) + if del_path: + os.rmdir(pool_attr["Path"]) + return status if __name__ == "__main__": -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:09 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:09 -0400 Subject: [Libvirt-cim] [PATCH v2 07/12] Resolve issues found in test. In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-8-git-send-email-jferlan@redhat.com> 1. Use a MAC that isn't a multicast MAC. 2. Error messages changed in libvirt "0.9.8", so we need to account for that --- .../19_definenetwork_ers.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index ad7c1ce..4cda327 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -37,7 +37,7 @@ from XenKvmLib.xm_virt_util import virsh_version sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' -nmac = '99:aa:bb:cc:ee:ff' +nmac = '88:aa:bb:cc:ee:ff' npool_name = default_network_name + str(random.randint(1, 100)) brg_name = "br" + str(random.randint(1, 100)) @@ -89,11 +89,16 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: + logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network - expected_values['invalid']['bridge'] = " Failed to add tap "\ - "interface to bridge" + if libvirt_version >= "0.9.8": + expected_values['invalid']['bridge'] = "Cannot get interface "\ + "MTU on 'invalid'" + else: + expected_values['invalid']['bridge'] = " Failed to add tap "\ + "interface to bridge" tc_scen = { @@ -114,7 +119,8 @@ def main(): status = PASS for nettype in nettypes: for tc, field in tc_scen.iteritems(): - logger.error("DEBUG nettype is %s, field is %s, tc is %s", nettype, field, tc) + logger.error("DEBUG nettype is %s, field is %s, tc is %s", + nettype, field, tc) cxml = vxml.get_class(options.virt)(default_dom, mac=nmac, ntype=nettype, net_name=field) @@ -122,7 +128,7 @@ def main(): try: ret = cxml.cim_define(options.ip) - if not ret: + if not ret: status = verify_error(exp_rc, exp_desc, cxml) if status != PASS: # There are few libvirt version between 0.7.0 @@ -138,7 +144,7 @@ def main(): cxml.err_rc, cxml.err_desc)) continue ret = cxml.cim_start(options.ip) - if ret: + if ret: status = verify_error(exp_rc, exp_desc, cxml) cxml.undefine(options.ip) if status != PASS: -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:08 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:08 -0400 Subject: [Libvirt-cim] [PATCH v2 06/12] Fix os_status passing to reporter functions In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-7-git-send-email-jferlan@redhat.com> If the status returned is an errno value, then os_status will be set outside of the bounds of the 'rc' array in Reporter.py which will cause a KeyError exception. Find, message, and adjust - we're failing anyway. --- suites/libvirt-cim/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/suites/libvirt-cim/main.py b/suites/libvirt-cim/main.py index a4e33e6..e5f3526 100644 --- a/suites/libvirt-cim/main.py +++ b/suites/libvirt-cim/main.py @@ -23,12 +23,14 @@ # from time import time +from time import sleep from optparse import OptionParser import os import sys sys.path.append('../../lib') import TestSuite from CimTest.Globals import logger, log_param +from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP import commands from VirtLib import groups import ConfigParser @@ -274,6 +276,14 @@ def main(options, args): os_status = os.WEXITSTATUS(status) + # status should be from our test; however, if there's an OS level + # failure, it could be set to errno. But that's included in our + # output, so just set it to FAIL; otherwise, we get a KeyError + # in Reporter.py when trying to index it's 'rc' record + if os_status not in (PASS, FAIL, XFAIL, SKIP): + logger.error("Changing os_status from %d to FAIL", os_status) + os_status = FAIL + testsuite.print_results(test['group'], test['test'], os_status, output) exec_time = end_time - start_time @@ -282,6 +292,11 @@ def main(options, args): if options.print_exec_time: print_exec_time(testsuite, exec_time, " Test execution time:") + # Give ourselves a 3 second pause before running the next + # test to help ensure we have cleaned things up properly just + # in case the cimserver is a little slow to respond + sleep(3) + testsuite.debug("%s\n" % div) if options.print_exec_time: -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:07 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:07 -0400 Subject: [Libvirt-cim] [PATCH v2 05/12] Fix nfs-server lookup code In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-6-git-send-email-jferlan@redhat.com> The 'get_nfs_bin()', 'nfs_config()', and 'nfs_netfs_setup()' API's needed adjustment to handle using systemd rather than looking for /etc/init.d/nfs --- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 84 ++++++++++++++++++++----- 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index f145811..9305c5e 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -493,27 +493,72 @@ def parse_instance_id(instid): def get_nfs_bin(server): cmd = 'cat /etc/issue | grep -v ^$ | egrep "Red Hat|Fedora"' rc, out = utils.run_remote(server, cmd) + is_systemd = 0 if rc != 0: #SLES nfs_server_bin = "/etc/init.d/nfsserver" else: + # Default, but allow it to be changed nfs_server_bin = "/etc/init.d/nfs" - return nfs_server_bin - -def nfs_config(server, nfs_server_bin): - cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + # Check for 'systemd' being used + # Fedora 15 seems to have been the first place this was the default + # RHEL 7 and beyond will also use the mechanism. + # Since 'out' returns the fetched string, let's parse it a bit more + # looking for the number after the string 'release' which happens to + # be the version. + # + # On Fedora systems it's + # + # "Fedora release 18 (Spherical Cow)" + # + # while on RHEL systems it's: + # + # "Red Hat Enterprise Linux Server release 6.4 (Santiago)" + # + # This nasty thing finds 'release ' in the line, splits there and + # then uses index [1] as the point of reference of the version number + # string to split again in order to return index [0] as a string + # representation of the OS version. + # + vers_str = out.split('release ')[1].split()[0] + if 'Fedora' in out and int(vers_str) >= 15 or \ + 'Red Hat' in out and float(vers_str) >= 7.0: + # Handle this differently - the command would be + # "systemctl {start|restart|status} nfs" + nfs_server_bin = "systemctl %s nfs" + is_systemd = 1 + + return nfs_server_bin, is_systemd + +def nfs_config(server, nfs_server_bin, is_systemd): + if is_systemd == 0: + cmd = "ps aux | grep -v -e nfsiod -e grep | grep nfsd" + 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 rc != PASS : # Check if NFS server is installed ... - if not os.path.exists(nfs_server_bin): - logger.error("NFS server '%s' does not seem to be installed "\ - "on '%s'", nfs_server_bin, server) - return SKIP + if is_systemd == 0: + if not os.path.exists(nfs_server_bin): + logger.error("NFS server '%s' does not seem to be installed "\ + "on '%s'", nfs_server_bin, server) + return SKIP + else: + # Works on Fedora and RHEL6 + cmd = "rpm -q nfs-utils" + rc, out = utils.run_remote(server, cmd) + if rc != PASS : + logger.error("NFS server package nfs-utils does not seem "\ + "to be installed on '%s'", server) + return SKIP # Start the nfs server ... - nfs_server_cmd = "%s start" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s start" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "start" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not start the nfsserver on '%s'", server) @@ -573,13 +618,16 @@ def netfs_cleanup(server, pool_attr): move_file(back_exports_file, exports_file) # restart the nfs server - nfs_server_bin = get_nfs_bin(server) - nfs_server_cmd = "%s restart" % nfs_server_bin + nfs_server_bin, is_systemd = get_nfs_bin(server) + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: logger.error("Could not restart NFS server on '%s'" % server) -def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): +def netfs_config(server, nfs_server_bin, dest_dir_to_mnt, is_systemd): src_dir_for_mnt = mkdtemp() try: @@ -601,7 +649,10 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): % (src_dir_for_mnt, dest_dir_to_mnt)) # Restart the nfs server.... - nfs_server_cmd = "%s restart" % nfs_server_bin + if is_systemd == 0: + nfs_server_cmd = "%s restart" % nfs_server_bin + else: + nfs_server_cmd = nfs_server_bin % "restart" rc, out = utils.run_remote(server, nfs_server_cmd) if rc != PASS: raise Exception("Could not restart NFS server on '%s'" % server) @@ -615,12 +666,12 @@ def netfs_config(server, nfs_server_bin, dest_dir_to_mnt): return PASS, src_dir_for_mnt def nfs_netfs_setup(server): - nfs_server_bin = get_nfs_bin(server) + nfs_server_bin, is_systemd = get_nfs_bin(server) dest_dir = mkdtemp() # Before going ahead verify that nfs server is available on machine.. - ret = nfs_config(server, nfs_server_bin) + ret = nfs_config(server, nfs_server_bin, is_systemd) if ret != PASS: logger.error("Failed to configure NFS on '%s'", server) logger.info("Trying to look for nfs mounted dir on '%s'...", server) @@ -631,7 +682,8 @@ def nfs_netfs_setup(server): else: return PASS, server, src_dir, dest_dir else: - ret, src_dir = netfs_config(server, nfs_server_bin, dest_dir) + ret, src_dir = netfs_config(server, nfs_server_bin, \ + dest_dir, is_systemd) if ret != PASS: logger.error("Failed to configure netfs on '%s'", server) return ret, None, None, None -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:12 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:12 -0400 Subject: [Libvirt-cim] [PATCH v2 10/12] vxml: Add which volume could not be found to error message In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-11-git-send-email-jferlan@redhat.com> --- suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py index 51a4166..82ab501 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py @@ -921,7 +921,7 @@ class KVMXML(VirtXML, VirtCIM): port_num='-1', keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): - logger.error('Error: Disk image does not exist') + logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'KVM', test_dom, uuid, pae, acpi, apic, disk, @@ -984,7 +984,7 @@ class XenFVXML(VirtXML, VirtCIM): keymap="en-us", irstype="mouse", btype="ps2", vnc_passwd=None): if not os.path.exists(disk_file_path): - logger.error('Error: Disk image does not exist') + logger.error('Error: Disk image %s does not exist', disk_file_path) sys.exit(1) VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus) VirtCIM.__init__(self, 'XenFV', test_dom, uuid, pae, acpi, apic, disk, -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:11 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:11 -0400 Subject: [Libvirt-cim] [PATCH v2 09/12] 19 - resolve issues found in test In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-10-git-send-email-jferlan@redhat.com> --- .../cimtest/VirtualSystemManagementService/19_definenetwork_ers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index 4cda327..cf461d1 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -89,7 +89,6 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: - logger.error('DEBUG libvirt_version=%s', libvirt_version) if libvirt_version >= "0.7.0": expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:14 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:14 -0400 Subject: [Libvirt-cim] [PATCH v2 12/12] pool: Need to handle when there are no volumes in the default pool In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-13-git-send-email-jferlan@redhat.com> Failing test: HostSystem - 03_hs_to_settdefcap.py: FAIL ERROR - Failed to get associatornames according to KVM_AllocationCapabilities ERROR - Exception: list index out of range Investigation discovered that 'enum_volumes()' was not properly handling the case where there were no volumes in 'DiskPool/default'. Also function cannot return 'None' as caller 'get_exp_disk_rasd_len' assumed integer return value and attempted a multiplication resulting in an exception. --- suites/libvirt-cim/lib/XenKvmLib/pool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py index 1a57aba..ddbe532 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py @@ -110,8 +110,8 @@ def enum_volumes(virt, server, pooln=default_pool_name): cmd = 'virsh -c %s vol-list %s 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ (virt2uri(virt), pooln) ret, out = run_remote(server ,cmd) - if ret != 0: - return None + if ret != 0 or len(out) == 0: + return volume lines = out.split("\n") for line in lines: vol = line.split()[0] -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:10 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:10 -0400 Subject: [Libvirt-cim] [PATCH v2 08/12] On Fedora systems default to using 'em1' instead of 'eth1' In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-9-git-send-email-jferlan@redhat.com> Fedora changed the default device naming scheme, see http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming So if we're running on Fedora, let's "default" to "em1" although that doesn't guarantee that we will find what we're looking for. This code probably needs some mechanism to detect with interfaces are available, then query those interfaces to find one that supports the feature we want. --- .../27_definesystem_macvtap_dev.py | 19 ++++++++++++++++++- .../28_definesystem_with_vsi_profile.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py index 8c20781..36bf52f 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py @@ -32,6 +32,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -101,6 +102,7 @@ def verify_net_rasd(ip, virt, target_dev, source_dev, guest_name): @do_main(sup_types) def main(): options = main.options + server = options.ip status = FAIL @@ -113,7 +115,22 @@ def main(): cxml = get_class(options.virt)(test_dom) target_dev = "vepa" - source_dev = "eth1" + + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + source_dev = "em1" + else: + source_dev = "eth1" guest_defined = False diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py index d14dda3..2b108f9 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py @@ -35,6 +35,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL +from VirtLib import utils from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import get_default_rasds from XenKvmLib.const import do_main, get_provider_version @@ -173,6 +174,20 @@ def main(): 'VSITypeIDVersion' : "1" } + # Fedora changed the default device naming scheme, see + # http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming + # + # So if we're running on Fedora, let's "default" to "em1" although that + # doesn't guarantee that we will find what we're looking for. This code + # probably needs some mechanism to detect with interfaces are available, + # then query those interfaces to find one that supports the feature we + # want. If not are found and XFAIL could be generated indicating so. + # + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Fedora"' + rc, out = utils.run_remote(server, cmd) + if rc == 0: + vsi_defaults['SourceDevice'] = "em1" + nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') status = FAIL cxml = None -- 1.8.1.4 From jferlan at redhat.com Wed Apr 24 14:09:13 2013 From: jferlan at redhat.com (John Ferlan) Date: Wed, 24 Apr 2013 10:09:13 -0400 Subject: [Libvirt-cim] [PATCH v2 11/12] Add and utilize virsh_version_cmp In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: <1366812554-6591-12-git-send-email-jferlan@redhat.com> The string version comparisons failed when determining if "0.10.2" was a greater version than "0.4.1" (and other similar checks). Needed to create a version comparison method that did the right thing. Also, not change to 12_create_netfs_storagevolume_errs.py to use "or" logic rather than "and" logic on comparison. Other tests within the family use "or" logic. --- .../08_CreateDiskResourcePool.py | 4 ++-- .../10_create_storagevolume.py | 6 ++++-- .../11_create_dir_storagevolume_errs.py | 5 +++-- .../12_create_netfs_storagevolume_errs.py | 5 +++-- .../13_delete_storagevolume.py | 5 +++-- .../14_delete_storagevolume_errs.py | 5 +++-- .../ResourcePoolConfigurationService/15_DiskPoolAutostart.py | 4 ++-- .../cimtest/SettingsDefineCapabilities/01_forward.py | 1 - .../VirtualSystemManagementService/19_definenetwork_ers.py | 8 ++++---- suites/libvirt-cim/lib/XenKvmLib/common_util.py | 9 +++++---- suites/libvirt-cim/lib/XenKvmLib/pool.py | 6 +++--- suites/libvirt-cim/lib/XenKvmLib/rasd.py | 10 ++++++---- suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py | 6 ++++++ 13 files changed, 44 insertions(+), 30 deletions(-) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py index 636f59c..b5ec5dc 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py @@ -50,7 +50,7 @@ import sys import os from CimTest.Globals import logger -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class @@ -89,7 +89,7 @@ def main(): dp_types = { } libvirt_version = virsh_version(server, virt) - if libvirt_version < "0.4.1": + if virsh_version_cmp(libvirt_version, "0.4.1") < 0: logger.info("Storage pool creation support is available in Libvirt " "version >= 0.4.1 , hence skipping the test....") return SKIP diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py index 511463b..3b0673f 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py @@ -38,7 +38,8 @@ from XenKvmLib.rasd import libvirt_rasd_storagepool_changes from XenKvmLib import rpcs_service from XenKvmLib.assoc import Associators from XenKvmLib.enumclass import GetInstance, EnumNames -from XenKvmLib.xm_virt_util import virsh_version, vol_list, vol_delete +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp, \ + vol_list, vol_delete from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.common_util import destroy_diskpool from XenKvmLib.pool import create_pool, undefine_diskpool, DIR_POOL @@ -186,7 +187,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py index 76e1e8f..318cfa8 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/11_create_dir_storagevolume_errs.py @@ -36,7 +36,7 @@ from CimTest.Globals import logger from XenKvmLib import rpcs_service from pywbem.cim_types import Uint64 from pywbem import CIM_ERR_FAILED, CIMError -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.rasd import libvirt_rasd_storagepool_changes @@ -125,7 +125,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py index 004af9f..215727f 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/12_create_netfs_storagevolume_errs.py @@ -36,7 +36,7 @@ from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup, get_provider_version from XenKvmLib.rasd import libvirt_rasd_storagepool_changes from XenKvmLib import rpcs_service -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.classes import get_typed_class, inst_to_mof from XenKvmLib.common_util import nfs_netfs_setup, netfs_cleanup from XenKvmLib.pool import create_pool, NETFS_POOL, get_diskpool, \ @@ -123,7 +123,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" and cim_rev < libvirt_rasd_storagepool_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_storagepool_changes: logger.info("Storage Volume creation support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_storagepool_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py index d7a6365..3578532 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/13_delete_storagevolume.py @@ -29,7 +29,7 @@ import sys from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS, SKIP -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.const import do_main, platform_sup, get_provider_version, \ default_pool_name, _image_dir from XenKvmLib import rpcs_service @@ -50,7 +50,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_spool_del_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_spool_del_changes: logger.info("Storage Volume deletion support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_spool_del_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py index 9e33215..d7ed5ad 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/14_delete_storagevolume_errs.py @@ -33,7 +33,7 @@ from VirtLib import utils from CimTest.Globals import logger from pywbem import CIM_ERR_FAILED, CIM_ERR_INVALID_PARAMETER, CIMError from CimTest.ReturnCodes import FAIL, PASS, SKIP -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.const import do_main, platform_sup, get_provider_version,\ default_pool_name, _image_dir from XenKvmLib import rpcs_service @@ -119,7 +119,8 @@ def main(): libvirt_ver = virsh_version(server, virt) cim_rev, changeset = get_provider_version(virt, server) - if libvirt_ver < "0.4.1" or cim_rev < libvirt_rasd_spool_del_changes: + if virsh_version_cmp(libvirt_ver, "0.4.1") < 0 or \ + cim_rev < libvirt_rasd_spool_del_changes: logger.info("Storage Volume deletion support is available with Libvirt" "version >= 0.4.1 and Libvirt-CIM rev '%s'", libvirt_rasd_spool_del_changes) diff --git a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py index b7e72a8..3cf6321 100644 --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/15_DiskPoolAutostart.py @@ -26,7 +26,7 @@ import sys import os from pywbem import cim_types from CimTest.Globals import logger -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from CimTest.ReturnCodes import FAIL, PASS, SKIP from XenKvmLib.const import do_main, platform_sup from XenKvmLib.classes import get_typed_class @@ -62,7 +62,7 @@ def main(): dp_types = { } libvirt_version = virsh_version(server, virt) - if libvirt_version < "0.4.1": + if virsh_version_cmp(libvirt_version, "0.4.1") < 0: logger.info("Storage pool creation support is available in Libvirt " "version >= 0.4.1 , hence skipping the test....") return SKIP diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py index 555e3c1..dd19ca0 100644 --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py @@ -57,7 +57,6 @@ import os from distutils.file_util import move_file from XenKvmLib import assoc from XenKvmLib import enumclass -from XenKvmLib.xm_virt_util import virsh_version from CimTest.ReturnCodes import PASS, FAIL, SKIP from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, \ CIM_ERROR_ASSOCIATORS diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py index cf461d1..19294db 100644 --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py @@ -33,7 +33,7 @@ from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS from XenKvmLib.const import default_network_name, do_main, get_provider_version from XenKvmLib.common_util import create_netpool_conf, destroy_netpool -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp sup_types = ['Xen', 'KVM', 'XenFV'] default_dom = 'brgtest_domain' @@ -71,7 +71,7 @@ def main(): libvirt_version = virsh_version(options.ip, options.virt) inv_empty_network = "Network not found" if options.virt == "Xen" or options.virt == "XenFV": - if libvirt_version <= "0.3.3": + if virsh_version_cmp(libvirt_version, "0.3.3") <= 0: inv_empty_network = "no network with matching name" inv_br_str = "POST operation failed: (xend.err 'Device 0 (vif) " + \ @@ -89,10 +89,10 @@ def main(): expected_values['invalid']['bridge'] = inv_br_str else: - if libvirt_version >= "0.7.0": + if virsh_version_cmp(libvirt_version, "0.7.0") >= 0: expected_values['empty']['network'] = inv_empty_network expected_values['invalid']['network'] = inv_empty_network - if libvirt_version >= "0.9.8": + if virsh_version_cmp(libvirt_version, "0.9.8") >= 0: expected_values['invalid']['bridge'] = "Cannot get interface "\ "MTU on 'invalid'" else: diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py index 9305c5e..f05fdc0 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py @@ -38,7 +38,8 @@ from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, \ CIM_ERROR_GETINSTANCE from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC, SKIP -from XenKvmLib.xm_virt_util import diskpool_list, virsh_version, net_list,\ +from XenKvmLib.xm_virt_util import diskpool_list, virsh_version,\ + virsh_version_cmp, net_list,\ domain_list, virt2uri, net_destroy from XenKvmLib.vxml import PoolXML, NetXML from VirtLib import utils @@ -308,7 +309,7 @@ def cleanup_restore(server, virt): # libvirt_version >= 0.4.1 # Hence Skipping the logic to delete the new conf file # and just returning PASS - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: return status try: if os.path.exists(back_disk_file): @@ -365,7 +366,7 @@ def create_diskpool(server, virt='KVM', dpool=default_pool_name, def create_diskpool_conf(server, virt, dpool=default_pool_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: status, dpoolname = create_diskpool(server, virt, dpool) diskid = "%s/%s" % ("DiskPool", dpoolname) else: @@ -376,7 +377,7 @@ def create_diskpool_conf(server, virt, dpool=default_pool_name): def destroy_diskpool(server, virt, dpool): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: if dpool == None: logger.error("No disk pool specified") return FAIL diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py index a5ca331..1a57aba 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py @@ -35,7 +35,7 @@ from XenKvmLib import rpcs_service import pywbem from CimTest.CimExt import CIMClassMOF from XenKvmLib.vxml import NetXML, PoolXML -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.vsms import RASD_TYPE_STOREVOL from XenKvmLib.common_util import destroy_diskpool @@ -183,7 +183,7 @@ def undefine_netpool(server, virt, net_name): def undefine_diskpool(server, virt, dp_name): libvirt_version = virsh_version(server, virt) - if libvirt_version >= '0.4.1': + if virsh_version_cmp(libvirt_version, '0.4.1') >= 0: if dp_name == None: return FAIL @@ -285,7 +285,7 @@ def verify_pool(server, virt, poolname, pool_attr_list, mode_type=0, ret_mode = net_xml.xml_get_netpool_mode() libvirt_version = virsh_version(server, virt) #Forward mode support was added in 0.4.2 - if libvirt_version >= '0.4.2': + if virsh_version_cmp(libvirt_version, '0.4.2') >= 0: if mode_type == 1 and ret_mode != "nat": logger.error("Error when verifying 'nat' type network") return FAIL diff --git a/suites/libvirt-cim/lib/XenKvmLib/rasd.py b/suites/libvirt-cim/lib/XenKvmLib/rasd.py index d65011e..4d4240a 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py @@ -31,7 +31,7 @@ from XenKvmLib.assoc import Associators from XenKvmLib.const import default_pool_name, default_network_name, \ get_provider_version, default_net_type from XenKvmLib.pool import enum_volumes -from XenKvmLib.xm_virt_util import virsh_version +from XenKvmLib.xm_virt_util import virsh_version, virsh_version_cmp from XenKvmLib.common_util import parse_instance_id pasd_cn = 'ProcResourceAllocationSettingData' @@ -81,7 +81,8 @@ def rasd_init_list(vsxml, virt, t_disk, t_dom, t_mac, t_mem, server): libvirt_version = virsh_version(server, virt) - if virt == 'LXC' or (virt == 'XenFV' and libvirt_version < "0.6.3"): + if virt == 'LXC' or (virt == 'XenFV' and \ + virsh_version_cmp(libvirt_version, "0.6.3") < 0): point_device = "%s/%s" %(t_dom, "mouse:usb") elif virt == 'Xen': point_device = "%s/%s" %(t_dom, "mouse:xen") @@ -357,7 +358,8 @@ def get_exp_disk_rasd_len(virt, ip, rev, id): rev < libvirt_rasd_new_changes: exp_len = exp_base_num + exp_cdrom - elif rev >= libvirt_rasd_dpool_changes and libvirt_ver >= '0.4.1': + elif rev >= libvirt_rasd_dpool_changes and \ + virsh_version_cmp(libvirt_ver, '0.4.1') >= 0: volumes = enum_volumes(virt, ip) if rev >= libvirt_rasd_floppy_changes: exp_len = ((volumes * exp_base_num) + \ @@ -383,7 +385,7 @@ def get_exp_disk_rasd_len(virt, ip, rev, id): exp_len = (volumes * exp_base_num) + exp_cdrom - if virt != 'LXC' and libvirt_ver >= '0.4.1': + if virt != 'LXC' and virsh_version_cmp(libvirt_ver, '0.4.1') >= 0: if rev >= libvirt_rasd_storagepool_changes: exp_len += exp_storagevol_rasd diff --git a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py index f365a54..7749fb7 100644 --- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py +++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # import os +import re from VirtLib import utils import socket from VirtLib.live import fv_cap @@ -223,6 +224,11 @@ def network_by_bridge(bridge, server, virt="Xen"): return None +def virsh_version_cmp(version1, version2): + def normalize(v): + return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")] + return cmp(normalize(version1), normalize(version2)) + def virsh_version(server, virt="KVM"): cmd = "virsh -c %s -v 2>/dev/null" % virt2uri(virt) ret, out = utils.run_remote(server, cmd) -- 1.8.1.4 From jferlan at redhat.com Thu Apr 25 16:42:29 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 25 Apr 2013 12:42:29 -0400 Subject: [Libvirt-cim] [PATCH 1/3] make force use qemu configurable In-Reply-To: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> Message-ID: <51795CF5.2050303@redhat.com> On 04/23/2013 05:30 AM, cngesaint at outlook.com wrote: > From: Wenchao Xia > > Since in nested KVM, libvirt-cim doesn't handle it well now, add > this option to make it run well with qemu wchi help development > and test. I think your commit message more simply stated is: Allow libvirt-cim to be supported within a nested KVM environment in order to more easily develop and test various configurations What happens if someone sets this in a non nested environment? I would think you'd want to test if the 'nested' property is set... > > Signed-off-by: Xu Wang > --- > libvirt-cim.conf | 8 ++++++++ > libxkutil/misc_util.c | 8 ++++++++ > libxkutil/misc_util.h | 1 + > src/Virt_VirtualSystemManagementService.c | 7 +++++++ > 4 files changed, 24 insertions(+), 0 deletions(-) > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > index 37d7b0f..3244ee3 100644 > --- a/libvirt-cim.conf > +++ b/libvirt-cim.conf > @@ -30,3 +30,11 @@ > # Default value: NULL, that is not set. > # > # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; > + > +# force_use_qemu (bool) > +# Since in nested KVM, libvirt-cim doesn't handler it well now, so add this > +# option to make it run well with qemu which help development and test. > +# Possible values: {true,false} > +# Default value: false > +# > +# force_use_qemu = false; I suggest using the comments from above here too... > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > index 00eb4b1..4c0b0a1 100644 > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -227,6 +227,14 @@ static int is_read_only(void) > return prop.value_bool; > } > > +bool get_force_use_qemu(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "force_use_qemu", CONFIG_BOOL, {0}, 0}; > + libvirt_cim_config_get(&prop); > + return prop.value_bool; > +} > + > const char *get_mig_ssh_tmp_key(void) > { > static LibvirtcimConfigProperty prop = { > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > index 0f52290..9e6b419 100644 > --- a/libxkutil/misc_util.h > +++ b/libxkutil/misc_util.h > @@ -154,6 +154,7 @@ int virt_set_status(const CMPIBroker *broker, > > /* get libvirt-cim config */ > const char *get_mig_ssh_tmp_key(void); > +bool get_force_use_qemu(void); > > /* > * Local Variables: > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index cbb646d..4e93ef0 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -394,6 +394,13 @@ static bool system_has_kvm(const char *pfx) > virConnectPtr conn; > char *caps = NULL; > bool kvm = false; > + bool force_use_qemu = get_force_use_qemu(); > + > + /* hack for nested KVM */ > + if (force_use_qemu) { > + CU_DEBUG("Enter force use qemu mode!"); > + return false; > + } The above check is being done on the "local" system right? While the following check is being done on the "BROKER" system, right? Which may not be the same as the "local" system? So where should the check of whether the system in which is executing libvirt-cim code be really made? IOW, are you sure this is the right place to check? What's the differentiation in libvirt-cim between QEMU & KVM being made for? Being "new" I thought they were the same. I'm not even convinced the routine is doing the right thing, but perhaps I just don't have enough history. I see a virsh capabilities on my system returns some kvm defs and some qemu defs, so a blind strstr is returning true... The prime differentiator is that the calling routine will set domain->type to QEMU now rather than KVM and I'm not sure I understand how by using that setting we'll be able support nested KVM. John > > conn = connect_by_classname(_BROKER, pfx, &s); > if ((conn == NULL) || (s.rc != CMPI_RC_OK)) { > From jferlan at redhat.com Thu Apr 25 17:05:51 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 25 Apr 2013 13:05:51 -0400 Subject: [Libvirt-cim] [PATCH 2/3] VSMS: tip error for invalid disk resource In-Reply-To: <1366709437-4008-2-git-send-email-cngesaint@outlook.com> References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> <1366709437-4008-2-git-send-email-cngesaint@outlook.com> Message-ID: <5179626F.4070209@redhat.com> On 04/23/2013 05:30 AM, cngesaint at outlook.com wrote: > From: Xu Wang > > Original code will report xml text missing when a disk is not accessable, > make user confuse. This patch will report the real error to tip user check s/accessable/accessible/ > its system health state on the server. Can you provide an example test or command - so that it's "testable"? Whether that's by adding a new cimtest or some other means. There seems to be two errors serviced by DISK_UNKNOWN - the first one is a failure on a 'stat64()' and the second is the st_mode not being a BLK device, a REG (file), or a DIR (file system). How are they differentiated? Seems to me earlier checks should determine that the path doesn't exist while this check should be limited to invalid format. My other experience with CIM enum's is that there's supposed to be an "UNKNOWN" and "OTHER" values, where UNKNOWN was always 0 and OTHER was always 1. I may be the "OTHER" name space incorrect it's been a while... > > Signed-off-by: Xu Wang > --- > src/Virt_VirtualSystemManagementService.c | 65 +++++++++++++++++++++-------- > 1 files changed, 48 insertions(+), 17 deletions(-) > > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index 4e93ef0..d252e12 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -964,11 +964,13 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, > } > > static const char *disk_rasd_to_vdev(CMPIInstance *inst, > - struct virt_device *dev) > + struct virt_device *dev, > + char **p_error) > { > const char *val = NULL; > uint16_t type; > bool read = false; > + int rc; > > CU_DEBUG("Enter disk_rasd_to_vdev"); > if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) > @@ -984,6 +986,17 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, > dev->dev.disk.source = strdup(val); > dev->dev.disk.disk_type = disk_type_from_file(val); > > + if (dev->dev.disk.disk_type == DISK_UNKNOWN) { > + /* on success or fail caller should try free it */ > + rc = asprintf(p_error, "Device %s, Address %s, " > + "make sure Address can be accessed on host system.", > + dev->dev.disk.virtual_dev, dev->dev.disk.source); There's no error checking on whether the strdup()'s succeeded and thus this could cause problems with %s and NULL strings. For that matter there's very little error checking w/r/t strdup() failures so you're following existing potential issues... > + if (rc == -1) { > + CU_DEBUG("error during recording exception!"); Since asprintf() says the parameter 1 is "undefined" if rc == -1, so be safe and set p_error to NULL again... > + } > + return "Can't get a valid disk type, "; Looks like a cut-n-paste - just snip the ", ". Other error returns don't use the ", " list marker... > + } > + > if (cu_get_u16_prop(inst, "EmulatedType", &type) != CMPI_RC_OK) > type = VIRT_DISK_TYPE_DISK; > > @@ -1452,10 +1465,11 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, > static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, > struct virt_device *dev, > uint16_t type, > - const char *ns) > + const char *ns, > + char **p_error) > { > if (type == CIM_RES_TYPE_DISK) { > - return disk_rasd_to_vdev(inst, dev); > + return disk_rasd_to_vdev(inst, dev, p_error); > } else if (type == CIM_RES_TYPE_NET) { > return net_rasd_to_vdev(inst, dev, ns); > } else if (type == CIM_RES_TYPE_MEM) { > @@ -1494,7 +1508,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, > static const char *rasd_to_vdev(CMPIInstance *inst, > struct domain *domain, > struct virt_device *dev, > - const char *ns) > + const char *ns, > + char **p_error) > { > uint16_t type; > CMPIObjectPath *op; > @@ -1516,7 +1531,7 @@ static const char *rasd_to_vdev(CMPIInstance *inst, > if (domain->type == DOMAIN_LXC) > msg = _container_rasd_to_vdev(inst, dev, type, ns); > else > - msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns); > + msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns, p_error); > out: > if (msg && op) > CU_DEBUG("rasd_to_vdev(%s): %s", CLASSNAME(op), msg); > @@ -1560,7 +1575,8 @@ static char *add_device_nodup(struct virt_device *dev, > > static const char *classify_resources(CMPIArray *resources, > const char *ns, > - struct domain *domain) > + struct domain *domain, > + char **p_error) > { > int i; > uint16_t type; > @@ -1613,13 +1629,15 @@ static const char *classify_resources(CMPIArray *resources, > msg = rasd_to_vdev(inst, > domain, > &domain->dev_vcpu[0], > - veillard at redhat.com ns); > + ns, > + p_error); > } else if (type == CIM_RES_TYPE_MEM) { > domain->dev_mem_ct = 1; > msg = rasd_to_vdevvirQEMUDriverCreateCapabilities(inst, > domain, > &domain->dev_mem[0], > - ns); > + ns, > + p_error); > } else if (type == CIM_RES_TYPE_DISK) { > struct virt_device dev; > int dcount = count + domain->dev_disk_ct; > @@ -1628,7 +1646,8 @@ static const char *classify_resources(CMPIArray *resources, > msg = rasd_to_vdev(inst, > domain, > &dev, > - ns); > + ns, > + p_error); > if (msg == NULL) > msg = add_device_nodup(&dev, > domain->dev_disk, > @@ -1646,7 +1665,8 @@ static const char *classify_resources(CMPIArray *resources, > msg = rasd_to_vdev(inst, > domain, > &dev, > - ns); > + ns, > + p_error); > if (msg == NULL) > msg = add_device_nodup(&dev, > domain->dev_net, > @@ -1676,7 +1696,8 @@ static const char *classify_resources(CMPIArray *resources, > msg = rasd_to_vdev(inst, > domain, > &dev, > - ns); > + ns, > + p_error); > if (msg == NULL) > msg = add_device_nodup(&dev, > domain->dev_graphics, > @@ -1687,7 +1708,8 @@ static const char *classify_resources(CMPIArray *resources, > msg = rasd_to_vdev(inst, > domain, > &domain->dev_input[0], > - ns); > + ns, > + p_error); > } > if (msg != NULL) > return msg; > @@ -2083,6 +2105,7 @@ static CMPIInstance *create_system(const CMPIContext *context, > struct inst_list list; > const char *props[] = {NULL}; > struct domain *domain = NULL; > + char *error_msg = NULL; > > inst_list_init(&list); > > @@ -2113,12 +2136,13 @@ static CMPIInstance *create_system(const CMPIContext *context, > if (s->rc != CMPI_RC_OK) > goto out; > > - msg = classify_resources(resources, NAMESPACE(ref), domain); > + msg = classify_resources(resources, NAMESPACE(ref), domain, &error_msg); > if (msg != NULL) { > - CU_DEBUG("Failed to classify resources: %s", msg); > + CU_DEBUG("Failed to classify resources: %s, %s", > + msg, error_msg); Since error_msg could be NULL - it should be handled... > cu_statusf(_BROKER, s, > CMPI_RC_ERR_FAILED, > - "ResourceSettings Error: %s", msg); > + "ResourceSettings Error: %s, %s", msg, error_msg); Same here... > goto out; > } > > @@ -2159,6 +2183,7 @@ static CMPIInstance *create_system(const CMPIContext *context, > > > out: > + free(error_msg); > cleanup_dominfo(&domain); > free(xml); > inst_list_free(&list); > @@ -2638,6 +2663,7 @@ static CMPIStatus resource_add(struct domain *dominfo, > struct virt_device *dev; > int *count = NULL; > const char *msg = NULL; > + char *error_msg = NULL; > > op = CMGetObjectPath(rasd, &s); > if ((op == NULL) || (s.rc != CMPI_RC_OK)) > @@ -2677,7 +2703,7 @@ static CMPIStatus resource_add(struct domain *dominfo, > dev = &list[*count]; > > dev->type = type; > - msg = rasd_to_vdev(rasd, dominfo, dev, ns); > + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); > if (msg != NULL) { > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_FAILED, Why not add the "error_msg" output here too like create_system? > @@ -2702,6 +2728,8 @@ static CMPIStatus resource_add(struct domain *dominfo, > (*count)++; > > out: > + free(error_msg); > +virQEMUDriverCreateCapabilities > return s; > } > > @@ -2718,6 +2746,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, > int *count; > int i; > const char *msg = NULL; > + char *error_msg = NULL; > > CU_DEBUG("Enter resource_mod"); > if (devid == NULL) { > @@ -2749,7 +2778,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, > struct virt_device *dev = &list[i]; > > if (STREQ(dev->id, devid)) { > - msg = rasd_to_vdev(rasd, dominfo, dev, ns); > + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); > if (msg != NULL) { > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_FAILED, Same comment John > @@ -2793,6 +2822,8 @@ static CMPIStatus resource_mod(struct domain *dominfo, > } > > out: > + free(error_msg); > + > return s; > } > > From jferlan at redhat.com Thu Apr 25 18:08:51 2013 From: jferlan at redhat.com (John Ferlan) Date: Thu, 25 Apr 2013 14:08:51 -0400 Subject: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable Message-ID: <51797133.5010600@redhat.com> For some reason the original email never made it into my inbox, so I've had to cut-n-paste from the mail list archives and I hope I picked the right message-id for the messages to line up properly!!! > From: Xu Wang > There's no commit message? > Signed-off-by: Xu Wang > --- > libvirt-cim.conf | 14 ++++++++++ > libxkutil/misc_util.c | 18 +++++++++++++ > libxkutil/misc_util.h | 2 + > src/Virt_SwitchService.c | 63 ++++++++++++++++++++++++++++++++++++++-------- > 4 files changed, 86 insertions(+), 11 deletions(-) > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > index 3244ee3..396dac9 100644 > --- a/libvirt-cim.conf > +++ b/libvirt-cim.conf > @@ -38,3 +38,17 @@ > # Default value: false > # > # force_use_qemu = false; > + > +# lldptool_query_options (string) > +# Defines the command used in SwitchService to query VEPA support, will be > +# used as "lldptool -i [INTERFACE] [OPTIONS]" > +# > +# lldptool_query_options = "-t -g ncb -V evbcfg"; > + > +# vsi_support_key_string (string) > +# Defines the string used in SwitchService to search in lldptool's output > +# When lldptool updates its output, please update the new output into the > +# output set. add comma between items. > +# > +# vsi_support_key_string = "{ supported forwarding mode: (0x40) reflective relay," > +# " supported capabilities: (0x7) RTE ECP VDP}"; The code later indicates all the strings have to be there; however, the comments here do not match that. There's also no mention here that at most 8 lines can be added. Hopefully we never need to go beyond that number (however arbitrary 8 is). Is the semicolon mandatory? Seems to me whatever format is required needs to be well documented. With respect to the strings and the parsing done, should I 'assume' that the config_lookup_string() will know how to read the config file where elements span multiple lines.... In particular, is "line1," "line2" read/returned as "line1,line2"? I would think a continuation "\" marker would be necessary: "line1," \ "line2" I would also think the comma would be outside the quotes, but don't have experience with the API in question. Since I don't have a way to test this - I'm curious while coding this up if you checked that both lines were read when parsing? Secondarily, there's some extraneous spaces which perhaps need to be cleaned up. Since the code later on will separate based on ",". What happens if message #3 comes along some day as: "support feature1, feature2, and feature3: (0x83) mumbly fratz" > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > index 4c0b0a1..6ce8dca 100644 > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -244,6 +244,24 @@ const char *get_mig_ssh_tmp_key(void) > return prop.value_string; > } > > +const char *get_lldptool_query_options(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "lldptool_query_options", CONFIG_STRING, {0}, 0}; > + > + libvirt_cim_config_get(&prop); > + return prop.value_string; > +} > + > +const char *get_vsi_support_key_string(void) > +{ > + static LibvirtcimConfigProperty prop = { > + "vsi_support_key_string", CONFIG_STRING, {0}, 0};; > + > + libvirt_cim_config_get(&prop); > + return prop.value_string; > +} > + > virConnectPtr connect_by_classname(const CMPIBroker *broker, > const char *classname, > CMPIStatus *s) > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > index 9e6b419..4eb588d 100644 > --- a/libxkutil/misc_util.h > +++ b/libxkutil/misc_util.h > @@ -155,6 +155,8 @@ int virt_set_status(const CMPIBroker *broker, > /* get libvirt-cim config */ > const char *get_mig_ssh_tmp_key(void); > bool get_force_use_qemu(void); > +const char *get_lldptool_query_options(void); > +const char *get_vsi_support_key_string(void); > > /* > * Local Variables: > diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c > index 8991426..f7bafbf 100644 > --- a/src/Virt_SwitchService.c > +++ b/src/Virt_SwitchService.c > @@ -46,12 +46,26 @@ static CMPIStatus check_vsi_support(char *command) > CMPIStatus s = {CMPI_RC_OK, NULL}; > char buff[MAX_LEN]; > FILE *stream = NULL; > - const char *searchStr[] = {" supported forwarding mode: " > - "(0x40) reflective relay", > - " supported capabilities: " > - "(0x07) RTE ECP VDP", > - NULL}; > - int matched = 0; > + char *searchStr[8]; /* maximum items of vsi support output */ > + int count = 0; > + const char *user_settings = get_vsi_support_key_string(); > + char *vsi_support_key_string = NULL; > + char *delim = "{},"; > + int matched = 0; > + char *temp = NULL; > + > + if (!user_settings) { > + user_settings = "{ supported forwarding mode: " > + "(0x40) reflective relay," > + " supported capabilities: " > + "(0x7) RTE ECP VDP}"; > + } > + > + vsi_support_key_string = strdup(user_settings); There's a memory leak hear if 'user_settings' is returned from the api. That code will strdup() whatever is returned, it's returned here, strdup()'d again and leaked. > + if (vsi_support_key_string == NULL) { > + CU_DEBUG("strdup vsi_support_key_string failed!"); I think you need to call cu_statusf here; otherwise, 's' returns as {CMPI_RC_OK, NULL} > + goto out; > + } > > // Run lldptool command to find vsi support. > stream = popen(command, "r"); > @@ -63,6 +77,25 @@ static CMPIStatus check_vsi_support(char *command) > goto out; > } > > + /* Slice vsi_support_key_string into items */ > + searchStr[count] = strtok_r(vsi_support_key_string, delim, &temp); > + if (searchStr[count] == NULL) { > + CU_DEBUG("searchStr fetch failed when calling strtok_r!"); > + } else { > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > + count++; > + } > + > + while ((searchStr[count] = strtok_r(NULL, delim, &temp))) { > + if (count >= 7) { > + CU_DEBUG("WARN: searchStr is full, left aborted!"); > + break; > + } else { > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > + count++; > + } > + } > + What if count == 0? That is can the element in the conf file be "{}"? > // Read the output of the command. > while (fgets(buff, MAX_LEN, stream) != NULL) { > int i = 0; > @@ -81,16 +114,18 @@ static CMPIStatus check_vsi_support(char *command) > } > /* All the search strings were found in the output of this > command. */ > - if (matched == 2) { > + if (matched == count) { > cu_statusf(_BROKER, &s, CMPI_RC_OK, "VSI supported"); > - goto out;; > + goto out; > } > } > + > cu_statusf(_BROKER, &s, > CMPI_RC_ERR_NOT_FOUND, > "No VSI Support found"); > > - out: > + out: > + free(vsi_support_key_string); > if (stream != NULL) > pclose(stream); > return s; > @@ -214,6 +249,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > int i; > char **if_list; > char cmd[MAX_LEN]; > + const char *lldptool_query_options = NULL; > > *_inst = NULL; > conn = connect_by_classname(broker, CLASSNAME(reference), &s); > @@ -257,10 +293,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > CU_DEBUG("Found %d interfaces", count); > > + lldptool_query_options = get_lldptool_query_options(); > + if (!lldptool_query_options) { > + lldptool_query_options = "-t -g ncb -V evbcfg"; > + } Memory leak if we are successful from get_lldptool_query_options() John > > for (i=0; i - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); > - CU_DEBUG("running command %s ...", cmd); > + sprintf(cmd, "lldptool -i %s %s", > + if_list[i], lldptool_query_options); > + CU_DEBUG("running command [%s]", cmd); > s = check_vsi_support(cmd); > if (s.rc == CMPI_RC_OK) { > vsi = true; > -- > 1.7.1 From xiawenc at linux.vnet.ibm.com Fri Apr 26 03:24:14 2013 From: xiawenc at linux.vnet.ibm.com (Wenchao Xia) Date: Fri, 26 Apr 2013 11:24:14 +0800 Subject: [Libvirt-cim] [PATCH 1/3] make force use qemu configurable In-Reply-To: <51795CF5.2050303@redhat.com> References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com> <51795CF5.2050303@redhat.com> Message-ID: <5179F35E.3030905@linux.vnet.ibm.com> ? 2013-4-26 0:42, John Ferlan ??: > On 04/23/2013 05:30 AM, cngesaint at outlook.com wrote: >> From: Wenchao Xia >> >> Since in nested KVM, libvirt-cim doesn't handle it well now, add >> this option to make it run well with qemu wchi help development >> and test. > > I think your commit message more simply stated is: > > Allow libvirt-cim to be supported within a nested KVM environment in > order to more easily develop and test various configurations > > What happens if someone sets this in a non nested environment? I would > think you'd want to test if the 'nested' property is set... > Hi, John The commit message is not clear, actually this patch provide a way to manually disable KVM and fall back to qemu(without usage of hardware acceleration module, kvm.ko), Since using KVM have some problem in libvirt-cim in nested KVM env(which is a test env, most issues happens in the xml gen in libvirt-cim and parsing in libvirt). In non nested environment, it is same, kvm acceleration is disabled. >> >> Signed-off-by: Xu Wang >> --- >> libvirt-cim.conf | 8 ++++++++ >> libxkutil/misc_util.c | 8 ++++++++ >> libxkutil/misc_util.h | 1 + >> src/Virt_VirtualSystemManagementService.c | 7 +++++++ >> 4 files changed, 24 insertions(+), 0 deletions(-) >> >> diff --git a/libvirt-cim.conf b/libvirt-cim.conf >> index 37d7b0f..3244ee3 100644 >> --- a/libvirt-cim.conf >> +++ b/libvirt-cim.conf >> @@ -30,3 +30,11 @@ >> # Default value: NULL, that is not set. >> # >> # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa"; >> + >> +# force_use_qemu (bool) >> +# Since in nested KVM, libvirt-cim doesn't handler it well now, so add this >> +# option to make it run well with qemu which help development and test. >> +# Possible values: {true,false} >> +# Default value: false >> +# >> +# force_use_qemu = false; > > > I suggest using the comments from above here too... > > >> diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c >> index 00eb4b1..4c0b0a1 100644 >> --- a/libxkutil/misc_util.c >> +++ b/libxkutil/misc_util.c >> @@ -227,6 +227,14 @@ static int is_read_only(void) >> return prop.value_bool; >> } >> >> +bool get_force_use_qemu(void) >> +{ >> + static LibvirtcimConfigProperty prop = { >> + "force_use_qemu", CONFIG_BOOL, {0}, 0}; >> + libvirt_cim_config_get(&prop); >> + return prop.value_bool; >> +} >> + >> const char *get_mig_ssh_tmp_key(void) >> { >> static LibvirtcimConfigProperty prop = { >> diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h >> index 0f52290..9e6b419 100644 >> --- a/libxkutil/misc_util.h >> +++ b/libxkutil/misc_util.h >> @@ -154,6 +154,7 @@ int virt_set_status(const CMPIBroker *broker, >> >> /* get libvirt-cim config */ >> const char *get_mig_ssh_tmp_key(void); >> +bool get_force_use_qemu(void); >> >> /* >> * Local Variables: >> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c >> index cbb646d..4e93ef0 100644 >> --- a/src/Virt_VirtualSystemManagementService.c >> +++ b/src/Virt_VirtualSystemManagementService.c >> @@ -394,6 +394,13 @@ static bool system_has_kvm(const char *pfx) >> virConnectPtr conn; >> char *caps = NULL; >> bool kvm = false; >> + bool force_use_qemu = get_force_use_qemu(); >> + >> + /* hack for nested KVM */ >> + if (force_use_qemu) { >> + CU_DEBUG("Enter force use qemu mode!"); >> + return false; >> + } > > The above check is being done on the "local" system right? While the > following check is being done on the "BROKER" system, right? Which may They both happen on local system. > not be the same as the "local" system? So where should the check of > whether the system in which is executing libvirt-cim code be really > made? IOW, are you sure this is the right place to check? What's the > differentiation in libvirt-cim between QEMU & KVM being made for? Being > "new" I thought they were the same. > > I'm not even convinced the routine is doing the right thing, but perhaps > I just don't have enough history. I see a virsh capabilities on my > system returns some kvm defs and some qemu defs, so a blind strstr is > returning true... > > The prime differentiator is that the calling routine will set > domain->type to QEMU now rather than KVM and I'm not sure I understand > how by using that setting we'll be able support nested KVM. Support nested KVM will need more efforts, I think you have found the right place, there are some issues in following path, what I saw is libvirt rejected some xml generated. To avoid the troubles, so disable it first, to test libvirt-cim for qemu, for that most part are the same with KVM case, > > > John >> >> conn = connect_by_classname(_BROKER, pfx, &s); >> if ((conn == NULL) || (s.rc != CMPI_RC_OK)) { >> > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Best Regards Wenchao Xia From cngesaint at outlook.com Sat Apr 27 09:38:41 2013 From: cngesaint at outlook.com (WangXu) Date: Sat, 27 Apr 2013 09:38:41 +0000 Subject: [Libvirt-cim] [PATCH 2/3] VSMS: tip error for invalid disk resource In-Reply-To: <5179626F.4070209@redhat.com> References: <1366709437-4008-1-git-send-email-cngesaint@outlook.com>, <1366709437-4008-2-git-send-email-cngesaint@outlook.com>, <5179626F.4070209@redhat.com> Message-ID: > Date: Thu, 25 Apr 2013 13:05:51 -0400 > From: jferlan at redhat.com > To: libvirt-cim at redhat.com > Subject: Re: [Libvirt-cim] [PATCH 2/3] VSMS: tip error for invalid disk resource > > On 04/23/2013 05:30 AM, cngesaint at outlook.com wrote: > > From: Xu Wang > > > > Original code will report xml text missing when a disk is not accessable, > > make user confuse. This patch will report the real error to tip user check > > s/accessable/accessible/ > > > its system health state on the server. > > Can you provide an example test or command - so that it's "testable"? > Whether that's by adding a new cimtest or some other means. There seems > to be two errors serviced by DISK_UNKNOWN - the first one is a failure > on a 'stat64()' and the second is the st_mode not being a BLK device, a > REG (file), or a DIR (file system). How are they differentiated? > > Seems to me earlier checks should determine that the path doesn't exist > while this check should be limited to invalid format. My other > experience with CIM enum's is that there's supposed to be an "UNKNOWN" > and "OTHER" values, where UNKNOWN was always 0 and OTHER was always 1. > I may be the "OTHER" name space incorrect it's been a while... Yes, I just found it is not suitable for just checking resource accessible by disk type. e.g.,under cdrom (blank or none disk) this patch will trigger another question. So I will rewrite it. > > > > > > Signed-off-by: Xu Wang > > --- > > src/Virt_VirtualSystemManagementService.c | 65 +++++++++++++++++++++-------- > > 1 files changed, 48 insertions(+), 17 deletions(-) > > > > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > > index 4e93ef0..d252e12 100644 > > --- a/src/Virt_VirtualSystemManagementService.c > > +++ b/src/Virt_VirtualSystemManagementService.c > > @@ -964,11 +964,13 @@ static const char *net_rasd_to_vdev(CMPIInstance *inst, > > } > > > > static const char *disk_rasd_to_vdev(CMPIInstance *inst, > > - struct virt_device *dev) > > + struct virt_device *dev, > > + char **p_error) > > { > > const char *val = NULL; > > uint16_t type; > > bool read = false; > > + int rc; > > > > CU_DEBUG("Enter disk_rasd_to_vdev"); > > if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) > > @@ -984,6 +986,17 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst, > > dev->dev.disk.source = strdup(val); > > dev->dev.disk.disk_type = disk_type_from_file(val); > > > > + if (dev->dev.disk.disk_type == DISK_UNKNOWN) { > > + /* on success or fail caller should try free it */ > > + rc = asprintf(p_error, "Device %s, Address %s, " > > + "make sure Address can be accessed on host system.", > > + dev->dev.disk.virtual_dev, dev->dev.disk.source); > > There's no error checking on whether the strdup()'s succeeded and thus > this could cause problems with %s and NULL strings. For that matter > there's very little error checking w/r/t strdup() failures so you're > following existing potential issues... > > > + if (rc == -1) { > > + CU_DEBUG("error during recording exception!"); > > Since asprintf() says the parameter 1 is "undefined" if rc == -1, so be > safe and set p_error to NULL again... Yes, I think so. > > > + } > > + return "Can't get a valid disk type, "; > > Looks like a cut-n-paste - just snip the ", ". Other error returns > don't use the ", " list marker... It's caused by my input method, sorry... > > > > + } > > + > > if (cu_get_u16_prop(inst, "EmulatedType", &type) != CMPI_RC_OK) > > type = VIRT_DISK_TYPE_DISK; > > > > @@ -1452,10 +1465,11 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, > > static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, > > struct virt_device *dev, > > uint16_t type, > > - const char *ns) > > + const char *ns, > > + char **p_error) > > { > > if (type == CIM_RES_TYPE_DISK) { > > - return disk_rasd_to_vdev(inst, dev); > > + return disk_rasd_to_vdev(inst, dev, p_error); > > } else if (type == CIM_RES_TYPE_NET) { > > return net_rasd_to_vdev(inst, dev, ns); > > } else if (type == CIM_RES_TYPE_MEM) { > > @@ -1494,7 +1508,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, > > static const char *rasd_to_vdev(CMPIInstance *inst, > > struct domain *domain, > > struct virt_device *dev, > > - const char *ns) > > + const char *ns, > > + char **p_error) > > { > > uint16_t type; > > CMPIObjectPath *op; > > @@ -1516,7 +1531,7 @@ static const char *rasd_to_vdev(CMPIInstance *inst, > > if (domain->type == DOMAIN_LXC) > > msg = _container_rasd_to_vdev(inst, dev, type, ns); > > else > > - msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns); > > + msg = _sysvirt_rasd_to_vdev(inst, dev, type, ns, p_error); > > out: > > if (msg && op) > > CU_DEBUG("rasd_to_vdev(%s): %s", CLASSNAME(op), msg); > > @@ -1560,7 +1575,8 @@ static char *add_device_nodup(struct virt_device *dev, > > > > static const char *classify_resources(CMPIArray *resources, > > const char *ns, > > - struct domain *domain) > > + struct domain *domain, > > + char **p_error) > > { > > int i; > > uint16_t type; > > @@ -1613,13 +1629,15 @@ static const char *classify_resources(CMPIArray *resources, > > msg = rasd_to_vdev(inst, > > domain, > > &domain->dev_vcpu[0], > > - veillard at redhat.com ns); > > + ns, > > + p_error); > > } else if (type == CIM_RES_TYPE_MEM) { > > domain->dev_mem_ct = 1; > > msg = rasd_to_vdevvirQEMUDriverCreateCapabilities(inst, > > domain, > > &domain->dev_mem[0], > > - ns); > > + ns, > > + p_error); > > } else if (type == CIM_RES_TYPE_DISK) { > > struct virt_device dev; > > int dcount = count + domain->dev_disk_ct; > > @@ -1628,7 +1646,8 @@ static const char *classify_resources(CMPIArray *resources, > > msg = rasd_to_vdev(inst, > > domain, > > &dev, > > - ns); > > + ns, > > + p_error); > > if (msg == NULL) > > msg = add_device_nodup(&dev, > > domain->dev_disk, > > @@ -1646,7 +1665,8 @@ static const char *classify_resources(CMPIArray *resources, > > msg = rasd_to_vdev(inst, > > domain, > > &dev, > > - ns); > > + ns, > > + p_error); > > if (msg == NULL) > > msg = add_device_nodup(&dev, > > domain->dev_net, > > @@ -1676,7 +1696,8 @@ static const char *classify_resources(CMPIArray *resources, > > msg = rasd_to_vdev(inst, > > domain, > > &dev, > > - ns); > > + ns, > > + p_error); > > if (msg == NULL) > > msg = add_device_nodup(&dev, > > domain->dev_graphics, > > @@ -1687,7 +1708,8 @@ static const char *classify_resources(CMPIArray *resources, > > msg = rasd_to_vdev(inst, > > domain, > > &domain->dev_input[0], > > - ns); > > + ns, > > + p_error); > > } > > if (msg != NULL) > > return msg; > > @@ -2083,6 +2105,7 @@ static CMPIInstance *create_system(const CMPIContext *context, > > struct inst_list list; > > const char *props[] = {NULL}; > > struct domain *domain = NULL; > > + char *error_msg = NULL; > > > > inst_list_init(&list); > > > > @@ -2113,12 +2136,13 @@ static CMPIInstance *create_system(const CMPIContext *context, > > if (s->rc != CMPI_RC_OK) > > goto out; > > > > - msg = classify_resources(resources, NAMESPACE(ref), domain); > > + msg = classify_resources(resources, NAMESPACE(ref), domain, &error_msg); > > if (msg != NULL) { > > - CU_DEBUG("Failed to classify resources: %s", msg); > > + CU_DEBUG("Failed to classify resources: %s, %s", > > + msg, error_msg); > > Since error_msg could be NULL - it should be handled... It would be OK. If error_msg is null, a blank will output and no error. > > > cu_statusf(_BROKER, s, > > CMPI_RC_ERR_FAILED, > > - "ResourceSettings Error: %s", msg); > > + "ResourceSettings Error: %s, %s", msg, error_msg); > > Same here... > > > goto out; > > } > > > > @@ -2159,6 +2183,7 @@ static CMPIInstance *create_system(const CMPIContext *context, > > > > > > out: > > + free(error_msg); > > cleanup_dominfo(&domain); > > free(xml); > > inst_list_free(&list); > > @@ -2638,6 +2663,7 @@ static CMPIStatus resource_add(struct domain *dominfo, > > struct virt_device *dev; > > int *count = NULL; > > const char *msg = NULL; > > + char *error_msg = NULL; > > > > op = CMGetObjectPath(rasd, &s); > > if ((op == NULL) || (s.rc != CMPI_RC_OK)) > > @@ -2677,7 +2703,7 @@ static CMPIStatus resource_add(struct domain *dominfo, > > dev = &list[*count]; > > > > dev->type = type; > > - msg = rasd_to_vdev(rasd, dominfo, dev, ns); > > + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); > > if (msg != NULL) { > > cu_statusf(_BROKER, &s, > > CMPI_RC_ERR_FAILED, > > Why not add the "error_msg" output here too like create_system? Yes, error_msg also could be returned to server from here:-) > > > @@ -2702,6 +2728,8 @@ static CMPIStatus resource_add(struct domain *dominfo, > > (*count)++; > > > > out: > > + free(error_msg); > > +virQEMUDriverCreateCapabilities > > return s; > > } > > > > @@ -2718,6 +2746,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, > > int *count; > > int i; > > const char *msg = NULL; > > + char *error_msg = NULL; > > > > CU_DEBUG("Enter resource_mod"); > > if (devid == NULL) { > > @@ -2749,7 +2778,7 @@ static CMPIStatus resource_mod(struct domain *dominfo, > > struct virt_device *dev = &list[i]; > > > > if (STREQ(dev->id, devid)) { > > - msg = rasd_to_vdev(rasd, dominfo, dev, ns); > > + msg = rasd_to_vdev(rasd, dominfo, dev, ns, &error_msg); > > if (msg != NULL) { > > cu_statusf(_BROKER, &s, > > CMPI_RC_ERR_FAILED, > > Same comment > > John > > > @@ -2793,6 +2822,8 @@ static CMPIStatus resource_mod(struct domain *dominfo, > > } > > > > out: > > + free(error_msg); > > + > > return s; > > } > > > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Sun Apr 28 02:28:18 2013 From: cngesaint at outlook.com (WangXu) Date: Sun, 28 Apr 2013 02:28:18 +0000 Subject: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable In-Reply-To: <51797133.5010600@redhat.com> References: <51797133.5010600@redhat.com> Message-ID: > Date: Thu, 25 Apr 2013 14:08:51 -0400 > From: jferlan at redhat.com > To: libvirt-cim at redhat.com > Subject: Re: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable > > > For some reason the original email never made it into my inbox, so I've > had to cut-n-paste from the mail list archives and I hope I picked the > right message-id for the messages to line up properly!!! > > > > > From: Xu Wang > > > > There's no commit message? > > > Signed-off-by: Xu Wang > > --- > > libvirt-cim.conf | 14 ++++++++++ > > libxkutil/misc_util.c | 18 +++++++++++++ > > libxkutil/misc_util.h | 2 + > > src/Virt_SwitchService.c | 63 ++++++++++++++++++++++++++++++++++++++-------- > > 4 files changed, 86 insertions(+), 11 deletions(-) > > > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > > index 3244ee3..396dac9 100644 > > --- a/libvirt-cim.conf > > +++ b/libvirt-cim.conf > > @@ -38,3 +38,17 @@ > > # Default value: false > > # > > # force_use_qemu = false; > > + > > +# lldptool_query_options (string) > > +# Defines the command used in SwitchService to query VEPA support, will be > > +# used as "lldptool -i [INTERFACE] [OPTIONS]" > > +# > > +# lldptool_query_options = "-t -g ncb -V evbcfg"; > > + > > +# vsi_support_key_string (string) > > +# Defines the string used in SwitchService to search in lldptool's output > > +# When lldptool updates its output, please update the new output into the > > +# output set. add comma between items. > > +# > > +# vsi_support_key_string = "{ supported forwarding mode: (0x40) reflective relay," > > +# " supported capabilities: (0x7) RTE ECP VDP}"; > > The code later indicates all the strings have to be there; however, the > comments here do not match that. There's also no mention here that at > most 8 lines can be added. Hopefully we never need to go beyond that > number (however arbitrary 8 is). Is the semicolon mandatory? Seems to > me whatever format is required needs to be well documented. I'll supplement about format of vsi_support_key_string and limit of items about it into comment. > > With respect to the strings and the parsing done, should I 'assume' that > the config_lookup_string() will know how to read the config file where > elements span multiple lines.... In particular, is > > "line1," > "line2" > > read/returned as "line1,line2"? > > I would think a continuation "\" marker would be necessary: > > "line1," \ > "line2" It's OK without slash (It was successful under my test). I haven't test for the format like above. > > I would also think the comma would be outside the quotes, but don't have > experience with the API in question. The application read vsi_support_key_string as a whole string and use comma to slice them (e.g.,above string will be devided into 2 parts, one before comma and the other one after comma) > > Since I don't have a way to test this - I'm curious while coding this up > if you checked that both lines were read when parsing? You can adjust value of vsi_support_key_string and then the output of CU_DEBUG in the log would changed as your change. I made every item would write into /var/log/libvirt-cim/debug.txt > > Secondarily, there's some extraneous spaces which perhaps need to be > cleaned up. Since the code later on will separate based on ",". What > happens if message #3 comes along some day as: > > "support feature1, feature2, and feature3: (0x83) mumbly fratz" I took many cases into consideration. At last I think all special symbols are not safe because all of them could appear in the future output. So I picked ",". If someday "," appeared in output, there are just two places need to be updated. Firstly, delimiter set in the variable delim (now is "," "{" and "}"). Secondly, content of vsi_support_key_string and its comments. If you have any better suggestions please let me know. > > > > > > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > > index 4c0b0a1..6ce8dca 100644 > > --- a/libxkutil/misc_util.c > > +++ b/libxkutil/misc_util.c > > @@ -244,6 +244,24 @@ const char *get_mig_ssh_tmp_key(void) > > return prop.value_string; > > } > > > > +const char *get_lldptool_query_options(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "lldptool_query_options", CONFIG_STRING, {0}, 0}; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > +const char *get_vsi_support_key_string(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "vsi_support_key_string", CONFIG_STRING, {0}, 0};; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > virConnectPtr connect_by_classname(const CMPIBroker *broker, > > const char *classname, > > CMPIStatus *s) > > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > > index 9e6b419..4eb588d 100644 > > --- a/libxkutil/misc_util.h > > +++ b/libxkutil/misc_util.h > > @@ -155,6 +155,8 @@ int virt_set_status(const CMPIBroker *broker, > > /* get libvirt-cim config */ > > const char *get_mig_ssh_tmp_key(void); > > bool get_force_use_qemu(void); > > +const char *get_lldptool_query_options(void); > > +const char *get_vsi_support_key_string(void); > > > > /* > > * Local Variables: > > diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c > > index 8991426..f7bafbf 100644 > > --- a/src/Virt_SwitchService.c > > +++ b/src/Virt_SwitchService.c > > @@ -46,12 +46,26 @@ static CMPIStatus check_vsi_support(char *command) > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > char buff[MAX_LEN]; > > FILE *stream = NULL; > > - const char *searchStr[] = {" supported forwarding mode: " > > - "(0x40) reflective relay", > > - " supported capabilities: " > > - "(0x07) RTE ECP VDP", > > - NULL}; > > - int matched = 0; > > + char *searchStr[8]; /* maximum items of vsi support output */ > > + int count = 0; > > + const char *user_settings = get_vsi_support_key_string(); > > + char *vsi_support_key_string = NULL; > > + char *delim = "{},"; > > + int matched = 0; > > + char *temp = NULL; > > + > > + if (!user_settings) { > > + user_settings = "{ supported forwarding mode: " > > + "(0x40) reflective relay," > > + " supported capabilities: " > > + "(0x7) RTE ECP VDP}"; > > + } > > + > > + vsi_support_key_string = strdup(user_settings); > > There's a memory leak hear if 'user_settings' is returned from the api. > That code will strdup() whatever is returned, it's returned here, > strdup()'d again and leaked. Yes, so it is. > > > > + if (vsi_support_key_string == NULL) { > > + CU_DEBUG("strdup vsi_support_key_string failed!"); > > I think you need to call cu_statusf here; otherwise, 's' returns as > {CMPI_RC_OK, NULL} > > > + goto out; > > + } > > > > // Run lldptool command to find vsi support. > > stream = popen(command, "r"); > > @@ -63,6 +77,25 @@ static CMPIStatus check_vsi_support(char *command) > > goto out; > > } > > > > + /* Slice vsi_support_key_string into items */ > > + searchStr[count] = strtok_r(vsi_support_key_string, delim, &temp); > > + if (searchStr[count] == NULL) { > > + CU_DEBUG("searchStr fetch failed when calling strtok_r!"); > > + } else { > > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > > + count++; > > + } > > + > > + while ((searchStr[count] = strtok_r(NULL, delim, &temp))) { > > + if (count >= 7) { > > + CU_DEBUG("WARN: searchStr is full, left aborted!"); > > + break; > > + } else { > > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > > + count++; > > + } > > + } > > + > > What if count == 0? That is can the element in the conf file be "{}"? Because the condition of vsi_support_key_string was set in the configuration file is the default output items for vsi support check need to be updated. So the level of vsi_support_key_string is higher than default. That's the use of keyword in the .conf file. So if a void content in the .conf file is not needed and should be commented out. I'll add this point into comment of .conf file. > > > // Read the output of the command. > > while (fgets(buff, MAX_LEN, stream) != NULL) { > > int i = 0; > > @@ -81,16 +114,18 @@ static CMPIStatus check_vsi_support(char *command) > > } > > /* All the search strings were found in the output of this > > command. */ > > - if (matched == 2) { > > + if (matched == count) { > > cu_statusf(_BROKER, &s, CMPI_RC_OK, "VSI supported"); > > - goto out;; > > + goto out; > > } > > } > > + > > cu_statusf(_BROKER, &s, > > CMPI_RC_ERR_NOT_FOUND, > > "No VSI Support found"); > > > > - out: > > + out: > > + free(vsi_support_key_string); > > if (stream != NULL) > > pclose(stream); > > return s; > > @@ -214,6 +249,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > int i; > > char **if_list; > > char cmd[MAX_LEN]; > > + const char *lldptool_query_options = NULL; > > > > *_inst = NULL; > > conn = connect_by_classname(broker, CLASSNAME(reference), &s); > > @@ -257,10 +293,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > > > CU_DEBUG("Found %d interfaces", count); > > > > + lldptool_query_options = get_lldptool_query_options(); > > + if (!lldptool_query_options) { > > + lldptool_query_options = "-t -g ncb -V evbcfg"; > > + } > > Memory leak if we are successful from get_lldptool_query_options() free() will be added. > > John > > > > > for (i=0; i > - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); > > - CU_DEBUG("running command %s ...", cmd); > > + sprintf(cmd, "lldptool -i %s %s", > > + if_list[i], lldptool_query_options); > > + CU_DEBUG("running command [%s]", cmd); > > s = check_vsi_support(cmd); > > if (s.rc == CMPI_RC_OK) { > > vsi = true; > > -- > > 1.7.1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Sun Apr 28 05:19:38 2013 From: cngesaint at outlook.com (WangXu) Date: Sun, 28 Apr 2013 05:19:38 +0000 Subject: [Libvirt-cim] [PATCH v2 00/12] cimtest updates In-Reply-To: <1366812554-6591-1-git-send-email-jferlan@redhat.com> References: <1366812554-6591-1-git-send-email-jferlan@redhat.com> Message-ID: I have run cimtest with these 12 patches and they solved most of bugs before. However, I found some new FAIL cases. 1. -------------------------------------------------------------------- HostSystem - 01_enum.py: FAIL ERROR - Exp KVM_HostSystem, got KVM_HostSystem ERROR - Exp localhost, got RH64wenchao CIM_ERR_INVALID_CLASS: Linux_ComputerSystem -------------------------------------------------------------------- HostSystem - 03_hs_to_settdefcap.py: FAIL ERROR - Hostname mismatch -------------------------------------------------------------------- Hostname mismatch because cimtest match localhost with RH64wenchao... Could you find out what cause it and fix it? 2. -------------------------------------------------------------------- SwitchService - 01_enum.py: XFAIL Please check if this is the expected result --- *** VSI NOT supported *** -------------------------------------------------------------------- Why XFAIL but not SKIP here? My computer does not support it. 3. -------------------------------------------------------------------- VirtualSystemManagementService - 22_addmulti_brg_interface.py: XFAIL ERROR - (1, u"CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging") ERROR - Error invoking AddRS: add_net_res ERROR - AddResourceSettings call failed ERROR - Failed to destroy Virtual Network 'my_network1' InvokeMethod(AddResourceSettings): CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging Bug:<00015> -------------------------------------------------------------------- VirtualSystemManagementService - 30_dynamic_disk_mod.py: XFAIL ERROR - (1, u"CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging") ERROR - Error invoking AddRS: add_disk_res ERROR - AddResourceSettings call failed InvokeMethod(AddResourceSettings): CIM_ERR_FAILED: Unable to change (0) device: internal error unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging -------------------------------------------------------------------- I am sorry I don't clear what caused it. 4. -------------------------------------------------------------------- VirtualSystemManagementService - 27_definesystem_macvtap_dev.py: FAIL ERROR - Got CIM error CIM_ERR_FAILED: Unable to start domain: Unable to get index for interface eth1: No such device with return code 1 ERROR - Unable to start rstest_nic InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Unable to start domain: Unable to get index for interface eth1: No such device -------------------------------------------------------------------- VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL ERROR - Got CIM error CIM_ERR_FAILED: Unable to start domain: Unable to get index for interface eth1: No such device with return code 1 ERROR - Unable to start VM *** Is VSI support available on this host? *** InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Unable to start domain: Unable to get index for interface eth1: No such device -------------------------------------------------------------------- This FAIL happens because there is no eth1 interface on my computer. The name of my network interface is "eth3". So I think it had better list all network interfaces and pick available one for testing. For multicard machine there are some rule to choice one or...configure it manually? > From: jferlan at redhat.com > To: libvirt-cim at redhat.com > Date: Wed, 24 Apr 2013 10:09:02 -0400 > Subject: [Libvirt-cim] [PATCH v2 00/12] cimtest updates > > This is primarily a repost of the previous series: > > https://www.redhat.com/archives/libvirt-cim/2013-March/msg00051.html > > and > > https://www.redhat.com/archives/libvirt-cim/2013-April/msg00014.html > > The primary difference in this patch vs. the previous sets is to fix the > version string checking for nfs server checking in common_util.py and to > add patch 12/12 which handles a problem in 'enum_volumes()' in pool.py. > > I assume patches 1-4 and 6-9 were reviewed without issue. So focus on 5/12 > and 10-12/12. > > > John Ferlan (12): > Need to check "slp=true", not just "slp" since "slp=false" is possible > Change the MAC from "99:" to "88:" > Create a temporary directory for disk pool tests > Use symbols as named in libvirt-cim for easier reference > Fix nfs-server lookup code > Fix os_status passing to reporter functions > Resolve issues found in test. > On Fedora systems default to using 'em1' instead of 'eth1' > 19 - resolve issues found in test > vxml: Add which volume could not be found to error message > Add and utilize virsh_version_cmp > pool: Need to handle when there are no volumes in the default pool > > .../Profile/04_verify_libvirt_cim_slp_profiles.py | 2 +- > .../08_CreateDiskResourcePool.py | 30 +++++-- > .../09_DeleteDiskPool.py | 19 +++-- > .../10_create_storagevolume.py | 6 +- > .../11_create_dir_storagevolume_errs.py | 5 +- > .../12_create_netfs_storagevolume_errs.py | 5 +- > .../13_delete_storagevolume.py | 5 +- > .../14_delete_storagevolume_errs.py | 5 +- > .../15_DiskPoolAutostart.py | 15 +++- > .../SettingsDefineCapabilities/01_forward.py | 1 - > .../libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py | 2 +- > .../06_addresource.py | 2 +- > .../08_modifyresource.py | 4 +- > .../13_refconfig_additional_devs.py | 4 +- > .../15_mod_system_settings.py | 11 ++- > .../18_define_sys_bridge.py | 2 +- > .../19_definenetwork_ers.py | 23 +++--- > .../22_addmulti_brg_interface.py | 2 +- > .../27_definesystem_macvtap_dev.py | 19 ++++- > .../28_definesystem_with_vsi_profile.py | 15 ++++ > suites/libvirt-cim/lib/XenKvmLib/common_util.py | 93 +++++++++++++++++----- > suites/libvirt-cim/lib/XenKvmLib/const.py | 6 +- > suites/libvirt-cim/lib/XenKvmLib/pool.py | 10 +-- > suites/libvirt-cim/lib/XenKvmLib/rasd.py | 10 ++- > suites/libvirt-cim/lib/XenKvmLib/test_xml.py | 2 +- > suites/libvirt-cim/lib/XenKvmLib/vxml.py | 4 +- > suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py | 6 ++ > suites/libvirt-cim/main.py | 15 ++++ > 28 files changed, 237 insertions(+), 86 deletions(-) > > -- > 1.8.1.4 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cngesaint at outlook.com Sun Apr 28 07:24:23 2013 From: cngesaint at outlook.com (WangXu) Date: Sun, 28 Apr 2013 07:24:23 +0000 Subject: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable In-Reply-To: References: <51797133.5010600@redhat.com>, Message-ID: I'm afraid that vsi_support_key_string and llpdtool_query_options may can not lead to memory leak. After checked code carefully, I found that's static varaible in get method so no matter how many get method called, just one memory space allocated. So please do not worry about them. From: cngesaint at outlook.com To: libvirt-cim at redhat.com Date: Sun, 28 Apr 2013 02:28:18 +0000 Subject: Re: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable > Date: Thu, 25 Apr 2013 14:08:51 -0400 > From: jferlan at redhat.com > To: libvirt-cim at redhat.com > Subject: Re: [Libvirt-cim] [PATCH 3/3] make lldptool command and support output configurable > > > For some reason the original email never made it into my inbox, so I've > had to cut-n-paste from the mail list archives and I hope I picked the > right message-id for the messages to line up properly!!! > > > > > From: Xu Wang > > > > There's no commit message? > > > Signed-off-by: Xu Wang > > --- > > libvirt-cim.conf | 14 ++++++++++ > > libxkutil/misc_util.c | 18 +++++++++++++ > > libxkutil/misc_util.h | 2 + > > src/Virt_SwitchService.c | 63 ++++++++++++++++++++++++++++++++++++++-------- > > 4 files changed, 86 insertions(+), 11 deletions(-) > > > > diff --git a/libvirt-cim.conf b/libvirt-cim.conf > > index 3244ee3..396dac9 100644 > > --- a/libvirt-cim.conf > > +++ b/libvirt-cim.conf > > @@ -38,3 +38,17 @@ > > # Default value: false > > # > > # force_use_qemu = false; > > + > > +# lldptool_query_options (string) > > +# Defines the command used in SwitchService to query VEPA support, will be > > +# used as "lldptool -i [INTERFACE] [OPTIONS]" > > +# > > +# lldptool_query_options = "-t -g ncb -V evbcfg"; > > + > > +# vsi_support_key_string (string) > > +# Defines the string used in SwitchService to search in lldptool's output > > +# When lldptool updates its output, please update the new output into the > > +# output set. add comma between items. > > +# > > +# vsi_support_key_string = "{ supported forwarding mode: (0x40) reflective relay," > > +# " supported capabilities: (0x7) RTE ECP VDP}"; > > The code later indicates all the strings have to be there; however, the > comments here do not match that. There's also no mention here that at > most 8 lines can be added. Hopefully we never need to go beyond that > number (however arbitrary 8 is). Is the semicolon mandatory? Seems to > me whatever format is required needs to be well documented. I'll supplement about format of vsi_support_key_string and limit of items about it into comment. > > With respect to the strings and the parsing done, should I 'assume' that > the config_lookup_string() will know how to read the config file where > elements span multiple lines.... In particular, is > > "line1," > "line2" > > read/returned as "line1,line2"? > > I would think a continuation "\" marker would be necessary: > > "line1," \ > "line2" It's OK without slash (It was successful under my test). I haven't test for the format like above. > > I would also think the comma would be outside the quotes, but don't have > experience with the API in question. The application read vsi_support_key_string as a whole string and use comma to slice them (e.g.,above string will be devided into 2 parts, one before comma and the other one after comma) > > Since I don't have a way to test this - I'm curious while coding this up > if you checked that both lines were read when parsing? You can adjust value of vsi_support_key_string and then the output of CU_DEBUG in the log would changed as your change. I made every item would write into /var/log/libvirt-cim/debug.txt > > Secondarily, there's some extraneous spaces which perhaps need to be > cleaned up. Since the code later on will separate based on ",". What > happens if message #3 comes along some day as: > > "support feature1, feature2, and feature3: (0x83) mumbly fratz" I took many cases into consideration. At last I think all special symbols are not safe because all of them could appear in the future output. So I picked ",". If someday "," appeared in output, there are just two places need to be updated. Firstly, delimiter set in the variable delim (now is "," "{" and "}"). Secondly, content of vsi_support_key_string and its comments. If you have any better suggestions please let me know. > > > > > > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > > index 4c0b0a1..6ce8dca 100644 > > --- a/libxkutil/misc_util.c > > +++ b/libxkutil/misc_util.c > > @@ -244,6 +244,24 @@ const char *get_mig_ssh_tmp_key(void) > > return prop.value_string; > > } > > > > +const char *get_lldptool_query_options(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "lldptool_query_options", CONFIG_STRING, {0}, 0}; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > +const char *get_vsi_support_key_string(void) > > +{ > > + static LibvirtcimConfigProperty prop = { > > + "vsi_support_key_string", CONFIG_STRING, {0}, 0};; > > + > > + libvirt_cim_config_get(&prop); > > + return prop.value_string; > > +} > > + > > virConnectPtr connect_by_classname(const CMPIBroker *broker, > > const char *classname, > > CMPIStatus *s) > > diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h > > index 9e6b419..4eb588d 100644 > > --- a/libxkutil/misc_util.h > > +++ b/libxkutil/misc_util.h > > @@ -155,6 +155,8 @@ int virt_set_status(const CMPIBroker *broker, > > /* get libvirt-cim config */ > > const char *get_mig_ssh_tmp_key(void); > > bool get_force_use_qemu(void); > > +const char *get_lldptool_query_options(void); > > +const char *get_vsi_support_key_string(void); > > > > /* > > * Local Variables: > > diff --git a/src/Virt_SwitchService.c b/src/Virt_SwitchService.c > > index 8991426..f7bafbf 100644 > > --- a/src/Virt_SwitchService.c > > +++ b/src/Virt_SwitchService.c > > @@ -46,12 +46,26 @@ static CMPIStatus check_vsi_support(char *command) > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > char buff[MAX_LEN]; > > FILE *stream = NULL; > > - const char *searchStr[] = {" supported forwarding mode: " > > - "(0x40) reflective relay", > > - " supported capabilities: " > > - "(0x07) RTE ECP VDP", > > - NULL}; > > - int matched = 0; > > + char *searchStr[8]; /* maximum items of vsi support output */ > > + int count = 0; > > + const char *user_settings = get_vsi_support_key_string(); > > + char *vsi_support_key_string = NULL; > > + char *delim = "{},"; > > + int matched = 0; > > + char *temp = NULL; > > + > > + if (!user_settings) { > > + user_settings = "{ supported forwarding mode: " > > + "(0x40) reflective relay," > > + " supported capabilities: " > > + "(0x7) RTE ECP VDP}"; > > + } > > + > > + vsi_support_key_string = strdup(user_settings); > > There's a memory leak hear if 'user_settings' is returned from the api. > That code will strdup() whatever is returned, it's returned here, > strdup()'d again and leaked. Yes, so it is. > > > > + if (vsi_support_key_string == NULL) { > > + CU_DEBUG("strdup vsi_support_key_string failed!"); > > I think you need to call cu_statusf here; otherwise, 's' returns as > {CMPI_RC_OK, NULL} > > > + goto out; > > + } > > > > // Run lldptool command to find vsi support. > > stream = popen(command, "r"); > > @@ -63,6 +77,25 @@ static CMPIStatus check_vsi_support(char *command) > > goto out; > > } > > > > + /* Slice vsi_support_key_string into items */ > > + searchStr[count] = strtok_r(vsi_support_key_string, delim, &temp); > > + if (searchStr[count] == NULL) { > > + CU_DEBUG("searchStr fetch failed when calling strtok_r!"); > > + } else { > > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > > + count++; > > + } > > + > > + while ((searchStr[count] = strtok_r(NULL, delim, &temp))) { > > + if (count >= 7) { > > + CU_DEBUG("WARN: searchStr is full, left aborted!"); > > + break; > > + } else { > > + CU_DEBUG("searchStr[%d]: %s", count, searchStr[count]); > > + count++; > > + } > > + } > > + > > What if count == 0? That is can the element in the conf file be "{}"? Because the condition of vsi_support_key_string was set in the configuration file is the default output items for vsi support check need to be updated. So the level of vsi_support_key_string is higher than default. That's the use of keyword in the .conf file. So if a void content in the .conf file is not needed and should be commented out. I'll add this point into comment of .conf file. > > > // Read the output of the command. > > while (fgets(buff, MAX_LEN, stream) != NULL) { > > int i = 0; > > @@ -81,16 +114,18 @@ static CMPIStatus check_vsi_support(char *command) > > } > > /* All the search strings were found in the output of this > > command. */ > > - if (matched == 2) { > > + if (matched == count) { > > cu_statusf(_BROKER, &s, CMPI_RC_OK, "VSI supported"); > > - goto out;; > > + goto out; > > } > > } > > + > > cu_statusf(_BROKER, &s, > > CMPI_RC_ERR_NOT_FOUND, > > "No VSI Support found"); > > > > - out: > > + out: > > + free(vsi_support_key_string); > > if (stream != NULL) > > pclose(stream); > > return s; > > @@ -214,6 +249,7 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > int i; > > char **if_list; > > char cmd[MAX_LEN]; > > + const char *lldptool_query_options = NULL; > > > > *_inst = NULL; > > conn = connect_by_classname(broker, CLASSNAME(reference), &s); > > @@ -257,10 +293,15 @@ static CMPIStatus get_switchservice(const CMPIObjectPath *reference, > > > > CU_DEBUG("Found %d interfaces", count); > > > > + lldptool_query_options = get_lldptool_query_options(); > > + if (!lldptool_query_options) { > > + lldptool_query_options = "-t -g ncb -V evbcfg"; > > + } > > Memory leak if we are successful from get_lldptool_query_options() free() will be added. > > John > > > > > for (i=0; i > - sprintf(cmd, "lldptool -i %s -t -V evbcfg", if_list[i]); > > - CU_DEBUG("running command %s ...", cmd); > > + sprintf(cmd, "lldptool -i %s %s", > > + if_list[i], lldptool_query_options); > > + CU_DEBUG("running command [%s]", cmd); > > s = check_vsi_support(cmd); > > if (s.rc == CMPI_RC_OK) { > > vsi = true; > > -- > > 1.7.1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: