[PATCH 0 of 2] Some misc ComputerSystemIndication related changes
by Kaitlin Rupert
This is some cleanup that needs to be done in order to properly set the
PreviousInstance attribute.
Right now, the same value is being used for SourceInstance as well as
PreviousInstance, which isn't valid. This issue will be addressed in a
follow-up set of patches.
15 years, 5 months
[PATCH] [TEST] Adding new tc to verify fs storage pool creation
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1246281830 25200
# Node ID 3d4e90851a09756b52a452047cfcba8191a1e794
# Parent d67a606da9f7d631368d04280865eb9a21e7ea8a
[TEST] Adding new tc to verify fs storage pool creation.
Update in patch 2:
------------------
1) rearranged import stmst
2) add check to see if cimserver is started
3) Added options to clean the old log
4) Added options to get the debug msg on the stdout
5) Added lxc support
6) Moved the looping for setting the poolsettings in a function
7) Rectified the virt_type to virt and also to use KVM for checking while setting vuri
Patch 1:
--------
This tc will not be run in the batch mode of cimtest and hence needs to
be run individually using the command below.
python create_verify_storagepool.py -t 2 -d /dev/sda4 -m /tmp/mnt -n diskfs
-v Xen -u <username> -p <passwd>
Tested with Xen on RHEL with current sources for fs type pool.
Will Update the patch to include logical pool verification as well.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r d67a606da9f7 -r 3d4e90851a09 suites/libvirt-cim/misc_cimtests/create_verify_storagepool.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/misc_cimtests/create_verify_storagepool.py Mon Jun 29 06:23:50 2009 -0700
@@ -0,0 +1,336 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri<dkalaker(a)in.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 case should test the CreateChildResourcePool service
+# supplied by the RPCS provider.
+# This tc verifies the FileSystem Type storage pool.
+#
+# The test case is not run in the batch run and we need to run it using
+# the following command:
+# python create_verify_storagepool.py -t 2 -d /dev/sda4 -m /tmp/mnt -n diskfs
+# -v Xen -u <username> -p <passwd>
+#
+# Where t can be :
+# 2 - FileSystem
+# 4 - Logical etc
+#
+#
+# Date : 27.06.2009
+
+import os
+import sys
+from optparse import OptionParser
+from commands import getstatusoutput
+from distutils.text_file import TextFile
+from pywbem import WBEMConnection, cim_types
+sys.path.append('../../../lib')
+from CimTest import Globals
+from CimTest.Globals import logger, log_param
+sys.path.append('../lib')
+from XenKvmLib.classes import inst_to_mof, get_typed_class
+from XenKvmLib.pool import get_pool_rasds
+sys.path.append('../')
+from main import pre_check
+
+PASS = 0
+FAIL = 1
+TEST_LOG="cimtest.log"
+
+supp_types = [ 'Xen', 'KVM' , 'LXC' ]
+pool_types = { 'DISK_POOL_FS' : 2 }
+
+def verify_cmd_options(options):
+ try:
+ if options.part_dev == None:
+ raise Exception("Free Partition to be mounted not specified")
+
+ if options.mnt_pt == None:
+ raise Exception("Mount points to be used not specified")
+
+ if options.pool_name == None:
+ raise Exception("Must specify the Pool Name to be created")
+
+ if options.virt == None or options.virt not in supp_types:
+ raise Exception("Must specify virtualization type")
+
+ if options.pool_type == None:
+ raise Exception("Must specify pool type to be tested")
+
+ except Exception, details:
+ print "FATAL: ", details
+ print parser.print_help()
+ return FAIL
+
+ return PASS
+
+def env_setup(sysname, virt, clean, debug):
+ env_ready = pre_check(sysname, virt)
+ if env_ready != None:
+ print "\n%s. Please check your environment.\n" % env_ready
+ return FAIL
+
+ if clean:
+ cmd = "rm -f %s" % (os.path.join(os.getcwd(), TEST_LOG))
+ status, output = getstatusoutput(cmd)
+
+ if debug:
+ dbg = "-d"
+ else:
+ dbg = ""
+
+ return PASS
+
+def get_pooltype(pooltype, virt):
+ if pooltype == "fs":
+ pool_type = pool_types['DISK_POOL_FS']
+ else:
+ logger.error("Invalid pool type ....")
+ return None, None
+ return PASS, pool_type
+
+def verify_inputs(part_dev, mount_pt):
+ del_dir = False
+ cmd = "mount"
+ status, mount_info = getstatusoutput(cmd)
+ if status != PASS:
+ logger.error("Failed to get mount info.. ")
+ return FAIL, del_dir
+
+ for line in mount_info.split('\n'):
+ try:
+ # Check if the specified partition is mounted before using it
+ part_name = line.split()[0]
+ if part_dev == part_name:
+ logger.error("[%s] already mounted", part_dev)
+ raise Exception("Please specify free partition other than " \
+ "[%s]" % part_dev)
+
+ # Check if mount point is already used for mounting
+ mount_name = line.split()[2]
+ if mount_pt == mount_name:
+ logger.error("[%s] already mounted", mount_pt)
+ raise Exception("Please specify dir other than [%s]" %mount_pt)
+
+ except Exception, details:
+ logger.error("%s", details)
+ return FAIL, del_dir
+
+ # Check if the mount point specified already exist, if not then create it..
+ if not os.path.exists(mount_pt):
+ os.mkdir(mount_pt)
+
+ # set del_dir to True so that we remove it before exiting from the tc.
+ del_dir = True
+ else:
+ # Check if the mount point specified is a dir
+ if not os.path.isdir(mount_pt):
+ logger.error("The mount point [%s] should be a dir", mount_pt)
+ return FAIL, del_dir
+
+ files = os.listdir(mount_pt)
+ if len(files) != 0:
+ logger.info("The mount point [%s] given is not empty", mount_pt)
+
+ return PASS, del_dir
+
+def get_uri(virt):
+ if virt == 'Xen':
+ vuri = 'xen:///'
+ elif virt == 'KVM':
+ vuri = 'qemu:///system'
+ elif virt == 'LXC':
+ vuri = 'lxc:///system'
+ return vuri
+
+def get_pool_settings(dp_rasds, pooltype, part_dev, mount_pt, pool_name):
+ pool_settings = None
+ for dpool_rasd in dp_rasds:
+ if dpool_rasd['Type'] == pooltype and \
+ dpool_rasd['InstanceID'] == 'Default':
+ dpool_rasd['DevicePaths'] =[part_dev]
+ dpool_rasd['Path'] = mount_pt
+ dp_pid = "%s/%s" %("DiskPool", pool_name)
+ dpool_rasd['PoolID'] = dpool_rasd['InstanceID'] = dp_pid
+ break
+ if not pool_name in dpool_rasd['InstanceID']:
+ return pool_settings
+
+ pool_settings = inst_to_mof(dpool_rasd)
+ return pool_settings
+
+
+def verify_pool(virt, pool_name):
+ vuri = get_uri(virt)
+ cmd = "virsh -c %s pool-list --all | grep %s" % (vuri, pool_name)
+ return getstatusoutput(cmd)
+
+def cleanup(virt, pool_name, sysname, mount_pt, del_dir):
+ virsh = "virsh -c %s" % get_uri(virt)
+ cmd = "%s pool-destroy %s && %s pool-undefine %s" \
+ % (virsh, pool_name, virsh, pool_name)
+ ret, out = getstatusoutput(cmd)
+ if ret != PASS:
+ logger.error("WARNING: pool '%s' was not cleaned on '%s'",
+ pool_name, sysname)
+ logger.error("WARNING: Please remove it manually")
+
+ if del_dir == True:
+ cmd ="rm -rf %s" % mount_pt
+ status, out = getstatusoutput(cmd)
+ if status != PASS:
+ logger.error("WARNING: '%s' was not removed", mount_pt)
+ logger.error("WARNING: Please remove %s manually", mount_pt)
+
+def main():
+ usage = "usage: %prog [options] \nex: %prog -i localhost"
+ parser = OptionParser(usage)
+
+ parser.add_option("-i", "--host-url", dest="h_url", default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-N", "--ns", dest="ns", default="root/virt",
+ help="Namespace (default is root/virt)")
+ parser.add_option("-u", "--user", dest="username", default=None,
+ help="Auth username for CIMOM on source system")
+ parser.add_option("-p", "--pass", dest="password", default=None,
+ help="Auth password for CIMOM on source system")
+ parser.add_option("-v", "--virt-type", dest="virt", default=None,
+ help="Virtualization type [ Xen | KVM ]")
+ parser.add_option("-t", "--pool-type", dest="pool_type", default=None,
+ help="Pool type:[ fs | logical ]")
+ parser.add_option("-d", "--part-dev", dest="part_dev", default=None,
+ help="specify the free partition to be used")
+ parser.add_option("-m", "--mnt_pt", dest="mnt_pt", default=None,
+ help="Mount point to be used")
+ parser.add_option("-n", "--pool-name", dest="pool_name", default=None,
+ help="Pool to be created")
+ parser.add_option("-c", "--clean-log",
+ action="store_true", dest="clean",
+ help="Will remove existing log files before test run")
+ parser.add_option("-l", "--debug-output", action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
+
+ (options, args) = parser.parse_args()
+
+ # Verify command line options
+ status = verify_cmd_options(options)
+ if status != PASS:
+ return status
+
+ part_dev = options.part_dev
+ mount_pt = options.mnt_pt
+ pool_name = options.pool_name
+ virt = options.virt
+
+ if ":" in options.h_url:
+ (sysname, port) = options.h_url.split(":")
+ else:
+ sysname = options.h_url
+
+ # Verify if the CIMOM is running, clean cimtest.log if requested
+ # Set Debug option if requested
+ status = env_setup(sysname, virt, options.clean, options.debug)
+ if status != PASS:
+ return status
+
+ log_param(file_name=TEST_LOG)
+
+ print "Please check cimtest.log in the curr dir for debug log msgs..."
+
+ status, pooltype = get_pooltype(options.pool_type, virt)
+ if status != PASS:
+ return FAIL
+
+ pooltype = cim_types.Uint16(pooltype)
+
+ status, del_dir = verify_inputs(part_dev, mount_pt)
+ if status != PASS:
+ if del_dir == True:
+ cmd ="rm -rf %s" % mount_pt
+ status, out = getstatusoutput(cmd)
+ logger.error("Input verification failed")
+ return status
+
+
+ status, out = verify_pool(virt, pool_name)
+ if status == PASS:
+ logger.error("Pool --> '%s' already exist", pool_name)
+ logger.error("Specify some other pool name")
+ return status
+
+ try:
+ src_conn = WBEMConnection('http://%s' % sysname, (options.username,
+ options.password), options.ns)
+
+ os.environ['CIM_NS'] = Globals.CIM_NS = options.ns
+ os.environ['CIM_USER'] = Globals.CIM_USER = options.username
+ os.environ['CIM_PASS'] = Globals.CIM_PASS = options.password
+
+ # Get DiskPoolRASD's from SDC association with AC of DiskPool/0
+ status, dp_rasds = get_pool_rasds(sysname, virt, "DiskPool")
+ if status != PASS:
+ raise Exception("Failed to get DiskPool Rasd's")
+
+ # Get the DiskPoolRASD mof with appropriate values of diskpool
+ # to be created....
+ pool_settings = get_pool_settings(dp_rasds, pooltype, part_dev,
+ mount_pt, pool_name)
+ if pool_settings == None:
+ raise Exception("Did not get the required pool settings ...")
+
+ rpcs_cn = get_typed_class(virt, "ResourcePoolConfigurationService")
+ # Create DiskPool..
+ res = src_conn.InvokeMethod("CreateChildResourcePool",
+ rpcs_cn,
+ Settings=[pool_settings],
+ ElementName=pool_name)
+
+ # Verify if the desired pool was successfully created ..
+ status, out = verify_pool(virt, pool_name)
+ if status != PASS:
+ raise Exception("Failed to create pool: %s " % pool_name)
+
+ except Exception, details:
+ logger.error("In main(), exception '%s'", details)
+ if del_dir == True:
+ cmd ="rm -rf %s" % mount_pt
+ status, out = getstatusoutput(cmd)
+ return FAIL
+
+ # Clean up the pool and the mount dir that was created ...
+ cleanup(virt, pool_name, sysname, mount_pt, del_dir)
+
+ if res[0] == PASS:
+ logger.info("Pool %s was successfully verified for pool type %s",
+ pool_name , options.pool_type)
+
+ # Place holder to give a hint to the user the tc passed
+ # otherwise the user will have to look into the cimtest.log in the
+ # current dir.
+ print "Pool '", pool_name,"' was successfully verified for pool type "\
+ "'", options.pool_type , "'"
+ else:
+ logger.error("Test Failed to verify '%s' pool creation ....",
+ options.pool_type)
+ return res[0]
+if __name__=="__main__":
+ sys.exit(main())
+
15 years, 5 months
[PATCH] [TEST] Adding new tc to verify fs storage pool creation
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1246055400 25200
# Node ID 1e14cb463dc2251286e8e82099ac410c4e8d3453
# Parent d67a606da9f7d631368d04280865eb9a21e7ea8a
[TEST] Adding new tc to verify fs storage pool creation.
This tc will not be run in the batch mode of cimtest and hence needs to
be run individually using the command below.
python create_verify_storagepool.py -t 2 -d /dev/sda4 -m /tmp/mnt -n diskfs
-v Xen -u <username> -p <passwd>
Tested with Xen on RHEL with current sources for fs type pool.
Will Update the patch to include logical pool verification as well.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r d67a606da9f7 -r 1e14cb463dc2 suites/libvirt-cim/misc_cimtests/create_verify_storagepool.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/misc_cimtests/create_verify_storagepool.py Fri Jun 26 15:30:00 2009 -0700
@@ -0,0 +1,235 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri<dkalaker(a)in.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 case should test the CreateChildResourcePool service
+# supplied by the RPCS provider.
+# This tc verifies the FileSystem Type storage pool.
+#
+# The test case is not run in the batch run and we need to run it using
+# the following command:
+# python create_verify_storagepool.py -t 2 -d /dev/sda4 -m /tmp/mnt -n diskfs
+# -v Xen -u <username> -p <passwd>
+#
+# Where t can be :
+# 2 - FileSystem
+# 4 - Logical etc
+#
+#
+# Date : 27.06.2009
+
+import os
+import sys
+import TestSuite
+from optparse import OptionParser
+from CimTest import Globals
+from XenKvmLib.classes import inst_to_mof, get_typed_class
+from CimTest.Globals import logger, log_param
+from commands import getstatusoutput
+from pywbem import WBEMConnection, cim_types
+from distutils.text_file import TextFile
+from XenKvmLib.pool import get_pool_rasds
+
+PASS = 0
+FAIL = 1
+supp_types = [ 'Xen', 'KVM' ]
+pool_types = { 2 : 'DISK_POOL_FS', 4 : 'DISK_POOL_LOGICAL' }
+
+def verify_inputs(part_dev, mount_pt, pool_type):
+ if pool_type not in pool_types.keys():
+ logger.error("Pool type '%s' specified is not valid", pool_type)
+ return FAIL
+
+ # TextFile skips all the lines which have comments and which are blank
+ fd = TextFile(filename="/etc/fstab")
+ fstab_info = [x.rstrip('\n') for x in fd.readlines()]
+ fd.close()
+
+ for line in fstab_info:
+ try:
+ # Check if the specified partition is mounted before using it
+ if part_dev in line.split()[0]:
+ logger.error("[%s] already mounted", part_dev)
+ raise Exception("Please specify free partition other than " \
+ "[%s]" % part_dev)
+
+ # Check if mount point is already used for mounting
+ if mount_pt in line.split()[1]:
+ logger.error("[%s] already mounted", mount_pt)
+ raise Exception("Please specify dir other than [%s]" %mount_pt)
+
+ except Exception, details:
+ logger.error("Exception details is %s", details)
+ return FAIL
+
+ ## Check if the mount point specified already exist if not then create it..
+ if not os.path.exists(mount_pt):
+ os.mkdir(mount_pt)
+ else:
+ ## Check if the mount point specified is a dir
+ if not os.path.isdir(mount_pt):
+ logger.error("The mount point [%s] should be a dir", mount_pt)
+ return FAIL
+
+ files = os.listdir(mount_pt)
+ if len(files) != 0:
+ logger.info("The mount point [%s] given is not empty", mount_pt)
+
+ return PASS
+
+def get_uri(virt):
+ if virt == 'Xen':
+ vuri = 'xen:///'
+ elif vir_type == 'Kvm':
+ vuri = 'qemu:///system'
+ return vuri
+
+def verify_pool(virt, pool_name):
+ vuri = get_uri(virt)
+ cmd = "virsh -c %s pool-list --all | grep %s" %(vuri, pool_name)
+ return getstatusoutput(cmd)
+
+def main():
+ usage = "usage: %prog [options] \nex: %prog -i localhost"
+ parser = OptionParser(usage)
+
+ parser.add_option("-i", "--host-url", dest="h_url", default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-N", "--ns", dest="ns", default="root/virt",
+ help="Namespace (default is root/virt)")
+ parser.add_option("-u", "--user", dest="username", default=None,
+ help="Auth username for CIMOM on source system")
+ parser.add_option("-p", "--pass", dest="password", default=None,
+ help="Auth password for CIMOM on source system")
+ parser.add_option("-v", "--virt-type", dest="virt", default=None,
+ help="Virtualization type [ Xen | KVM ]")
+ parser.add_option("-t", "--pool-type", dest="pool_type", default=None,
+ help="Pool type:[ fs | logical ]")
+ parser.add_option("-d", "--part-dev", dest="part_dev", default=None,
+ help="specify the free partition to be used")
+ parser.add_option("-m", "--mnt_pt", dest="mnt_pt", default=None,
+ help="Mount point to be used")
+ parser.add_option("-n", "--pool-name", dest="pool_name", default=None,
+ help="Pool to be created")
+
+ (options, args) = parser.parse_args()
+
+ try:
+ if options.part_dev == None:
+ raise Exception("Free Partition to be mounted not specified")
+
+ if options.mnt_pt == None:
+ raise Exception("Mount points to be used not specified")
+
+ if options.pool_name == None:
+ raise Exception("Must specify the Pool Name to be created")
+
+ if options.virt == None or options.virt not in supp_types:
+ raise Exception("Must specify virtualization type")
+
+ if options.pool_type == None:
+ raise Exception("Must specify pool type to be tested")
+
+ except Exception, details:
+ print "FATAL: ", details
+ print parser.print_help()
+ return FAIL
+
+ part_dev = options.part_dev
+ mount_pt = options.mnt_pt
+ pool_name = options.pool_name
+ pool_type = cim_types.Uint16(options.pool_type)
+ virt = options.virt
+
+ testsuite = TestSuite.TestSuite(log=True)
+ log_param(file_name="cimtest.log")
+ print "Please check cimtest.log in the curr dir for debug log msgs..."
+ status = verify_inputs(part_dev, mount_pt, pool_type)
+ if status != PASS:
+ logger.error("Input verification failed")
+ return status
+
+ status, out = verify_pool(virt, pool_name)
+ if status == PASS:
+ logger.error("Pool --> '%s' already exist", pool_name)
+ logger.error("Specify some other pool name")
+ return status
+
+ if ":" in options.h_url:
+ (sysname, port) = options.h_url.split(":")
+ else:
+ sysname = options.h_url
+
+ src_conn = WBEMConnection('http://%s' % sysname,
+ (options.username, options.password), options.ns)
+
+ os.environ['CIM_NS'] = Globals.CIM_NS = options.ns
+ os.environ['CIM_USER'] = Globals.CIM_USER = options.username
+ os.environ['CIM_PASS'] = Globals.CIM_PASS = options.password
+
+ try:
+ status,dp_rasds = get_pool_rasds(sysname, virt, "DiskPool")
+ for i in range(0, len(dp_rasds)):
+ pool_id = "%s/%s" %("DiskPool", pool_name)
+ dpool_rasd=dp_rasds[i]
+ dpool_rasd['PoolID'] = pool_id
+ if dpool_rasd['Type'] == pool_type and \
+ dpool_rasd['InstanceID'] == 'Default':
+ dpool_rasd['DevicePaths'] =[part_dev]
+ dpool_rasd['Path'] = mount_pt
+ dpool_rasd['InstanceID'] = pool_id
+ break
+ pool_settings = inst_to_mof(dpool_rasd)
+ rpcs_cn = get_typed_class(virt, "ResourcePoolConfigurationService")
+ res = src_conn.InvokeMethod("CreateChildResourcePool",
+ rpcs_cn,
+ Settings=[pool_settings],
+ ElementName=pool_name)
+ except Exception, details:
+ logger.error("Exception details: %s", details)
+
+ status, out = verify_pool(virt, pool_name)
+ if status != PASS:
+ logger.error("Failed to create pool: %s ", pool_name)
+ return status
+
+ vuri = get_uri(virt)
+ virsh = "virsh -c %s" % vuri
+ cmd = "%s pool-destroy %s && %s pool-undefine %s" \
+ %(virsh, pool_name, virsh, pool_name)
+ ret, out = getstatusoutput(cmd)
+ if ret != PASS:
+ logger.info("WARNING: pool %s was not cleaned on %s",
+ pool_name, sysname)
+ logger.info("WARNING: Please remove it manually")
+
+ logger.info("Pool %s was successfully verified for pool type %s",
+ pool_name , pool_types[pool_type])
+
+ # Place holder to give a hint to the user the tc passed
+ # otherwise the user will have to look into the cimtest.log in the
+ # current dir.
+ print "Pool '", pool_name,"' was successfully verified for pool type '", \
+ pool_types[pool_type] , "'"
+ return status
+if __name__=="__main__":
+ sys.exit(main())
+
15 years, 5 months
[PATCH] Add support for logical pools to SDC
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1245859136 25200
# Node ID 7e50d31dd6029a354469d8b1ade7b705f02b5e1c
# Parent 983e35ff6034988d958ec4425d3419906b5c516a
Add support for logical pools to SDC
There isn't much that needs to be done for logical pools. The user will
need to specify the Path as something like: "/dev/VolGroup01"
When calling CreateChildResourcePool(), the user will also need to specify
the ElementName as an existing LVM volume group, like: "VolGroup01". This is
different from the other pools (which any name for ElementName can be used).
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 983e35ff6034 -r 7e50d31dd602 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Jun 24 08:55:51 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Jun 24 08:58:56 2009 -0700
@@ -1239,12 +1239,13 @@
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
const char *path = "/dev/null";
- int type[5] = {DISK_POOL_DIR,
+ int type[6] = {DISK_POOL_DIR,
DISK_POOL_FS,
DISK_POOL_NETFS,
DISK_POOL_DISK,
- DISK_POOL_ISCSI};
- int pool_types = 5;
+ DISK_POOL_ISCSI,
+ DISK_POOL_LOGICAL};
+ int pool_types = 6;
int i;
switch (template_type) {
15 years, 6 months
[PATCH] Set the OperationalStatus attribute of VirtualSystemManagementService
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1245864436 25200
# Node ID f1f435da7db3230365969a7abdbeeff9ef154676
# Parent 7417f62e29eb8b37acb66e616e49f51901f610c6
Set the OperationalStatus attribute of VirtualSystemManagementService
As long as the providers are installed properly, the
VirtualSystemManagementService should always be available. So we just need
to statically set the value as 'OK'.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 7417f62e29eb -r f1f435da7db3 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jun 24 10:12:22 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jun 24 10:27:16 2009 -0700
@@ -2273,6 +2273,8 @@
unsigned long hv_version = 0;
const char * hv_type = NULL;
char *caption = NULL;
+ CMPIArray *array;
+ uint16_t op_status;
*_inst = NULL;
conn = connect_by_classname(broker, CLASSNAME(reference), &s);
@@ -2352,6 +2354,16 @@
CMSetProperty(inst, "Release",
(CMPIValue *)PACKAGE_VERSION, CMPI_chars);
+ array = CMNewArray(broker, 1, CMPI_uint16, &s);
+ if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(array)))
+ goto out;
+
+ op_status = CIM_OPERATIONAL_STATUS;
+ CMSetArrayElementAt(array, 0, &op_status, CMPI_uint16);
+
+ CMSetProperty(inst, "OperationalStatus",
+ (CMPIValue *)&array, CMPI_uint16A);
+
if (is_get_inst) {
s = cu_validate_ref(broker, reference, inst);
if (s.rc != CMPI_RC_OK)
diff -r 7417f62e29eb -r f1f435da7db3 src/svpc_types.h
--- a/src/svpc_types.h Wed Jun 24 10:12:22 2009 -0700
+++ b/src/svpc_types.h Wed Jun 24 10:27:16 2009 -0700
@@ -22,6 +22,8 @@
#ifndef __SVPC_TYPES_H
#define __SVPC_TYPES_H
+#define CIM_OPERATIONAL_STATUS 2
+
#define CIM_RES_TYPE_ALL 0
#define CIM_RES_TYPE_PROC 3
#define CIM_RES_TYPE_MEM 4
15 years, 6 months
[PATCH] (#2) - Update template RASD in SettingsDefineCapabilities
by Sharad Mishra
# HG changeset patch
# User snmishra(a)us.ibm.com
# Date 1245868683 25200
# Node ID 625b84c62be351f7bb0d7beb7807373a43ba5cf4
# Parent 4bd5db5f544279f099b4d7565157c675cf072936
(#2) - Update template RASD in SettingsDefineCapabilities.
This patch completes the work required to support
bridge NICs.
#2 - Added bridge name to the template.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4bd5db5f5442 -r 625b84c62be3 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Jun 22 11:17:56 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Jun 24 11:38:03 2009 -0700
@@ -538,6 +538,8 @@
static CMPIStatus set_net_props(int type,
const CMPIObjectPath *ref,
const char *id,
+ const char *net_type,
+ const char *net_name,
uint64_t num_nics,
const char *model,
struct inst_list *list)
@@ -549,6 +551,10 @@
if ((inst == NULL) || (s.rc != CMPI_RC_OK))
goto out;
+ CMSetProperty(inst, "NetworkType", (CMPIValue *)net_type, CMPI_chars);
+ if (net_name != NULL)
+ CMSetProperty(inst, "NetworkName",
+ (CMPIValue *)net_name, CMPI_chars);
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "VirtualQuantity",
(CMPIValue *)&num_nics, CMPI_uint64);
@@ -571,6 +577,10 @@
uint64_t num_nics;
const char *id;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ int i,j;
+ const char *type[] = {"network", "bridge"};
+ const char *model[] = {"e1000", NULL};
+ const char *name[] = {NULL, "br0"};
switch (template_type) {
case SDC_RASD_MIN:
@@ -599,12 +609,21 @@
}
- s = set_net_props(template_type, ref, id, num_nics, "e1000", list);
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- s = set_net_props(template_type, ref, id, num_nics, NULL, list);
-
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 2; j++) {
+ s = set_net_props(template_type,
+ ref,
+ id,
+ type[i],
+ name[i],
+ num_nics,
+ model[j],
+ list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+ }
+
out:
return s;
}
15 years, 6 months
[PATCH] (#2) Add check to ensure PoolID specified in NetRASD has valid format
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1245859606 25200
# Node ID 76be9533b5bab87a55c14ab68640c82cfd400b7b
# Parent 3fa64e808da1d96eeb7e58f6f0532a4c00deba4b
(#2) Add check to ensure PoolID specified in NetRASD has valid format
Updates from 1 to 2:
-Add a proper subject and commit log to patch
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3fa64e808da1 -r 76be9533b5ba src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Jun 12 15:11:51 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jun 24 09:06:46 2009 -0700
@@ -537,6 +537,7 @@
{
const char *val = NULL;
const char *msg = NULL;
+ char *network = NULL;
if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
val = _net_rand_mac();
@@ -561,8 +562,14 @@
if (val == NULL)
return "No NetworkPool specified and no default available";
+ network = name_from_pool_id(val);
+ if (network == NULL) {
+ msg = "PoolID specified is not formatted properly";
+ goto out;
+ }
+
free(dev->dev.net.source);
- dev->dev.net.source = name_from_pool_id(val);
+ dev->dev.net.source = strdup(network);
free(dev->dev.net.model);
if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK)
@@ -571,6 +578,7 @@
dev->dev.net.model = strdup(val);
out:
+ free(network);
return msg;
}
15 years, 6 months
[PATCH] Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1245858951 25200
# Node ID 983e35ff6034988d958ec4425d3419906b5c516a
# Parent 3fa64e808da1d96eeb7e58f6f0532a4c00deba4b
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3fa64e808da1 -r 983e35ff6034 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Jun 12 15:11:51 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jun 24 08:55:51 2009 -0700
@@ -537,6 +537,7 @@
{
const char *val = NULL;
const char *msg = NULL;
+ char *network = NULL;
if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
val = _net_rand_mac();
@@ -561,8 +562,14 @@
if (val == NULL)
return "No NetworkPool specified and no default available";
+ network = name_from_pool_id(val);
+ if (network == NULL) {
+ msg = "PoolID specified is not formatted properly";
+ goto out;
+ }
+
free(dev->dev.net.source);
- dev->dev.net.source = name_from_pool_id(val);
+ dev->dev.net.source = strdup(network);
free(dev->dev.net.model);
if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK)
@@ -571,6 +578,7 @@
dev->dev.net.model = strdup(val);
out:
+ free(network);
return msg;
}
15 years, 6 months
[PATCH] Update template RASD in SettingsDefineCapabilities
by Sharad Mishra
# HG changeset patch
# User snmishra(a)us.ibm.com
# Date 1245802726 25200
# Node ID f01f53df87f130915c6152c3a2c97eb9412853b3
# Parent 4bd5db5f544279f099b4d7565157c675cf072936
Update template RASD in SettingsDefineCapabilities.
This patch completes the work required to support
bridge NICs.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4bd5db5f5442 -r f01f53df87f1 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Jun 22 11:17:56 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Jun 23 17:18:46 2009 -0700
@@ -538,6 +538,8 @@
static CMPIStatus set_net_props(int type,
const CMPIObjectPath *ref,
const char *id,
+ const char *net_type,
+ const char *net_name,
uint64_t num_nics,
const char *model,
struct inst_list *list)
@@ -549,6 +551,10 @@
if ((inst == NULL) || (s.rc != CMPI_RC_OK))
goto out;
+ CMSetProperty(inst, "NetworkType", (CMPIValue *)net_type, CMPI_chars);
+ if (net_name != NULL)
+ CMSetProperty(inst, "NetworkName",
+ (CMPIValue *)net_name, CMPI_chars);
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "VirtualQuantity",
(CMPIValue *)&num_nics, CMPI_uint64);
@@ -571,6 +577,9 @@
uint64_t num_nics;
const char *id;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ int i,j;
+ const char *type[] = {"network", "bridge"};
+ const char *model[] = {"e1000", NULL};
switch (template_type) {
case SDC_RASD_MIN:
@@ -599,12 +608,14 @@
}
- s = set_net_props(template_type, ref, id, num_nics, "e1000", list);
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- s = set_net_props(template_type, ref, id, num_nics, NULL, list);
-
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 2; j++) {
+ s = set_net_props(template_type, ref, id, type[i], NULL, num_nics, model[j], list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+ }
+
out:
return s;
}
15 years, 6 months