[PATCH] [TEST] Fixing testcase to account for different libvirt error string
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1301604051 25200
# Node ID 6d7dab79f4e8806aea65cb413c4f193cdbfc4f40
# Parent f0a7eee4cbe06cc4f618770ac149218a1bddb171
[TEST] Fixing testcase to account for different libvirt error string.
Noticed that this test was failing on some libvirt versions between
0.7.0 and 0.8.7 because libvirt was returning new error message. Latest
libvirt (0.8.7-5) is back to using error string from libvirt versions
prior to 0.7.0.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r f0a7eee4cbe0 -r 6d7dab79f4e8 suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Thu Mar 31 12:32:11 2011 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/19_definenetwork_ers.py Thu Mar 31 13:40:51 2011 -0700
@@ -125,10 +125,17 @@
if not ret:
status = verify_error(exp_rc, exp_desc, cxml)
if status != PASS:
- raise Exception('Defing domain with invalid %s name %s'
- ' gave unexpected rc code %s and '
- 'description:\n %s'% (nettype, field,
- cxml.err_rc, cxml.err_desc))
+ # There are few libvirt version between 0.7.0
+ # and 0.8.7 which give following error.
+ status = verify_error(exp_rc,
+ 'No Network bridge name specified',
+ cxml)
+ if status != PASS:
+ raise Exception('Defining domain with invalid %s'
+ ' name %s gave unexpected rc code'
+ ' %s and description:\n'
+ ' %s'% (nettype, field,
+ cxml.err_rc, cxml.err_desc))
continue
ret = cxml.cim_start(options.ip)
if ret:
13 years, 5 months
[PATCH] [TEST] Removing redundant test
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1301605604 25200
# Node ID 4bcde13186e6c9985efc3a11f050c76cf3daf3fa
# Parent c1d9565fff50d8aaa7990088b16a8364f563187a
[TEST] Removing redundant test.
This test is no longer needed as libvirt-cim does not
check for duplicate mac addresses. This check is now
done by libvirt.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r c1d9565fff50 -r 4bcde13186e6 suites/libvirt-cim/cimtest/VirtualSystemManagementService/23_verify_duplicate_mac_err.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/23_verify_duplicate_mac_err.py Thu Mar 31 13:50:32 2011 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2009 IBM Corp.
-#
-# Authors:
-# Yogananth subramanian <anantyog(a)linux.vnet.ibm.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# This testcase verifies definig network interface with conflicting MAC
-#
-
-from sys import exit
-from random import randint
-from pywbem import CIM_ERR_FAILED
-from XenKvmLib.vsms_util import add_net_res
-from XenKvmLib.vsms import get_vsms_class, get_nasd_class
-from XenKvmLib.vxml import get_class
-from CimTest.Globals import logger
-from CimTest.ReturnCodes import FAIL, PASS, SKIP
-from XenKvmLib.const import default_network_name, do_main
-from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
-from XenKvmLib.classes import get_typed_class
-from XenKvmLib.enumclass import GetInstance, EnumNames
-from XenKvmLib.const import get_provider_version
-
-sup_types = ['Xen', 'KVM', 'XenFV']
-default_dom = 'net_domain1'
-test_dom = 'brgtest_domain2'
-nmac = '99:aa:bb:cc:ee:ff'
-ntype = 'network'
-npool_name = default_network_name + str(randint(1, 100))
-exp_rc = CIM_ERR_FAILED
-exp_desc = "Conflicting MAC Addresses"
-
-dup_mac_rev = 929
-
-def cleanup_env(ip, virt, npool_name, cxml):
- cxml.cim_destroy(ip)
- cxml.undefine(ip)
- destroy_netpool(ip, virt, npool_name)
-
-def start_dom(cxml,ip,dom):
- ret = cxml.cim_define(ip)
- if not ret:
- status = cxml.verify_error_msg(exp_rc, exp_desc)
- if status != PASS:
- raise Exception("Got unexpected rc code %s and description %s"
- % (cxml.err_rc, cxml.err_desc))
- return FAIL
- ret = cxml.cim_start(ip)
- if ret:
- status = cxml.verify_error_msg(exp_rc, exp_desc)
- cxml.undefine(ip)
- if status != PASS:
- raise Exception("Got unexpected rc code %s and description %s"
- % (cxml.err_rc, cxml.err_desc))
- return FAIL
- return PASS
-
-@do_main(sup_types)
-def main():
- options = main.options
-
- rev, changeset = get_provider_version(options.virt, options.ip)
- if rev < dup_mac_rev:
- logger.error("Test only valid with provider version > %d", dup_mac_rev)
- return SKIP
-
- status, net_name = create_netpool_conf(options.ip, options.virt,
- use_existing=False,
- net_name=npool_name)
- if status != PASS:
- logger.error('Unable to create network pool')
- return FAIL
- cxml = get_class(options.virt)(default_dom, mac=nmac,
- ntype=ntype, net_name=npool_name)
- try:
- status = start_dom(cxml, options.ip, default_dom)
- if status == FAIL:
- raise Exception("Starting %s domain failed, got unexpeceted rc"
- "code %s and description %s" % (default_dom,
- cxml.err_rc, cxml.err_desc))
-
- except Exception, details:
- logger.error(details)
- destroy_netpool(options.ip, options.virt, net_name)
- return FAIL
-
- sxml = get_class(options.virt)(test_dom, mac=nmac,
- ntype=ntype, net_name=npool_name)
- try:
- status = start_dom(sxml, options.ip, test_dom)
-
- if status == PASS:
- sxml.cim_destroy(options.ip)
- sxml.undefine(options.ip)
- raise Exception("Was able to create two domains with"
- "Conflicting MAC Addresses")
-
- service = get_vsms_class(options.virt)(options.ip)
- classname = get_typed_class(options.virt, 'VirtualSystemSettingData')
- netpool = EnumNames(options.ip, classname)
-
- if options.virt == "XenFV":
- prefix = "Xen"
- else:
- prefix = options.virt
-
- inst_id = '%s:%s' % (prefix, default_dom)
- vssd_ref = None
- for i in range(0, len(netpool)):
- ret_pool = netpool[i].keybindings['InstanceID']
- if ret_pool == inst_id:
- vssd_ref = netpool[i]
- break
- if vssd_ref == None:
- raise Exception("Failed to get vssd_ref for '%s'"% default_dom)
-
- nasd = get_nasd_class(options.virt)(type=ntype, mac=nmac,
- name=default_dom,
- virt_net=npool_name)
- net_attr = { 'ntype' : ntype,
- 'net_name' : npool_name,
- 'nmac' : nmac
- }
-
- ret = add_net_res(options.ip, service, options.virt, cxml,
- vssd_ref, nasd, net_attr)
- if ret == PASS:
- raise Exception("AddRS should NOT return OK with duplicate MAC")
- else:
- status = PASS
-
- except Exception, details:
- logger.error(details)
- status = FAIL
-
- cleanup_env(options.ip, options.virt, npool_name, cxml)
- return status
-
-if __name__ == "__main__":
- exit(main())
-
13 years, 5 months
[PATCH] [TEST] Fix HostSystem/01_enum.py test
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1301597899 25200
# Node ID 434ee28b0c8000175c81ea7291d7bcf01756cfdd
# Parent e71cf5aa81f77498c18ad7d870a41ed9760d3c06
[TEST] Fix HostSystem/01_enum.py test
This test was not taking into account the localhost discovered by sblim providers.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r e71cf5aa81f7 -r 434ee28b0c80 suites/libvirt-cim/cimtest/HostSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Mon Mar 07 17:40:29 2011 -0800
+++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Thu Mar 31 11:58:19 2011 -0700
@@ -55,8 +55,12 @@
if ret == PASS:
if len(hs) != 0:
- logger.error("Unexpected instance returned")
- return FAIL
+ if hs[0].CreationClassName != name or hs[0].Name != host:
+ logger.error("Exp %s, got %s", name, hs[0].CreationClassName)
+ logger.error("Exp %s, got %s", host, hs[0].Name)
+ return FAIL
+ else:
+ return PASS
else:
if linux_cs.CreationClassName != 'Linux_ComputerSystem'\
or linux_cs.Name != host:
13 years, 5 months
[PATCH] [TEST] Conditionally fail if VSI hardware not available
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1301604632 25200
# Node ID c1d9565fff50d8aaa7990088b16a8364f563187a
# Parent 6d7dab79f4e8806aea65cb413c4f193cdbfc4f40
[TEST] Conditionally fail if VSI hardware not available.
This test requires VSI capable hardware to run successfully.
On non-vsi hosts, the test was failing, changed it to fail
conditionally now giving detailed cause of failure.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 6d7dab79f4e8 -r c1d9565fff50 suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py Thu Mar 31 13:40:51 2011 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py Thu Mar 31 13:50:32 2011 -0700
@@ -179,29 +179,34 @@
try:
rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn)
if len(rasd_list) < 1:
+ status = FAIL
raise Exception("Unable to get template RASDs for %s" % test_dom)
cxml = get_class(virt)(test_dom)
cxml.set_res_settings(rasd_list)
ret = cxml.cim_define(server)
if not ret:
+ status = FAIL
raise Exception("Unable to define guest %s" % test_dom)
status = cxml.cim_start(server)
if status != PASS:
- raise Exception("Unable to start %s" % test_dom)
+ status = XFAIL
+ raise Exception("Unable to start VM "
+ "*** Is VSI support available on this host? ***")
status, inst = get_net_inst(server, nrasd_cn, test_dom)
if status != PASS:
+ status = FAIL
raise Exception("Failed to get net interface for %s" % test_dom)
status = verify_net_rasd(server, virt, vsi_defaults, inst)
if status != PASS:
+ status = FAIL
logger.error("Failed to verify net interface for %s", test_dom)
except Exception, details:
logger.error(details)
- status = FAIL
cxml.cim_destroy(server)
cxml.undefine(server)
13 years, 5 months
[PATCH] Add support for console/serial grahpics devices
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1301520765 14400
# Node ID c241ce1cae4e8c55f84667896beb0683fdb3f42c
# Parent a521a11eeec4b41399ca954ab17b874a708eb4b3
Add support for console/serial grahpics devices
Add support for Graphics RASD ResourceSubType = console | serial. This includes support for
allowing more than a single graphics RASD instance. Instances can be created externally or
during DefineSystem. No changes to current level of hotswapping.
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -40,7 +40,8 @@
#define NET_XPATH (xmlChar *)"/domain/devices/interface"
#define EMU_XPATH (xmlChar *)"/domain/devices/emulator"
#define MEM_XPATH (xmlChar *)"/domain/memory | /domain/currentMemory"
-#define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics"
+#define GRAPHICS_XPATH (xmlChar *)"/domain/devices/graphics | "\
+ "/domain/devices/console | /domain/devices/serial"
#define INPUT_XPATH (xmlChar *)"/domain/devices/input"
#define DEFAULT_BRIDGE "xenbr0"
@@ -501,6 +502,7 @@
{
struct virt_device *vdev = NULL;
struct graphics_device *gdev = NULL;
+ xmlNode *child = NULL;
vdev = calloc(1, sizeof(*vdev));
if (vdev == NULL)
@@ -509,24 +511,46 @@
gdev = &(vdev->dev.graphics);
gdev->type = get_attr_value(node, "type");
- gdev->port = get_attr_value(node, "port");
- gdev->host = get_attr_value(node, "listen");
- gdev->keymap = get_attr_value(node, "keymap");
-
if (gdev->type == NULL)
goto err;
+ CU_DEBUG("graphics device type = %s", gdev->type);
+
if (STREQC(gdev->type, "vnc")) {
- if (gdev->port == NULL)
- goto err;
+ gdev->port = get_attr_value(node, "port");
+ gdev->host = get_attr_value(node, "listen");
+ gdev->keymap = get_attr_value(node, "keymap");
+ }
+ else if (STREQC(gdev->type, "pty")) {
+ free(gdev->type);
+ gdev->type = strdup((char *)node->name);
- if (gdev->host == NULL)
- goto err;
+ for (child = node->children; child != NULL;
+ child = child->next) {
+ if (XSTREQ(child->name, "source"))
+ gdev->host = get_attr_value(child, "path");
+ else if (XSTREQ(child->name, "target"))
+ gdev->port = get_attr_value(child, "port");
+ }
}
+ else {
+ CU_DEBUG("Unknown graphics type %s", gdev->type);
+ goto err;
+ }
+
+ if (gdev->port == NULL || gdev->host == NULL)
+ goto err;
vdev->type = CIM_RES_TYPE_GRAPHICS;
vdev->id = strdup("graphics");
+ /* FIXME: IDs should be unique, but that breaks existing tests.
+ ret = asprintf(&vdev->id, "graphics:%s", gdev->type);
+ if(ret == -1) {
+ CU_DEBUG("Failed to create graphics is string");
+ goto err;
+ } */
+
*vdevs = vdev;
return 1;
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -401,43 +401,87 @@
return NULL;
}
+static const char *graphics_vnc_xml(xmlNodePtr root,
+ struct graphics_device *dev)
+{
+ xmlNodePtr tmp = NULL;
+
+ tmp = xmlNewChild(root, NULL, BAD_CAST "graphics", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+
+ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
+
+ if (STREQC(dev->type, "sdl"))
+ return NULL;
+
+ xmlNewProp(root, BAD_CAST "port", BAD_CAST dev->port);
+
+ if (STREQC(dev->port, "-1"))
+ xmlNewProp(root, BAD_CAST "autoport", BAD_CAST "yes");
+ else
+ xmlNewProp(root, BAD_CAST "autoport", BAD_CAST "no");
+
+ xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host);
+
+ if (dev->passwd != NULL)
+ xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd);
+
+ xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap);
+
+ return NULL;
+}
+
+static const char *graphics_pty_xml(xmlNodePtr root,
+ struct graphics_device *dev)
+{
+ xmlNodePtr pty = NULL;
+ xmlNodePtr tmp = NULL;
+
+ pty = xmlNewChild(root, NULL, BAD_CAST dev->type, NULL);
+ if (pty == NULL)
+ return XML_ERROR;
+
+ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST "pty");
+
+ tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+
+ xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host);
+
+ tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+
+ xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port);
+
+ return NULL;
+}
+
static const char *graphics_xml(xmlNodePtr root, struct domain *dominfo)
{
+ const char *msg = NULL;
int i;
for (i = 0; i < dominfo->dev_graphics_ct; i++) {
- xmlNodePtr tmp;
struct virt_device *_dev = &dominfo->dev_graphics[i];
if (_dev->type == CIM_RES_TYPE_UNKNOWN)
continue;
struct graphics_device *dev = &_dev->dev.graphics;
- tmp = xmlNewChild(root, NULL, BAD_CAST "graphics", NULL);
- if (tmp == NULL)
- return XML_ERROR;
-
- xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
-
- if (STREQC(dev->type, "sdl"))
- goto out;
-
- if (STREQC(dev->port, "-1"))
- xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes");
- else {
- xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no");
- xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port);
- }
- xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host);
- xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap);
-
- if (dev->passwd != NULL)
- xmlNewProp(tmp,
- BAD_CAST "passwd",
- BAD_CAST dev->passwd);
+ if (STREQC(dev->type, "vnc") || STREQC(dev->type, "sdl"))
+ msg = graphics_vnc_xml(root, dev);
+ else if (STREQC(dev->type, "console") || STREQC(dev->type, "serial"))
+ msg = graphics_pty_xml(root, dev);
+ else
+ continue;
+
+ if(msg != NULL)
+ return msg;
}
- out:
return NULL;
}
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof
+++ b/schema/ResourceAllocationSettingData.mof
@@ -216,8 +216,10 @@
]
class Xen_GraphicsResourceAllocationSettingData : Xen_ResourceAllocationSettingData
{
- [Description ("VNC Address. IPv4 in a.b.c.d:port or"
- "IPv6 in [ip]:port format")]
+ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
+ "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType "
+ "is 'console', this is a character device path in "
+ "path:port format (e.g., '/dev/pts/3:0'\)")]
string Address;
[Description ("Keyboard keymapping")]
@@ -235,8 +237,10 @@
]
class KVM_GraphicsResourceAllocationSettingData : KVM_ResourceAllocationSettingData
{
- [Description ("VNC Address. IPv4 in a.b.c.d:port or"
- "IPv6 in [ip]:port format")]
+ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
+ "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType "
+ "is 'console', this is a character device path in "
+ "path:port format (e.g., '/dev/pts/3:0'\)")]
string Address;
[Description ("Keyboard keymapping")]
@@ -254,8 +258,10 @@
]
class LXC_GraphicsResourceAllocationSettingData : LXC_ResourceAllocationSettingData
{
- [Description ("VNC Address. IPv4 in a.b.c.d:port or"
- "IPv6 in [ip]:port format")]
+ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
+ "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType "
+ "is 'console', this is a character device path in "
+ "path:port format (e.g., '/dev/pts/3:0'\)")]
string Address;
[Description ("Keyboard keymapping")]
diff --git a/src/Virt_Device.c b/src/Virt_Device.c
--- a/src/Virt_Device.c
+++ b/src/Virt_Device.c
@@ -189,14 +189,13 @@
int rc;
char *vp_str = NULL;
- if (STREQC(dev->type, "vnc"))
+ if (STREQC(dev->type, "sdl"))
+ rc = asprintf(&vp_str, "%s", dev->type);
+ else
rc = asprintf(&vp_str, "%s/%s:%s",
dev->type,
dev->host,
dev->port);
- else
- rc = asprintf(&vp_str, "%s", dev->type);
-
if (rc == -1)
return 0;
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -421,44 +421,57 @@
CMSetProperty(inst, "ResourceSubType",
(CMPIValue *)dev->dev.graphics.type, CMPI_chars);
- if (STREQC(dev->dev.graphics.type, "vnc")) {
+ if (STREQC(dev->dev.graphics.type, "sdl"))
+ rc = asprintf(&addr_str, "%s", dev->dev.graphics.type);
+ else {
rc = asprintf(&addr_str,
- "%s:%s",
+ "%s:%s:%s",
+ dev->dev.graphics.type,
dev->dev.graphics.host,
dev->dev.graphics.port);
- if (rc == -1)
+ }
+
+ CU_DEBUG("graphics Address = %s", addr_str);
+
+ if (rc == -1)
+ goto out;
+
+ CMSetProperty(inst, "Address",
+ (CMPIValue *)addr_str, CMPI_chars);
+
+ if (STREQC(dev->dev.graphics.type, "vnc")) {
+ CMSetProperty(inst, "KeyMap",
+ (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars);
+
+ conn = connect_by_classname(_BROKER, classname, &s);
+ if (conn == NULL)
goto out;
- CMSetProperty(inst, "Address",
- (CMPIValue *)addr_str, CMPI_chars);
+ dom = virDomainLookupByName(conn, name);
+ if (dom == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Domain %s not found",
+ name);
+ goto out;
+ }
- CMSetProperty(inst, "KeyMap",
- (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars);
+ infostore = infostore_open(dom);
+ if (infostore != NULL)
+ has_passwd = infostore_get_bool(infostore,
+ "has_vnc_passwd");
+
+ if (has_passwd) {
+ CU_DEBUG("has password");
+ CMSetProperty(inst, "Password",
+ (CMPIValue *)"********", CMPI_chars);
+ }
+
+ infostore_close(infostore);
+
+ /* FIXME: Populate the IsIPv6Only */
}
- conn = connect_by_classname(_BROKER, classname, &s);
- if (conn == NULL)
- goto out;
-
- dom = virDomainLookupByName(conn, name);
- if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "Domain %s not found",
- name);
- goto out;
- }
-
- infostore = infostore_open(dom);
- if (infostore != NULL)
- has_passwd = infostore_get_bool(infostore, "has_vnc_passwd");
-
- if (has_passwd)
- CMSetProperty(inst, "Password",
- (CMPIValue *)"********", CMPI_chars);
-
- infostore_close(infostore);
-
out:
free(addr_str);
virDomainFree(dom);
diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c
+++ b/src/Virt_SettingsDefineCapabilities.c
@@ -1694,10 +1694,9 @@
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_GRAPHICS, DEVICE_RASD);
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
-
+ CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars);
+
if (STREQC(type, "vnc")) {
- CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars);
-
CMSetProperty(inst, "KeyMap", (CMPIValue *)"en-us", CMPI_chars);
}
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -405,7 +405,7 @@
static bool add_default_devs(struct domain *domain)
{
- if (domain->dev_graphics_ct != 1) {
+ if (domain->dev_graphics_ct < 1) {
if (!default_graphics_device(domain))
return false;
}
@@ -1027,6 +1027,41 @@
return NULL;
}
+static int parse_console_address(const char *id,
+ char **path,
+ char **port)
+{
+ int ret;
+ char *tmp_path = NULL;
+ char *tmp_port = NULL;
+
+ CU_DEBUG("Entering parse_console_address, address is %s", id);
+
+ ret = sscanf(id, "%a[^:]:%as", &tmp_path, &tmp_port);
+
+ if (ret != 2) {
+ ret = 0;
+ goto out;
+ }
+
+ if (path)
+ *path = strdup(tmp_path);
+
+ if (port)
+ *port = strdup(tmp_port);
+
+ ret = 1;
+
+ out:
+ CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
+ *path, *port);
+
+ free(tmp_path);
+ free(tmp_port);
+
+ return ret;
+}
+
static int parse_vnc_address(const char *id,
char **ip,
char **port)
@@ -1068,9 +1103,8 @@
static const char *graphics_rasd_to_vdev(CMPIInstance *inst,
struct virt_device *dev)
{
- const char *val;
+ const char *val = NULL;
const char *msg = NULL;
- const char *keymap;
bool ipv6 = false;
int ret;
@@ -1080,36 +1114,67 @@
}
dev->dev.graphics.type = strdup(val);
+ CU_DEBUG("graphics type = %s", dev->dev.graphics.type);
+
/* FIXME: Add logic to prevent address:port collisions */
- if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
- CU_DEBUG("no graphics port defined, giving default");
- if (cu_get_bool_prop(inst, "IsIPv6Only", &ipv6) != CMPI_RC_OK)
- ipv6 = false;
- if (ipv6)
- dev->dev.graphics.host = strdup("[::1]");
- else
- dev->dev.graphics.host = strdup("127.0.0.1");
- dev->dev.graphics.port = strdup("-1");
- } else {
- ret = parse_vnc_address(val,
- &dev->dev.graphics.host,
- &dev->dev.graphics.port);
+ if (STREQC(dev->dev.graphics.type, "vnc")) {
+ if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
+ CU_DEBUG("graphics Address empty, using default");
+
+ if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) != CMPI_RC_OK)
+ ipv6 = false;
+
+ if(ipv6)
+ val = "[::1]:-1";
+ else
+ val = "127.0.0.1:-1";
+ }
+
+ ret = parse_vnc_address(val,
+ &dev->dev.graphics.host,
+ &dev->dev.graphics.port);
if (ret != 1) {
msg = "GraphicsRASD field Address not valid";
goto out;
}
+
+ if (cu_get_str_prop(inst, "KeyMap", &val) != CMPI_RC_OK)
+ dev->dev.graphics.keymap = strdup("en-us");
+ else
+ dev->dev.graphics.keymap = strdup(val);
+
+ if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) {
+ CU_DEBUG("vnc password is not set");
+ dev->dev.graphics.passwd = NULL;
+ } else {
+ CU_DEBUG("vnc password is set");
+ dev->dev.graphics.passwd = strdup(val);
+ }
}
-
- if (cu_get_str_prop(inst, "KeyMap", &keymap) != CMPI_RC_OK)
- keymap = "en-us";
-
- dev->dev.graphics.keymap = strdup(keymap);
-
- if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) {
- dev->dev.graphics.passwd = NULL;
- } else {
- dev->dev.graphics.passwd = strdup(val);
- }
+ else if (STREQC(dev->dev.graphics.type, "console") ||
+ STREQC(dev->dev.graphics.type, "serial")) {
+ if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
+ CU_DEBUG("graphics Address empty, using default");
+ val = "/dev/pts/0:0";
+ }
+
+ ret = parse_console_address(val,
+ &dev->dev.graphics.host,
+ &dev->dev.graphics.port);
+ if (ret != 1) {
+ msg = "GraphicsRASD field Address not valid";
+ goto out;
+ }
+ } else {
+ CU_DEBUG("Unsupported graphics type %s", dev->dev.graphics.type);
+ msg = "Unsupported graphics type";
+ goto out;
+ }
+
+ CU_DEBUG("graphics = %s:%s:%s",
+ dev->dev.graphics.type,
+ dev->dev.graphics.host,
+ dev->dev.graphics.port);
out:
return msg;
@@ -1358,11 +1423,19 @@
ncount,
&domain->dev_net_ct);
} else if (type == CIM_RES_TYPE_GRAPHICS) {
- domain->dev_graphics_ct = 1;
+ struct virt_device dev;
+ int ncount = count + domain->dev_graphics_ct;
+
+ memset(&dev, 0, sizeof(dev));
msg = rasd_to_vdev(inst,
domain,
- &domain->dev_graphics[0],
+ &dev,
ns);
+ if (msg == NULL)
+ msg = add_device_nodup(&dev,
+ domain->dev_graphics,
+ ncount,
+ &domain->dev_graphics_ct);
} else if (type == CIM_RES_TYPE_INPUT) {
domain->dev_input_ct = 1;
msg = rasd_to_vdev(inst,
13 years, 5 months
Fwd: Re: [PATCH] [TEST] New test to check SwitchService provider
by Chip Vincent
Meant to paste this:
Testing KVM hypervisor
--------------------------------------------------------------------
SwitchService - 01_enum.py: XFAIL
Please check if this is the expected result ---
*** VSI NOT supported ***
--------------------------------------------------------------------
-------- Original Message --------
Subject: Re: [Libvirt-cim] [PATCH] [TEST] New test to check
SwitchService provider
Date: Wed, 30 Mar 2011 11:13:42 -0400
From: Chip Vincent <cvincent(a)linux.vnet.ibm.com>
Reply-To: cvincent(a)linux.vnet.ibm.com
To: libvirt-cim(a)redhat.com
Testing KVM hypervisor
--------------------------------------------------------------------
VSSD - 07_autostart.py: PASS
--------------------------------------------------------------------
+1 I don't have the proper HW so this is the expected result.
On 03/08/2011 06:50 AM, Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra<snmishra(a)us.ibm.com>
> # Date 1299548429 28800
> # Node ID f5bc7977f2d5813474b2c56981bd93e2cf9d96b7
> # Parent 4f2bf0006818d2ca4903a0b550dde65e4d581d7c
> [TEST] New test to check SwitchService provider
>
> This test enumerates SwitchService and checks to see if VSI is supported or not.
>
> Signed-off-by: Sharad Mishra<snmishra(a)us.ibm.com>
>
> diff -r 4f2bf0006818 -r f5bc7977f2d5 suites/libvirt-cim/cimtest/SwitchService/01_enum.py
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/suites/libvirt-cim/cimtest/SwitchService/01_enum.py Mon Mar 07 17:40:29 2011 -0800
> @@ -0,0 +1,51 @@
> +#!/usr/bin/python
> +#
> +# Copyright 2011 IBM Corp.
> +#
> +# Authors:
> +# Sharad Mishra<snmishra(a)us.ibm.com>
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> +#
> +
> +import sys
> +from XenKvmLib.const import do_main
> +from XenKvmLib import enumclass
> +from XenKvmLib.classes import get_typed_class
> +from CimTest.Globals import logger
> +from CimTest.ReturnCodes import XFAIL
> +
> +SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
> +
> +@do_main(SUPPORTED_TYPES)
> +def main():
> + options = main.options
> +
> + cs_class = get_typed_class(options.virt, 'SwitchService')
> + try:
> + cs = enumclass.EnumInstances(options.ip, cs_class)
> + print "Please check if this is the expected result ---"
> + for name in cs:
> + if name.IsVSISupported:
> + print "*** VSI supported ***"
> + else:
> + print "*** VSI NOT supported ***"
> + except Exception, detail:
> + logger.error("Exception: %s", detail)
> +
> + return XFAIL
> +
> +if __name__ == "__main__":
> + sys.exit(main())
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent(a)linux.vnet.ibm.com
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent(a)linux.vnet.ibm.com
13 years, 5 months
[PATCH] [TEST] New test to check SwitchService provider
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1299548429 28800
# Node ID f5bc7977f2d5813474b2c56981bd93e2cf9d96b7
# Parent 4f2bf0006818d2ca4903a0b550dde65e4d581d7c
[TEST] New test to check SwitchService provider
This test enumerates SwitchService and checks to see if VSI is supported or not.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4f2bf0006818 -r f5bc7977f2d5 suites/libvirt-cim/cimtest/SwitchService/01_enum.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/SwitchService/01_enum.py Mon Mar 07 17:40:29 2011 -0800
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+#
+# Copyright 2011 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+import sys
+from XenKvmLib.const import do_main
+from XenKvmLib import enumclass
+from XenKvmLib.classes import get_typed_class
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import XFAIL
+
+SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
+
+@do_main(SUPPORTED_TYPES)
+def main():
+ options = main.options
+
+ cs_class = get_typed_class(options.virt, 'SwitchService')
+ try:
+ cs = enumclass.EnumInstances(options.ip, cs_class)
+ print "Please check if this is the expected result ---"
+ for name in cs:
+ if name.IsVSISupported:
+ print "*** VSI supported ***"
+ else:
+ print "*** VSI NOT supported ***"
+ except Exception, detail:
+ logger.error("Exception: %s", detail)
+
+ return XFAIL
+
+if __name__ == "__main__":
+ sys.exit(main())
13 years, 5 months
[PATCH] [TEST] Test VM's AutoStart feature
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1298473315 28800
# Node ID 53f2cfb2a6ea2940b4de62fff16e3413419cb511
# Parent 4f2bf0006818d2ca4903a0b550dde65e4d581d7c
[TEST] Test VM's AutoStart feature.
This testcase will create VM, get its AutoStart setting and compare against expected value. Then it changes AutoStart, modifies the VM and reads the AutoStart back to verify that it was changed.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4f2bf0006818 -r 53f2cfb2a6ea suites/libvirt-cim/cimtest/VSSD/07_autostart.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VSSD/07_autostart.py Wed Feb 23 07:01:55 2011 -0800
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# This test will create a VM, get its autostart setting and compare against
+# the expected value. Then it sets the autostart to '1', and Modifies the VM.
+# Updated VM's autostart is read and compared. Then once more autostart is reset
+# and VM updated. Updated VM's autostart is again compared.
+#
+
+import sys
+import time
+import pywbem
+from XenKvmLib import vsms
+from XenKvmLib import vxml
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.const import do_main
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.const import get_provider_version
+from pywbem.cim_types import Uint16
+
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+default_dom = 'uuid_domain'
+autostart_support = 1076
+
+def get_vssd(ip, virt, dom):
+ cn = get_typed_class(virt, "VirtualSystemSettingData")
+ inst = None
+
+ try:
+ if virt == "XenFV":
+ virt = "Xen"
+
+ key_list = {"InstanceID" : "%s:%s" % (virt, dom) }
+
+ inst = GetInstance(ip, cn, key_list, True)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL, inst
+
+ if inst is None:
+ return FAIL, inst
+
+ return PASS, inst
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ virt = options.virt
+ server = options.ip
+
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < autostart_support:
+ logger.info("Need provider version %d or greater to run testcase",
+ autostart_support)
+ return SKIP
+
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+
+ sxml = None
+ cxml = vxml.get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s", default_dom)
+ return FAIL
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ inst['AutoStart'] = Uint16(1)
+ vssd = inst_to_mof(inst)
+ service.ModifySystemSettings(SystemSettings=vssd)
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ if inst['AutoStart'] != Uint16(1):
+ raise Exception("Test failed, Autostart settings mismatch")
+
+ inst['AutoStart'] = Uint16(0)
+ vssd = inst_to_mof(inst)
+ service.ModifySystemSettings(SystemSettings=vssd)
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ if inst['AutoStart'] != Uint16(0):
+ raise Exception("Test failed, Autostart settings mismatch")
+
+ cxml.undefine(options.ip)
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
13 years, 5 months
[PATCH] [TEST] Look for SNIA profile while gathering SLP profiles
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1301420804 25200
# Node ID 4f37c9bb6b41d678f0cd019dded1c35cd617e339
# Parent 73e89596e15d229befd24a80f84806153b924a17
[TEST] Look for SNIA profile while gathering SLP profiles.
This cimtest was only looking at DMTF profiles and was not parsing SNIA profiles correctly. This patch fixes that issue.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 73e89596e15d -r 4f37c9bb6b41 suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py
--- a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py Tue Mar 29 10:23:32 2011 -0700
+++ b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py Tue Mar 29 10:46:44 2011 -0700
@@ -89,6 +89,16 @@
lines = line.split("RegisteredProfilesSupported")
dmtf_profiles = lines[1].split("DMTF")
for profile in dmtf_profiles:
+ snia = profile.split(",SNIA")
+ for sprofile in snia:
+ tmp_prof = sprofile.rsplit(":", 1)
+ if len(tmp_prof) < 2:
+ return []
+
+ temp_reg_ele = tmp_prof[1].rstrip(",")
+ reg_prof_name = temp_reg_ele.rstrip(")")
+ slp_profile_list.append(reg_prof_name)
+
tmp_prof = profile.rsplit(":", 1)
if len(tmp_prof) < 2:
return []
@@ -163,6 +173,8 @@
# Make sure all the Libvirt-CIM profiles are advertised via slp
if (libvirt_cim_reg_list) <= (slp_profile_list):
logger.info("Successfully verified the Libvirt-CIM profiles")
+ logger.info("Slp returned profile --> %s,\n Libvirt-CIM expected "
+ "profiles %s", slp_profile_list, libvirt_cim_reg_list)
return PASS
logger.error("Mismatch in the profiles registered")
13 years, 5 months
[PATCH] Add check to verify that sysname is not null
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1300897966 25200
# Node ID 6e35991ef06d5f568bdfb199921e8591b1cf6452
# Parent 62c565a5f71453b02cfcd1317e4a186f2ac1c519
Add check to verify that sysname is not null.
All string values like SystemCreationClass name and SystemName etc are not being checked for null before setting these properties.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_ConcreteComponent.c
--- a/src/Virt_ConcreteComponent.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_ConcreteComponent.c Wed Mar 23 09:32:46 2011 -0700
@@ -85,9 +85,16 @@
goto out;
CMAddKey(path, "CreationClassName", cn, CMPI_chars);
- CMAddKey(path, "SystemName", sys, CMPI_chars);
- CMAddKey(path, "SystemCreationClassName", syscc, CMPI_chars);
- CMAddKey(path, "DeviceID", bridge, CMPI_chars);
+
+ if (sys != NULL)
+ CMAddKey(path, "SystemName", sys, CMPI_chars);
+
+ if (syscc != NULL)
+ CMAddKey(path, "SystemCreationClassName",
+ syscc, CMPI_chars);
+
+ if (bridge != NULL)
+ CMAddKey(path, "DeviceID", bridge, CMPI_chars);
inst = CBGetInstance(_BROKER, context, path, NULL, s);
out:
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_ConsoleRedirectionService.c
--- a/src/Virt_ConsoleRedirectionService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_ConsoleRedirectionService.c Wed Mar 23 09:32:46 2011 -0700
@@ -67,11 +67,13 @@
CMSetProperty(inst, "Name",
(CMPIValue *)"ConsoleRedirectionService", CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
array = CMNewArray(broker, 1, CMPI_uint16, &s);
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(array))
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_Device.c
--- a/src/Virt_Device.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_Device.c Wed Mar 23 09:32:46 2011 -0700
@@ -344,8 +344,9 @@
if (conn) {
char *sccn = NULL;
sccn = get_typed_class(pfx_from_conn(conn), "ComputerSystem");
- CMSetProperty(instance, "SystemCreationClassName",
- (CMPIValue *)sccn, CMPI_chars);
+ if (sccn != NULL)
+ CMSetProperty(instance, "SystemCreationClassName",
+ (CMPIValue *)sccn, CMPI_chars);
free(sccn);
}
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_KVMRedirectionSAP.c
--- a/src/Virt_KVMRedirectionSAP.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_KVMRedirectionSAP.c Wed Mar 23 09:32:46 2011 -0700
@@ -76,17 +76,21 @@
pfx = class_prefix_name(CLASSNAME(ref));
sccn = get_typed_class(pfx, "ComputerSystem");
- CMSetProperty(inst, "Name",
- (CMPIValue *)id, CMPI_chars);
+ if (id != NULL)
+ CMSetProperty(inst, "Name",
+ (CMPIValue *)id, CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)port->name, CMPI_chars);
+ if (port->name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)port->name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)sccn, CMPI_chars);
+ if (sccn != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)sccn, CMPI_chars);
- CMSetProperty(inst, "ElementName",
- (CMPIValue *)id, CMPI_chars);
+ if (id != NULL)
+ CMSetProperty(inst, "ElementName",
+ (CMPIValue *)id, CMPI_chars);
prop_val = (uint16_t)CIM_CRS_VNC;
CMSetProperty(inst, "KVMProtocol",
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_ResourcePoolConfigurationService.c Wed Mar 23 09:32:46 2011 -0700
@@ -1200,11 +1200,13 @@
CMSetProperty(inst, "Name",
(CMPIValue *)"RPCS", CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
if (is_get_inst) {
s = cu_validate_ref(broker, reference, inst);
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_SwitchService.c
--- a/src/Virt_SwitchService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_SwitchService.c Wed Mar 23 09:32:46 2011 -0700
@@ -175,11 +175,13 @@
(CMPIValue *)"Switch Virtualization Capabilities",
CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
out:
return s;
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_VSMigrationService.c Wed Mar 23 09:32:46 2011 -0700
@@ -1698,11 +1698,13 @@
CMSetProperty(inst, "Name",
(CMPIValue *)"MigrationService", CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
if (is_get_inst) {
s = cu_validate_ref(broker, ref, inst);
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_VirtualSystemManagementService.c Wed Mar 23 09:32:46 2011 -0700
@@ -3057,11 +3057,13 @@
CMSetProperty(inst, "Name",
(CMPIValue *)"Management Service", CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
-
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
+
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
CMSetProperty(inst, "Changeset",
(CMPIValue *)LIBVIRT_CIM_CS, CMPI_chars);
diff -r 62c565a5f714 -r 6e35991ef06d src/Virt_VirtualSystemSnapshotService.c
--- a/src/Virt_VirtualSystemSnapshotService.c Mon Mar 21 21:35:54 2011 -0400
+++ b/src/Virt_VirtualSystemSnapshotService.c Wed Mar 23 09:32:46 2011 -0700
@@ -626,8 +626,8 @@
CMPIInstance *inst)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
- const char *name;
- const char *ccname;
+ const char *name = NULL;
+ const char *ccname = NULL;
s = get_host_system_properties(&name,
&ccname,
@@ -644,11 +644,13 @@
CMSetProperty(inst, "Name",
(CMPIValue *)"SnapshotService", CMPI_chars);
- CMSetProperty(inst, "SystemName",
- (CMPIValue *)name, CMPI_chars);
+ if (name != NULL)
+ CMSetProperty(inst, "SystemName",
+ (CMPIValue *)name, CMPI_chars);
- CMSetProperty(inst, "SystemCreationClassName",
- (CMPIValue *)ccname, CMPI_chars);
+ if (ccname != NULL)
+ CMSetProperty(inst, "SystemCreationClassName",
+ (CMPIValue *)ccname, CMPI_chars);
out:
return s;
13 years, 5 months