[Libvirt-cim] [PATCH] [TEST] Add new tc RASDIndications/02_guest_add_mod_rem_rasd_ind.py
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Tue Sep 22 21:03:11 UTC 2009
> +sup_types = ['KVM', 'Xen']
Have this support XenFV as well.
> +
> +nmem = 256
> +nmac = '00:11:22:33:44:55'
> +
> +def create_guest(test_dom, ip, virt, cxml):
> + try:
> + ret = cxml.cim_define(ip)
> + if not ret:
> + raise Exception("Failed to define domain %s" % test_dom)
> +
> + status, dom_cs = poll_for_state_change(ip, virt, test_dom,
> + CIM_DISABLE)
> + if status != PASS:
> + raise Exception("Dom '%s' not in expected state '%s'" \
> + % (test_dom, CIM_DISABLE))
> +
> + ret = cxml.cim_start(ip)
> + if ret:
> + raise Exception("Failed to start the domain '%s'" % test_dom)
> + cxml.undefine(ip)
> +
> + status, dom_cs = poll_for_state_change(ip, virt, test_dom,
> + CIM_ENABLE)
> + if status != PASS:
> + raise Exception("Dom '%s' not in expected state '%s'" \
> + % (test_dom, CIM_ENABLE))
> +
> + except Exception, details:
> + logger.error("Exception details: %s", details)
> + return FAIL, cxml
> +
> + return PASS, cxml
> +
> +
> +def get_rasd_rec(virt, cn, s_sysname, inst_id):
> + classname = get_typed_class(virt, cn)
> + recs = EnumNames(s_sysname, classname)
> + rasd = None
> + for rasd_rec in recs:
> + ret_pool = rasd_rec['InstanceID']
> + if ret_pool == inst_id:
> + rasd = rasd_rec
> + break
> +
> + return rasd
> +
> +def gen_indication(test_dom, s_sysname, virt, cxml, service, ind_name,
> + rasd=None, nmem_disk=None):
> + status = FAIL
> + try:
> +
> + if ind_name == "add":
> + cn = 'VirtualSystemSettingData'
> + inst_id = '%s:%s' % (virt, test_dom)
> + classname = get_typed_class(virt, cn)
> + vssd_ref = get_rasd_rec(virt, cn, s_sysname, inst_id)
> +
> + if vssd_ref == None:
> + raise Exception("Failed to get vssd_ref for '%s'" % test_dom)
> +
> + status = vsms_util.add_disk_res(s_sysname, service, cxml,
> + vssd_ref, rasd, nmem_disk)
> +
> + elif ind_name == "modify":
> + status = vsms_util.mod_mem_res(s_sysname, service, cxml,
> + rasd, nmem_disk)
KVM doesn't support ballooning of memory while the guest is running.
You'll need to do this when the guest is shutdown.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list