[PATCH] Include stat.h
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1274737698 25200
# Node ID db79e8c20f6217503c7152186fd37751da9ce9ec
# Parent 19ce54b3c16676a443c5df53562b0d67294dc04c
Include stat.h
This file should be included to support *stat* functions.
Signed-off-by: Sharad Mishra<snmishra(a)us.ibm.com>
diff -r 19ce54b3c166 -r db79e8c20f62 libxkutil/infostore.c
--- a/libxkutil/infostore.c Thu May 06 21:22:31 2010 -0400
+++ b/libxkutil/infostore.c Mon May 24 14:48:18 2010 -0700
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <inttypes.h>
+#include <sys/stat.h>
#include <sys/file.h>
#include <string.h>
14 years, 4 months
[PATCH] [TEST] Fixing a typo in the vsms/08_CreateDiskResourcePool.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1279889817 25200
# Node ID 4f2909dd0e2f9be6d3f32b0926d564d112ec2572
# Parent 77a48790e995d59b8e1824a84a12a5c5288750c4
[TEST] Fixing a typo in the vsms/08_CreateDiskResourcePool.py
Tested has been verified with KVM Libvirt-CIM Sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 77a48790e995 -r 4f2909dd0e2f suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py Fri Jul 23 05:49:15 2010 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py Fri Jul 23 05:56:57 2010 -0700
@@ -62,7 +62,7 @@
libvirt_netfs_pool_support=869
def get_pool_attr(server, pool_type, dp_types, rev):
- pool_attr = { "Path" : "/var/lib/libvirt/images/" }
+ pool_attr = { "Path" : "/var/lib/libvirt/images" }
if rev >= libvirt_netfs_pool_support and \
pool_type == dp_types['DISK_POOL_NETFS']:
14 years, 4 months
[PATCH] [TEST] Fixing the syntax error in vsms/27_definesystem_macvtap_dev.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1279889355 25200
# Node ID 77a48790e995d59b8e1824a84a12a5c5288750c4
# Parent f14d55353dd10846428b5b818e478eb6f8a0431e
[TEST] Fixing the syntax error in vsms/27_definesystem_macvtap_dev.py
Tested has been verified with KVM Libvirt-CIM Sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r f14d55353dd1 -r 77a48790e995 suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py Mon Mar 01 11:30:22 2010 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py Fri Jul 23 05:49:15 2010 -0700
@@ -98,7 +98,7 @@
return PASS
- do_main(sup_types)
+@do_main(sup_types)
def main():
options = main.options
14 years, 4 months
[PATCH] [TEST] Adding new tc to verify the VSI Libvirt-CIM feature
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1279271077 25200
# Node ID ae6e83c18a8490fc0c583f7d0b8568ae4b8d1efc
# Parent f14d55353dd10846428b5b818e478eb6f8a0431e
[TEST] Adding new tc to verify the VSI Libvirt-CIM feature.
Tested with KVM on RHEL with latest sources.
The test now checks with the 'VSIType' --> "802.1Qbg", we can improve the test case
to verify with 'VSIType' --> "802.1Qbh"
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r f14d55353dd1 -r ae6e83c18a84 suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py Fri Jul 16 02:04:37 2010 -0700
@@ -0,0 +1,213 @@
+#!/usr/bin/python
+#
+# Copyright 2010 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri <deeptik(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
+#
+# Purpose:
+# Verify provider's VSI support.
+#
+# Steps:
+# 1) Build RASD parameters, making sure to specify macvtap mode for network
+# interface and vsi values.
+# 2) Create guest
+# 3) Verify guest is defined properly and the vsi values assgined to the guest
+# are reflected in the NetRASD.
+#
+# Date: 16-07-2010
+#
+
+import sys
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL
+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
+from XenKvmLib.vxml import get_class
+from XenKvmLib.common_util import parse_instance_id
+from XenKvmLib.enumclass import EnumInstances
+
+sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = 'vsi_guest'
+bug_no = "00016"
+
+libvirt_cim_vsi_support = 1042
+
+def get_rasd_list(ip, virt, vsi_defaults, nrasd_cn):
+ rasds = get_default_rasds(ip, virt)
+ rasd_list = {}
+
+ for rasd in rasds:
+ if rasd.classname == nrasd_cn and "Default" in rasd['InstanceID']:
+
+ rasd['NetworkMode'] = vsi_defaults['NetworkMode']
+ rasd['NetworkType'] = vsi_defaults['NetworkType']
+ rasd['SourceDevice'] = vsi_defaults['SourceDevice']
+ rasd['VSIType'] = vsi_defaults['VSIType']
+ rasd['VSIManagerID'] = vsi_defaults['VSIManagerID']
+ rasd['VSITypeID'] = vsi_defaults['VSITypeID']
+ rasd['VSITypeIDVersion'] = vsi_defaults['VSITypeIDVersion']
+ # Currently Libvirt throws error when passing Profile id,
+ # add it when supported
+ # rasd['ProfileID'] = vsi_defaults['ProfileID']
+ rasd_list[rasd.classname] = inst_to_mof(rasd)
+ break
+
+ return rasd_list
+
+def get_net_inst(ip, nrasd_cn, guest_name):
+ inst = None
+ enum_list = EnumInstances(ip, nrasd_cn)
+
+ if enum_list < 1:
+ logger.error("No %s instances returned", nrasd_cn)
+ return FAIL, inst
+
+ for rasd in enum_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ logger.error("Unable to parse InstanceID: %s", rasd.InstanceID)
+ return FAIL, inst
+
+ if guest == guest_name:
+ inst = rasd
+ break
+
+ if inst is None:
+ logger.error("%s instance for %s not found", nrasd_cn, guest_name)
+ return FAIL, inst
+ else:
+ return PASS, inst
+
+
+def verify_net_rasd(ip, virt, vsi_defaults, inst):
+ try:
+ if inst.NetworkMode != vsi_defaults['NetworkMode']:
+ raise Exception("%s" % "NetworkMode", \
+ "%s" % inst.NetworkMode, \
+ "%s" % vsi_defaults['NetworkMode'],\
+ "%s" % FAIL)
+
+ if inst.SourceDevice != vsi_defaults['SourceDevice']:
+ raise Exception("%s" % "SourceDevice", \
+ "%s" % inst.SourceDevice, "%s" \
+ % vsi_defaults['SourceDevice'],\
+ "%s" % FAIL)
+
+ if inst.VSIType != vsi_defaults['VSIType']:
+ raise Exception("%s" % "VSIType", \
+ "%s" % inst.VSIType, "%s" \
+ % vsi_defaults['VSIType'], \
+ "%s" % FAIL)
+
+ # Once the bug is fixed change the status value from XFAIL to FAIL
+ if inst.VSIInstanceID == None:
+ raise Exception("%s" % "VSIInstanceID", \
+ "%s" % inst.VSIInstanceID, \
+ "%s" % "a value",\
+ "%s" % XFAIL)
+
+ if inst.VSITypeIDVersion != vsi_defaults['VSITypeIDVersion']:
+ raise Exception("%s" % "VSITypeIDVersion",
+ "%s" % inst.VSITypeIDVersion, \
+ "%s" % vsi_defaults['VSITypeIDVersion'],\
+ "%s" % XFAIL)
+
+ if inst.VSITypeID != vsi_defaults['VSITypeID']:
+ raise Exception("%s" % "VSITypeID", \
+ "%s" % inst.VSITypeID, \
+ "%s" % vsi_defaults['VSITypeID'], \
+ "%s" % XFAIL)
+
+ except Exception, (field, ret_val, exp_val, status):
+ logger.error("Mismatch in '%s' values", field)
+ logger.error("Got %s, Expected %s", ret_val, exp_val)
+ if status == "3":
+ return XFAIL_RC(bug_no)
+ return status
+
+ return PASS
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ server = options.ip
+ virt = options.virt
+
+ status = FAIL
+
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < libvirt_cim_vsi_support:
+ logger.error("VSI support is available in rev >= %s",
+ libvirt_cim_vsi_support)
+ return SKIP
+
+
+ # Currently Libvirt throws error when passing Profile id,
+ # add it when supported
+ # 'ProfileID' : "vsi_profile"
+ # Also, Libvirt returns error when 'VSIType' is 802.1Qbh
+ # The tc can be modified to loop for the different VSIType,
+ # when supported.
+ vsi_defaults = { 'NetworkMode' : "vepa",
+ 'NetworkType' : "direct",
+ 'SourceDevice' : "eth1",
+ 'VSIType' : "802.1Qbg",
+ 'VSIManagerID' : "12",
+ 'VSITypeID' : "0x12345",
+ 'VSITypeIDVersion' : "1"
+ }
+
+ nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+ status = FAIL
+
+ try:
+ rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn)
+ if len(rasd_list) < 1:
+ 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:
+ 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, inst = get_net_inst(server, nrasd_cn, test_dom)
+ if status != PASS:
+ raise Exception("Failed to get net interface for %s" % test_dom)
+
+ status = verify_net_rasd(server, virt, vsi_defaults, inst)
+ if status != PASS:
+ 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)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
14 years, 4 months
[PATCH] NetRASD enumeration to show VSI fields
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1279667490 18000
# Node ID 74e5764714b5e172ce703aee980544d7bc0d03b5
# Parent ad15531492da607d5aa44a4fa2c67f6ef41a6e1b
NetRASD enumeration to show VSI fields.
This fixes the bug where VSI fields were not populated for NetRASD.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r ad15531492da -r 74e5764714b5 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Jul 14 11:54:31 2010 -0400
+++ b/libxkutil/device_parsing.c Tue Jul 20 18:11:30 2010 -0500
@@ -77,7 +77,6 @@
free(dev->model);
free(dev->device);
free(dev->net_mode);
- cleanup_vsi_device(&dev->vsi);
}
static void cleanup_emu_device(struct emu_device *dev)
@@ -296,11 +295,55 @@
}
}
+static int parse_vsi_device(xmlNode *dnode, struct net_device *vdevs)
+{
+ struct vsi_device *vsi_dev = NULL;
+ xmlNode * child = NULL;
+
+ vsi_dev = calloc(1, sizeof(*vsi_dev));
+ if (vsi_dev == NULL)
+ goto err;
+
+ vsi_dev->vsi_type = get_attr_value(dnode, "type");
+ if (vsi_dev->vsi_type == NULL)
+ goto err;
+
+ for (child = dnode->children; child != NULL; child = child->next) {
+ if (XSTREQ(child->name, "parameters")) {
+ vsi_dev->manager_id = get_attr_value(child,
+ "managerid");
+ if (vsi_dev->manager_id == NULL)
+ goto err;
+
+ vsi_dev->type_id = get_attr_value(child, "typeid");
+ if (vsi_dev->type_id == NULL)
+ goto err;
+
+ vsi_dev->type_id_version =
+ get_attr_value(child, "typeidversion");
+ if (vsi_dev->type_id_version == NULL)
+ goto err;
+
+ vsi_dev->instance_id = get_attr_value(child,
+ "instanceid");
+ vsi_dev->profile_id = get_attr_value(child,
+ "profileid");
+ }
+ }
+
+ memcpy(&(vdevs->vsi), vsi_dev, sizeof(*vsi_dev));
+ return 1;
+
+err:
+ cleanup_vsi_device(vsi_dev);
+ free(vsi_dev);
+ return 0;
+}
+
static int parse_net_device(xmlNode *inode, struct virt_device **vdevs)
{
struct virt_device *vdev = NULL;
struct net_device *ndev = NULL;
- struct vsi_device *vsi_dev = NULL;
xmlNode *child = NULL;
vdev = calloc(1, sizeof(*vdev));
@@ -308,7 +351,6 @@
goto err;
ndev = &(vdev->dev.net);
- vsi_dev = &(ndev->vsi);
ndev->type = get_attr_value(inode, "type");
if (ndev->type == NULL)
@@ -340,24 +382,7 @@
if (ndev->model == NULL)
goto err;
} else if (XSTREQ(child->name, "virtualport")) {
- vsi_dev->vsi_type = get_attr_value(child, "type");
- if (vsi_dev->vsi_type == NULL)
- goto err;
- } else if (XSTREQ(child->name, "parameters")) {
- vsi_dev->manager_id = get_attr_value(child, "managerid");
- if (vsi_dev->manager_id == NULL)
- goto err;
-
- vsi_dev->type_id = get_attr_value(child, "typeid");
- if (vsi_dev->type_id == NULL)
- goto err;
-
- vsi_dev->type_id_version = get_attr_value(child, "typeidversion");
- if (vsi_dev->type_id_version == NULL)
- goto err;
-
- vsi_dev->instance_id = get_attr_value(child, "instanceid");
- vsi_dev->profile_id = get_attr_value(child, "profileid");
+ parse_vsi_device(child, ndev);
}
}
14 years, 4 months
[PATCH] Set default VM autostart value
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1279843221 25200
# Node ID d054bf0cab617f6ea47604d6bca11261961a1e73
# Parent 10160de3a1384c2c3dd9ac95d4aec3e3bece3050
Set default VM autostart value.
This patch fixes the issue of no default showing up for VMs that were created without autostart flag.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 10160de3a138 -r d054bf0cab61 libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Thu Jul 15 15:37:05 2010 -0700
+++ b/libxkutil/device_parsing.h Thu Jul 22 17:00:21 2010 -0700
@@ -135,6 +135,7 @@
char *name;
char *typestr; /*xen, kvm, etc */
char *uuid;
+ int autostart;
char *bootloader;
char *bootloader_args;
char *clock;
diff -r 10160de3a138 -r d054bf0cab61 schema/ComputerSystem.mof
--- a/schema/ComputerSystem.mof Thu Jul 15 15:37:05 2010 -0700
+++ b/schema/ComputerSystem.mof Thu Jul 22 17:00:21 2010 -0700
@@ -11,7 +11,7 @@
string UUID;
[Description("Flag to set VM autostart.")]
- boolean autoStart;
+ string autoStart;
};
@@ -27,7 +27,7 @@
string UUID;
[Description("Flag to set VM autostart.")]
- boolean autoStart;
+ string autoStart;
};
@@ -43,7 +43,7 @@
string UUID;
[Description("Flag to set VM autostart.")]
- boolean autoStart;
+ string autoStart;
};
diff -r 10160de3a138 -r d054bf0cab61 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Thu Jul 15 15:37:05 2010 -0700
+++ b/src/Virt_ComputerSystem.c Thu Jul 22 17:00:21 2010 -0700
@@ -65,6 +65,33 @@
return 1;
}
+/* Set the "autoStart" property of an instance from a domain */
+static int set_autostart_from_dom(virDomainPtr dom,
+ CMPIInstance *instance,
+ struct domain *dominfo)
+{
+ int autoFlag = 0;
+ char autovalue[16];
+
+ if((virDomainGetAutostart(dom, &autoFlag)) == -1) {
+ CU_DEBUG("Could not read autostart value from xml");
+ } else {
+ CU_DEBUG("Autostart for current domain is set to %d",
+ autoFlag);
+ dominfo->autostart = autoFlag;
+ }
+
+ if(autoFlag)
+ strcpy(autovalue, "enable");
+ else
+ strcpy(autovalue, "disable");
+
+ CMSetProperty(instance, "autoStart",
+ (CMPIValue *)autovalue, CMPI_chars);
+
+ return 1;
+}
+
/* Set the "UUID" property of an instance from a domain */
static int set_uuid_from_dom(virDomainPtr dom,
CMPIInstance *instance,
@@ -499,6 +526,15 @@
goto out;
}
+ if (!set_autostart_from_dom(dom, instance, domain)) {
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ virDomainGetConnect(dom),
+ "Unable to get domain autostart flag");
+
+ goto out;
+ }
+
if (!set_uuid_from_dom(dom, instance, &uuid)) {
virt_set_status(broker, &s,
CMPI_RC_ERR_FAILED,
diff -r 10160de3a138 -r d054bf0cab61 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Thu Jul 15 15:37:05 2010 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Thu Jul 22 17:00:21 2010 -0700
@@ -1356,7 +1356,8 @@
virDomainPtr dom;
const char *name;
CMPIInstance *inst = NULL;
- bool autoStartFlag = false;
+ const char *autoStartFlag = NULL;
+ int autoflag;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -1374,9 +1375,14 @@
goto out;
}
- if (cu_get_bool_prop(inst, "autoStart", &autoStartFlag) != CMPI_RC_OK)
- autoStartFlag = false;
- if(virDomainSetAutostart(dom, (autoStartFlag) ? 1 : 0) == -1)
+ if (cu_get_str_prop(inst, "autoStart", &autoStartFlag) != CMPI_RC_OK)
+ autoStartFlag = strdup("disable");
+
+ if (STREQ(autoStartFlag, "enable"))
+ autoflag = 1;
+ else
+ autoflag = 0;
+ if((virDomainSetAutostart(dom, autoflag)) == -1)
CU_DEBUG("Failed to set autostart flag.");
name = virDomainGetName(dom);
14 years, 4 months
[PATCH] Add VM Autostart flag
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1279127759 25200
# Node ID 487a2f2bbf148e8abbbe332e6c6f2f7a44f8e2a4
# Parent 62069e89413c139c3da8e0b23b83d20890eeec4f
Add VM Autostart flag.
VMs can be set to autostart on host reboot.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 62069e89413c -r 487a2f2bbf14 schema/ComputerSystem.mof
--- a/schema/ComputerSystem.mof Thu Jul 01 11:52:57 2010 -0400
+++ b/schema/ComputerSystem.mof Wed Jul 14 10:15:59 2010 -0700
@@ -10,6 +10,9 @@
[Description("UUID assigned to this DomU.")]
string UUID;
+ [Description("Flag to set VM autostart.")]
+ boolean autoStart;
+
};
[Description (
@@ -23,6 +26,9 @@
[Description("UUID assigned to this virtual machine.")]
string UUID;
+ [Description("Flag to set VM autostart.")]
+ boolean autoStart;
+
};
[Description (
@@ -36,5 +42,8 @@
[Description("UUID assigned to this virtual machine.")]
string UUID;
+ [Description("Flag to set VM autostart.")]
+ boolean autoStart;
+
};
diff -r 62069e89413c -r 487a2f2bbf14 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Thu Jul 01 11:52:57 2010 -0400
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 14 10:15:59 2010 -0700
@@ -1356,6 +1356,7 @@
virDomainPtr dom;
const char *name;
CMPIInstance *inst = NULL;
+ bool autoStartFlag = false;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -1373,6 +1374,11 @@
goto out;
}
+ if (cu_get_bool_prop(inst, "autoStart", &autoStartFlag) != CMPI_RC_OK)
+ autoStartFlag = false;
+ if(virDomainSetAutostart(dom, (autoStartFlag) ? 1 : 0) == -1)
+ CU_DEBUG("Failed to set autostart flag.");
+
name = virDomainGetName(dom);
*s = get_domain_by_name(_BROKER, ref, name, &inst);
14 years, 4 months
[PATCH] [TEST] Adding code to verify if a subnet used in the test case already exists
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1279892502 25200
# Node ID 3976f0cbef2a1be8f6572ede485552684747ae18
# Parent 4f2909dd0e2f9be6d3f32b0926d564d112ec2572
[TEST] Adding code to verify if a subnet used in the test case already exists
The following tests failed because of the networkpool withe the same subnet existed
on the machine.
VirtualSystemManagementService - 06_addresource.py: FAIL
VirtualSystemManagementService - 18_define_sys_bridge.py: FAIL
VirtualSystemManagementService - 19_definenetwork_ers.py: FAIL
VirtualSystemManagementService - 22_addmulti_brg_interface.py: FAIL
VirtualSystemManagementService - 23_verify_duplicate_mac_err.py: FAIL
VirtualSystemManagementService - 27_definesystem_macvtap_dev.py: FAIL
This fix will verify if the subnet already is used and gives appropriate message.
Tested has been verified with KVM Libvirt-CIM Sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 4f2909dd0e2f -r 3976f0cbef2a suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Jul 23 05:56:57 2010 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Jul 23 06:41:42 2010 -0700
@@ -237,7 +237,7 @@
self.add_sub_node(network, 'name', self.net_name)
self.add_sub_node(network, 'uuid', set_uuid())
self.add_sub_node(network, 'forward')
- subnet = '192.168.123.'
+ subnet = '192.168.%d.' % (random.randint(1, 100))
self.add_sub_node(network, 'bridge', name=self.vbr, stp='on',
forwardDelay='0')
ip_base = random.randint(1, 100)
@@ -249,6 +249,13 @@
awk '/ip address/ {print}' | \
cut -d ' ' -f 4 | sed 's/address=//'" % _net_name
s, in_use_addr = utils.run_remote(server, cmd)
+
+ sub_net_in_use = in_use_addr
+ sub_net_in_use = sub_net_in_use.rsplit('.', 1)[0].strip("'") + "."
+ if subnet == sub_net_in_use:
+ logger.error("Subnet address is in use by a different network")
+ return None
+
in_use_addr = in_use_addr.strip("'")
if in_use_addr == addr:
logger.error("IP address is in use by a different network")
14 years, 5 months
[PATCH] Add support for VSI/DCN
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1276810951 25200
# Node ID a31f3f023acdd0edd73636a86a93c08803dd7158
# Parent b2b8177338722a1f961430c8ccfe7820a5368ff7
Add support for VSI/DCN.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r b2b817733872 -r a31f3f023acd libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Jun 15 14:25:34 2010 -0700
+++ b/libxkutil/device_parsing.c Thu Jun 17 14:42:31 2010 -0700
@@ -58,6 +58,17 @@
free(dev->bus_type);
}
+static void cleanup_vsi_device(struct vsi_device *dev)
+{
+ free(dev->vsi_type);
+ free(dev->manager_id);
+ free(dev->type_id);
+ free(dev->type_id_version);
+ free(dev->instance_id);
+ free(dev->filter_ref);
+ free(dev->profile_id);
+}
+
static void cleanup_net_device(struct net_device *dev)
{
free(dev->type);
@@ -66,6 +77,7 @@
free(dev->model);
free(dev->device);
free(dev->net_mode);
+ cleanup_vsi_device(&dev->vsi);
}
static void cleanup_emu_device(struct emu_device *dev)
@@ -288,6 +300,7 @@
{
struct virt_device *vdev = NULL;
struct net_device *ndev = NULL;
+ struct vsi_device *vsi_dev = NULL;
xmlNode *child = NULL;
vdev = calloc(1, sizeof(*vdev));
@@ -295,6 +308,7 @@
goto err;
ndev = &(vdev->dev.net);
+ vsi_dev = &(ndev->vsi);
ndev->type = get_attr_value(inode, "type");
if (ndev->type == NULL)
@@ -325,12 +339,28 @@
ndev->model = get_attr_value(child, "type");
if (ndev->model == NULL)
goto err;
+ } else if (XSTREQ(child->name, "virtualport")) {
+ vsi_dev->vsi_type = get_attr_value(child, "type");
+ if (vsi_dev->vsi_type == NULL)
+ goto err;
+ } else if (XSTREQ(child->name, "parameters")) {
+ vsi_dev->manager_id = get_attr_value(child, "managerid");
+ if (vsi_dev->manager_id == NULL)
+ goto err;
+
+ vsi_dev->type_id = get_attr_value(child, "typeid");
+ if (vsi_dev->type_id == NULL)
+ goto err;
+
+ vsi_dev->type_id_version = get_attr_value(child, "typeidversion");
+ if (vsi_dev->type_id_version == NULL)
+ goto err;
+
+ vsi_dev->instance_id = get_attr_value(child, "instanceid");
+ vsi_dev->profile_id = get_attr_value(child, "profileid");
}
}
- if (ndev->mac == NULL)
- goto err;
-
if (ndev->source == NULL)
CU_DEBUG("No network source defined, leaving blank\n");
@@ -602,6 +632,7 @@
int len = 0;
int count = 0;
+ CU_DEBUG("In parse_deviceso - type is %d", type);
xmlDoc *xmldoc;
xmlXPathContext *xpathCtx;
xmlXPathObject *xpathObj;
@@ -672,6 +703,13 @@
DUP_FIELD(dev, _dev, dev.net.model);
DUP_FIELD(dev, _dev, dev.net.device);
DUP_FIELD(dev, _dev, dev.net.net_mode);
+ DUP_FIELD(dev, _dev, dev.net.vsi.vsi_type);
+ DUP_FIELD(dev, _dev, dev.net.vsi.manager_id);
+ DUP_FIELD(dev, _dev, dev.net.vsi.type_id);
+ DUP_FIELD(dev, _dev, dev.net.vsi.type_id_version);
+ DUP_FIELD(dev, _dev, dev.net.vsi.instance_id);
+ DUP_FIELD(dev, _dev, dev.net.vsi.filter_ref);
+ DUP_FIELD(dev, _dev, dev.net.vsi.profile_id);
} else if (dev->type == CIM_RES_TYPE_DISK) {
DUP_FIELD(dev, _dev, dev.disk.type);
DUP_FIELD(dev, _dev, dev.disk.device);
@@ -980,6 +1018,7 @@
{
int ret;
+ CU_DEBUG("In get_dominfo_from_xml");
*dominfo = malloc(sizeof(**dominfo));
if (*dominfo == NULL)
return 0;
@@ -1019,8 +1058,8 @@
{
char *xml;
int ret;
+ xml = virDomainGetXMLDesc(dom, 0);
- xml = virDomainGetXMLDesc(dom, 0);
if (xml == NULL)
return 0;
diff -r b2b817733872 -r a31f3f023acd libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Tue Jun 15 14:25:34 2010 -0700
+++ b/libxkutil/device_parsing.h Thu Jun 17 14:42:31 2010 -0700
@@ -33,6 +33,16 @@
#include "../src/svpc_types.h"
+struct vsi_device {
+ char *vsi_type;
+ char *manager_id;
+ char *type_id;
+ char *type_id_version;
+ char *instance_id;
+ char *filter_ref;
+ char *profile_id;
+};
+
struct disk_device {
char *type;
char *device;
@@ -52,6 +62,7 @@
char *model;
char *device;
char *net_mode;
+ struct vsi_device vsi;
};
struct mem_device {
diff -r b2b817733872 -r a31f3f023acd libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Jun 15 14:25:34 2010 -0700
+++ b/libxkutil/xmlgen.c Thu Jun 17 14:42:31 2010 -0700
@@ -159,6 +159,40 @@
return msg;
}
+static const char *set_net_vsi(xmlNodePtr nic, struct vsi_device *dev)
+{
+ xmlNodePtr tmp;
+
+ tmp = xmlNewChild(nic, NULL, BAD_CAST "virtualport", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->vsi_type);
+
+ tmp = xmlNewChild(tmp, NULL, BAD_CAST "parameters", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+ if (STREQ(dev->vsi_type, "802.1Qbh")) {
+ if (dev->profile_id != NULL)
+ xmlNewProp(tmp, BAD_CAST "profileid",
+ BAD_CAST dev->profile_id);
+ } else {
+ if (dev->manager_id != NULL)
+ xmlNewProp(tmp, BAD_CAST "managerid",
+ BAD_CAST dev->manager_id);
+ if (dev->type_id != NULL)
+ xmlNewProp(tmp, BAD_CAST "typeid",
+ BAD_CAST dev->type_id);
+ if (dev->type_id_version != NULL)
+ xmlNewProp(tmp, BAD_CAST "typeidversion",
+ BAD_CAST dev->type_id_version);
+ if (dev->instance_id != NULL)
+ xmlNewProp(tmp, BAD_CAST "instanceid",
+ BAD_CAST dev->instance_id);
+ }
+
+ return NULL;
+}
+
static const char *set_net_source(xmlNodePtr nic,
struct net_device *dev,
const char *src_type)
@@ -247,8 +281,13 @@
msg = bridge_net_to_xml(nic, net);
else if (STREQ(dev->dev.net.type, "user"))
continue;
- else if (STREQ(dev->dev.net.type, "direct"))
+ else if (STREQ(dev->dev.net.type, "direct")) {
msg = set_net_source(nic, net, "direct");
+ if (net->vsi.vsi_type != NULL) {
+ struct vsi_device *vsi = &dev->dev.net.vsi;
+ msg = set_net_vsi(nic, vsi);
+ }
+ }
else
msg = "Unknown interface type";
}
diff -r b2b817733872 -r a31f3f023acd schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Tue Jun 15 14:25:34 2010 -0700
+++ b/schema/ResourceAllocationSettingData.mof Thu Jun 17 14:42:31 2010 -0700
@@ -68,6 +68,29 @@
[Description ("Network mode, could be 'vepa', 'pepa' etc.")]
string NetworkMode;
+
+ [Description ("VSI type")]
+ string VSIType;
+
+ [Description ("VSI manager id")]
+ string VSIManagerID;
+
+ [Description ("VSI type")]
+ string VSITypeID;
+
+ [Description ("expected/desired version of VTID")]
+ string VSITypeIDVersion;
+
+ [Description ("A globally unique ID for the connection instance."
+ " The ID shall be done consistent with IETF RFC 4122.")]
+ string VSIInstanceID;
+
+ [Description ("Profile ID")]
+ string ProfileID;
+
+ [Description ("Filter REF")]
+ string FilterRef;
+
};
[Description ("KVM virtual network configuration"),
@@ -90,6 +113,28 @@
[Description ("Network mode, could be 'vepa', 'pepa' etc.")]
string NetworkMode;
+
+ [Description ("VSI type")]
+ string VSIType;
+
+ [Description ("VSI manager id")]
+ string VSIManagerID;
+
+ [Description ("VSI type")]
+ string VSITypeID;
+
+ [Description ("expected/desired version of VTID")]
+ string VSITypeIDVersion;
+
+ [Description ("A globally unique ID for the connection instance."
+ " The ID shall be done consistent with IETF RFC 4122.")]
+ string VSIInstanceID;
+
+ [Description ("Profile ID")]
+ string ProfileID;
+
+ [Description ("Filter REF")]
+ string FilterRef;
};
[Description ("LXC virtual network configuration"),
diff -r b2b817733872 -r a31f3f023acd src/Virt_RASD.c
--- a/src/Virt_RASD.c Tue Jun 15 14:25:34 2010 -0700
+++ b/src/Virt_RASD.c Thu Jun 17 14:42:31 2010 -0700
@@ -278,6 +278,57 @@
return s;
}
+static CMPIStatus set_net_vsi_rasd_params(const CMPIBroker *broker,
+ const CMPIObjectPath *ref,
+ const struct vsi_device vsi,
+ CMPIInstance *inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ CMSetProperty(inst,
+ "VSIType",
+ (CMPIValue *)vsi.vsi_type,
+ CMPI_chars);
+
+ if (vsi.manager_id != NULL)
+ CMSetProperty(inst,
+ "VSIManagerID",
+ (CMPIValue *)vsi.manager_id,
+ CMPI_chars);
+
+ if (vsi.type_id != NULL)
+ CMSetProperty(inst,
+ "VSITypeID",
+ (CMPIValue *)vsi.type_id,
+ CMPI_chars);
+
+ if (vsi.type_id_version != NULL)
+ CMSetProperty(inst,
+ "VSITypeIDVersion",
+ (CMPIValue *)vsi.type_id_version,
+ CMPI_chars);
+
+ if (vsi.instance_id != NULL)
+ CMSetProperty(inst,
+ "VSIInstanceID",
+ (CMPIValue *)vsi.instance_id,
+ CMPI_chars);
+
+ if (vsi.filter_ref != NULL)
+ CMSetProperty(inst,
+ "FilterRef",
+ (CMPIValue *)vsi.filter_ref,
+ CMPI_chars);
+
+ if (vsi.profile_id != NULL)
+ CMSetProperty(inst,
+ "ProfileID",
+ (CMPIValue *)vsi.profile_id,
+ CMPI_chars);
+
+ return s;
+}
+
static CMPIStatus set_net_rasd_params(const CMPIBroker *broker,
const CMPIObjectPath *ref,
const struct virt_device *dev,
@@ -482,6 +533,13 @@
s = set_disk_rasd_params(broker, ref, dev, inst);
} else if (dev->type == CIM_RES_TYPE_NET) {
s = set_net_rasd_params(broker, ref, dev, inst);
+ if ((s.rc == CMPI_RC_OK) &&
+ (dev->dev.net.vsi.vsi_type != NULL))
+ s = set_net_vsi_rasd_params(broker,
+ ref,
+ dev->dev.net.vsi,
+ inst);
+
} else if (dev->type == CIM_RES_TYPE_MEM) {
const char *units = "KiloBytes";
diff -r b2b817733872 -r a31f3f023acd src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Tue Jun 15 14:25:34 2010 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Thu Jun 17 14:42:31 2010 -0700
@@ -550,6 +550,12 @@
const char *src_dev,
const char *net_mode,
const char *model,
+ const char *vsi,
+ const char *manager,
+ const char *typeid,
+ const char *version,
+ const char *instance,
+ const char *profile,
struct inst_list *list)
{
CMPIInstance *inst;
@@ -583,6 +589,31 @@
CMSetProperty(inst, "ResourceSubType",
(CMPIValue *)model, CMPI_chars);
+ if (vsi != NULL)
+ s = CMSetProperty(inst, "VSIType",
+ (CMPIValue *)vsi, CMPI_chars);
+
+
+ if (manager != NULL)
+ CMSetProperty(inst, "VSIManagerID",
+ (CMPIValue *)manager, CMPI_chars);
+
+ if (typeid != NULL)
+ CMSetProperty(inst, "VSITypeID",
+ (CMPIValue *)typeid, CMPI_chars);
+
+ if (version != NULL)
+ CMSetProperty(inst, "VSITypeIDVersion",
+ (CMPIValue *)version, CMPI_chars);
+
+ if (instance != NULL)
+ CMSetProperty(inst, "VSIInstanceID",
+ (CMPIValue *)instance, CMPI_chars);
+
+ if (profile != NULL)
+ CMSetProperty(inst, "ProfileID",
+ (CMPIValue *)profile, CMPI_chars);
+
inst_list_add(list, inst);
out:
@@ -600,8 +631,6 @@
int i,j;
const char *type[] = {"network", "bridge", "user"};
const char *device[] = {"vtap1", NULL};
- const char *src_dev[] = {NULL, NULL};
- const char *net_mode[] = {NULL, NULL};
const char *model[] = {"e1000", NULL};
const char *name[] = {NULL, "br0", NULL};
@@ -641,17 +670,40 @@
name[i],
num_nics,
device[j],
- src_dev[j],
- net_mode[j],
+ NULL,
+ NULL,
model[j],
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
list);
if (s.rc != CMPI_RC_OK)
goto out;
}
}
- s = set_net_props(template_type, ref, id, "direct", NULL, num_nics,
- NULL, "eth1", "vepa", NULL, list);
+ s = set_net_props(template_type, ref, id, "direct", NULL,
+ num_nics, NULL, "eth1", "vepa", NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, list);
+ /* profile id*/
+ s = set_net_props(template_type, ref, id, "direct", NULL,
+ num_nics, NULL, "eth1", "vepa", NULL,
+ "802.1Qbh", NULL, NULL, NULL,
+ NULL, "my_profile", list);
+ /* no profile id but with instance id*/
+ s = set_net_props(template_type, ref, id, "direct", NULL,
+ num_nics, NULL, "eth1", "vepa", NULL,
+ "802.1Qbg", "managerid", "typeid",
+ "typeidversion", "instanceid", NULL,
+ list);
+ /* no profile id and no instance id*/
+ s = set_net_props(template_type, ref, id, "direct", NULL,
+ num_nics, NULL, "eth1", "vepa", NULL,
+ "802.1Qbg", "managerid", "typeid",
+ "typeidversion", "NULL", "NULL", list);
out:
return s;
diff -r b2b817733872 -r a31f3f023acd src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Jun 15 14:25:34 2010 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Thu Jun 17 14:42:31 2010 -0700
@@ -760,6 +760,50 @@
return "Source Device is empty";
else
return "No Source Device specified";
+
+ free(dev->dev.net.vsi.vsi_type);
+ if (cu_get_str_prop(inst, "VSIType", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.vsi_type = NULL;
+ else
+ dev->dev.net.vsi.vsi_type = strdup(val);
+
+ free(dev->dev.net.vsi.manager_id);
+ if (cu_get_str_prop(inst, "VSIManagerID", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.manager_id = NULL;
+ else
+ dev->dev.net.vsi.manager_id = strdup(val);
+
+ free(dev->dev.net.vsi.type_id);
+ if (cu_get_str_prop(inst, "VSITypeID", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.type_id = NULL;
+ else
+ dev->dev.net.vsi.type_id = strdup(val);
+
+ free(dev->dev.net.vsi.type_id_version);
+ if (cu_get_str_prop(inst, "VSITypeIDVersion", &val) !=
+ CMPI_RC_OK)
+ dev->dev.net.vsi.type_id_version = NULL;
+ else
+ dev->dev.net.vsi.type_id_version = strdup(val);
+
+ free(dev->dev.net.vsi.instance_id);
+ if (cu_get_str_prop(inst, "VSIInstanceID", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.instance_id = NULL;
+ else
+ dev->dev.net.vsi.instance_id = strdup(val);
+
+ free(dev->dev.net.vsi.filter_ref);
+ if (cu_get_str_prop(inst, "FilterRef", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.filter_ref = NULL;
+ else
+ dev->dev.net.vsi.filter_ref = strdup(val);
+
+ free(dev->dev.net.vsi.profile_id);
+ if (cu_get_str_prop(inst, "ProfileID", &val) != CMPI_RC_OK)
+ dev->dev.net.vsi.profile_id = NULL;
+ else
+ dev->dev.net.vsi.profile_id = strdup(val);
+
} else
return "Invalid Network Type specified";
14 years, 5 months