[PATCH] Allow KVM and Xen to parse both network and bridge interfaces
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212155823 25200
# Node ID 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
# Parent 5b89d6aa5816613627a2869d8c72bde37a9f2e2c
Allow KVM and Xen to parse both network and bridge interfaces.
Since KVM and Xen guests are both created with network interfaces, there no longer needs to be a seperate function for KVM and Xen.
This change allow fixes an error seen when attempting to modify a KVM guest that was created with a non-network inteface (created using a method other than the providers). Even though we don't create guests with bridge type interfaces, we should be able to parse their xmls.
This bit of code will probably need to be updated to support other interface types.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 5b89d6aa5816 -r 0c8d4baf3ee1 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Fri May 30 06:57:03 2008 -0700
+++ b/libxkutil/xmlgen.c Fri May 30 06:57:03 2008 -0700
@@ -189,7 +189,7 @@
return true;
}
-static bool xen_net_to_xml(char **xml, struct virt_device *dev)
+static bool bridge_net_to_xml(char **xml, struct virt_device *dev)
{
int ret;
char *_xml;
@@ -198,10 +198,12 @@
ret = asprintf(&_xml,
"<interface type='%s'>\n"
+ " <source bridge='%s'/>\n"
" <mac address='%s'/>\n"
" <script path='%s'/>\n"
"</interface>\n",
net->type,
+ net->source,
net->mac,
script);
@@ -215,7 +217,7 @@
return true;
}
-static bool kvm_net_to_xml(char **xml, struct virt_device *dev)
+static bool network_net_to_xml(char **xml, struct virt_device *dev)
{
int ret;
char *_xml;
@@ -245,9 +247,9 @@
static bool net_to_xml(char **xml, struct virt_device *dev)
{
if (STREQ(dev->dev.net.type, "network"))
- return kvm_net_to_xml(xml, dev);
+ return network_net_to_xml(xml, dev);
else if (STREQ(dev->dev.net.type, "bridge"))
- return xen_net_to_xml(xml, dev);
+ return bridge_net_to_xml(xml, dev);
else
return false;
}
16 years, 6 months
[PATCH] [TEST] Fixing 02_reverse.py of RAPF
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1212068877 25200
# Node ID 9fae4065c84575412d10f7c1ea07f153a934db4c
# Parent 3ac66cf562f082546883c1de0d748471b557cd39
[TEST] Fixing 02_reverse.py of RAPF.
Added the following extra steps:
1) Defining a domain.
2) creating diskpool, netpool.
Without the steps 1 and 2 the tc used to simply passes.
The tc will fail on KVM with old libvirt-cim rpm as expected and will pass with the latest source with the fix that Dan submitted yest.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 3ac66cf562f0 -r 9fae4065c845 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Fri May 30 00:24:45 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Thu May 29 06:47:57 2008 -0700
@@ -6,6 +6,7 @@
# Guolian Yun <yunguol(a)cn.ibm.com>
# Kaitlin Rupert <karupert(a)us.ibm.com>
# Zhengang Li <lizg(a)cn.ibm.com>
+# 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
@@ -25,69 +26,149 @@ import sys
import sys
from VirtLib import utils
from XenKvmLib import assoc
-from XenKvmLib import devices
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
from CimTest import Globals
from CimTest.Globals import logger, do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib import enumclass
+from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf, \
+create_netpool_conf
+
sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = "RAPF_dom"
+test_vcpus = 1
+test_mem = 128
+test_mac = "00:11:22:33:44:aa"
+
+def setup_env(server, virt):
+ destroy_and_undefine_all(server)
+ vsxml = None
+ if virt == "Xen":
+ test_disk = "xvda"
+ else:
+ test_disk = "hda"
+
+ virtxml = get_class(virt)
+ vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus,
+ mac = test_mac, disk = test_disk)
+ try:
+ ret = vsxml.define(server)
+ if not ret:
+ logger.error("Failed to Define the domain: %s", test_dom)
+ return FAIL, vsxml
+
+ except Exception, details:
+ logger.error("Exception : %s", details)
+ return FAIL, vsxml
+
+ return PASS, vsxml
+
+def get_rasd_or_pool_instid(server, virt, cn):
+ key_list = ["InstanceID"]
+ inst = []
+ try:
+ inst = enumclass.enumerate(server, cn, key_list, virt)
+ except Exception:
+ logger.error(Globals.CIM_ERROR_ENUMERATE, cn)
+ return inst, FAIL
+ return inst, PASS
+
+def get_instance(server, virt, vsxml, cn, pool_list, app_val=0):
+ instances, status = get_rasd_or_pool_instid(server, virt, cn)
+ if status != PASS:
+ vsxml.undefine(server)
+ return pool_list, status
+
+ if app_val == 1:
+ for inst in instances:
+ pool_list.append(inst.InstanceID)
+ return instances, pool_list, status
+
+
+def verify_pool_from_RAPF(server, virt, instances, pool_instid_list, cn):
+ pool = []
+ for inst in instances:
+ try:
+ pool = assoc.AssociatorNames(server, "ResourceAllocationFromPool",
+ cn, virt, InstanceID = inst.InstanceID)
+ except Exception:
+ logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES, inst.InstanceID)
+ status = FAIL
+
+ if len(pool) < 1:
+ logger.error("No associated pool for %s", inst.InstanceID)
+ return FAIL
+
+ if not pool[0]['InstanceID'] in pool_instid_list:
+ logger.error("InstanceID Mismatch")
+ return FAIL
+
+ return PASS
+
+def get_inst_verify_pool_from_RAPF(server, virt, vsxml, pool_cn, cn):
+ pool_list = []
+ pool, pool_list, status = get_instance(server, virt, vsxml,
+ pool_cn, pool_list, app_val=1)
+ if status != PASS:
+ return status
+
+ devinst, pool_list, status = get_instance(server, virt, vsxml, cn,
+ pool_list, app_val=0)
+ if status != PASS:
+ return status
+
+ status = verify_pool_from_RAPF(server, virt, devinst, pool_list, cn)
+
+ if status != PASS:
+ vsxml.undefine(server)
+
+ return status
+
@do_main(sup_types)
def main():
options = main.options
status = PASS
+ server = options.ip
+ virt = options.virt
+
+ status,vsxml = setup_env(server, virt)
+ if status != PASS:
+ return status
- key_list = ["DeviceID", "CreationClassName", "SystemName",
- "SystemCreationClassName"]
- try:
- mem = devices.enumerate(options.ip, 'Memory', key_list, options.virt)
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % 'Memory')
- return FAIL
+ status, diskid = create_diskpool_conf(server, virt)
+ if status != PASS:
+ return status
- try:
- proc = devices.enumerate(options.ip, 'Processor', key_list, options.virt)
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % 'Processor')
- return FAIL
-
- for i in range(len(mem)):
- try:
- mempool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool",
- "MemResourceAllocationSettingData",
- options.virt,
- InstanceID = mem[i].DeviceID)
- except Exception:
- logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % mem[i].DeviceID)
- status = FAIL
+ status, test_network = create_netpool_conf(server, virt)
+ if status != PASS:
+ return status
- if len(mempool) < 1:
- logger.error("No associated pool for %s" % mem[i].DeviceID)
- return FAIL
+ status = get_inst_verify_pool_from_RAPF(server, virt, vsxml, 'MemoryPool',
+ 'MemResourceAllocationSettingData')
+ if status != PASS:
+ return status
- if mempool[0].keybindings['InstanceID'] != "MemoryPool/0":
- logger.error("MemResourceAllocationSettingData association error")
- return FAIL
-
- for j in range(len(proc)):
- try:
- procpool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool",
- "ProcResourceAllocationSettingData",
- options.virt,
- InstanceID = proc[j].DeviceID)
- except Exception:
- logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % proc[j].DeviceID)
- return FAIL
-
- if len(procpool) < 1:
- logger.error("No associated pool for %s" % proc[j].DeviceID)
- return FAIL
+ status = get_inst_verify_pool_from_RAPF(server, virt, vsxml, 'ProcessorPool',
+ 'ProcResourceAllocationSettingData')
+ if status != PASS:
+ return status
- if procpool[0].keybindings['InstanceID'] != "ProcessorPool/0":
- logger.error("ProcResourceAllocationSettingData association failed")
- status = FAIL
+ status = get_inst_verify_pool_from_RAPF(server, virt, vsxml, 'DiskPool',
+ 'DiskResourceAllocationSettingData')
+ if status != PASS:
+ return status
+ status = get_inst_verify_pool_from_RAPF(server, virt, vsxml, 'NetworkPool',
+ 'NetResourceAllocationSettingData')
+ if status != PASS:
+ return status
+
+ cleanup_restore(server, virt)
+ vsxml.undefine(server)
return status
if __name__ == "__main__":
16 years, 6 months
[PATCH] [TEST] #2 Make RHEL 5 XenFV guest grub conf use hda
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1211564341 25200
# Node ID cefb85c07235328269cd17c08f3368941374ea96
# Parent 3233a070377270931b4cc1d790b6782fee17d1b6
[TEST] #2 Make RHEL 5 XenFV guest grub conf use hda.
It looks like qemu on RHEL emulates an ide drive, not a scsi drive.
Updates:
-Instead of using distro, use qemu-dm version.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3233a0703772 -r cefb85c07235 suites/libvirt-cim/images/xmt-makefv.sh
--- a/suites/libvirt-cim/images/xmt-makefv.sh Fri May 23 18:14:28 2008 +0800
+++ b/suites/libvirt-cim/images/xmt-makefv.sh Fri May 23 10:39:01 2008 -0700
@@ -14,6 +14,9 @@
PARTED="parted -s"
TMPMOUNT=/tmp/cimtest_image_temp
SIZE=16
+QEMU_VER=082
+
+CUR_QEMU_VER=`strings /usr/lib64/xen/bin/qemu-dm | awk '/version [0-9]/ { print $5; }' | sed 's/,//' | sed 's/\.//g'`
die() {
echo "FAILED: $i" >&2
@@ -110,10 +113,19 @@
timeout 1
title Test Environment
root (hd0,0)
+EOF
+
+if [ $CUR_QEMU_VER -lt $QEMU_VER ]; then
+ cat >>${root}/grub/grub.conf <<EOF
+ kernel /vmlinuz root=/dev/hda1
+ initrd /initrd
+EOF
+else
+ cat >>${root}/grub/grub.conf <<EOF
kernel /vmlinuz root=/dev/sda1
initrd /initrd
EOF
-
+fi
}
ramdisk=$1
16 years, 6 months
[TEST] CimTest Report for KVM on F9 (2008/06/02)
by Guo Lian Yun
stro: Fedora 9 Beta
Kernel: 2.6.25-0.121.rc5.git4.fc9
Libvirt: 0.4.1-7.fc9
CIMOM: 2.7.0-6.fc9
PyWBEM: 0.6-1
libcmpiutil: 0.3-1.fc9
libvirt-cim: 0.3-4.fc9
cimtest: changeset-171
=================== FAIL ===========================================
ComputerSystemIndication - 01_created_indication.py: FAIL
ElementConforms - 02_reverse.py: FAIL
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: FAIL
HostSystem - 02_hostsystem_to_rasd.py: FAIL
NetworkPort - 01_netport.py: FAIL
NetworkPort - 03_user_netport.py: FAIL
RASD - 01_verify_rasd_fields.py: FAIL
ResourceAllocationFromPool - 05_RAPF_err.py: FAIL
VirtualSystemManagementService - 08_modifyresource.py: FAIL
========FULL CIMTEST REPORT=PASS(95)=FAIL(9)=SKIP(18)=XFAIL(7)=======
AllocationCapabilities - 01_enum.py: PASS
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
ComputerSystem - 01_enum.py: PASS
ComputerSystem - 02_nosystems.py: PASS
ComputerSystem - 03_defineVS.py: PASS
ComputerSystem - 04_defineStartVS.py: PASS
ComputerSystem - 05_activate_defined_start.py: XFAIL Bug: 00002
ComputerSystem - 06_paused_active_suspend.py: XFAIL Bug: 00002
ComputerSystem - 22_define_suspend.py: PASS
ComputerSystem - 23_suspend_suspend.py: SKIP
ComputerSystem - 27_define_suspend_errs.py: SKIP
ComputerSystem - 32_start_reboot.py: SKIP
ComputerSystem - 33_suspend_reboot.py: SKIP
ComputerSystem - 35_start_reset.py: SKIP
ComputerSystem - 40_RSC_start.py: XFAIL Bug: 00001
InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Domain Operation Failed
Bug:<00001>
ComputerSystem - 41_cs_to_settingdefinestate.py: SKIP
ComputerSystem - 42_cs_gi_errs.py: PASS
ComputerSystemIndication - 01_created_indication.py: FAIL
ElementAllocatedFromPool - 01_forward.py: SKIP
ElementAllocatedFromPool - 02_reverse.py: SKIP
ElementAllocatedFromPool - 03_reverse_errs.py: XFAIL Bug: 88651
ElementAllocatedFromPool - 04_forward_errs.py: XFAIL Bug: 88651
ElementCapabilities - 01_forward.py: PASS
ElementCapabilities - 02_reverse.py: PASS
ElementCapabilities - 03_forward_errs.py: PASS
ElementCapabilities - 04_reverse_errs.py: PASS
ElementCapabilities - 05_hostsystem_cap.py: PASS
ElementConforms - 01_forward.py: PASS
ElementConforms - 02_reverse.py: FAIL
ElementConforms - 03_ectp_fwd_errs.py: XFAIL Bug: 92642
Bug:<92642>
Bug:<92642>
ElementConforms - 04_ectp_rev_errs.py: XFAIL Bug: 92642
Bug:<92642>
Bug:<92642>
Bug:<92642>
Bug:<92642>
Bug:<92642>
Bug:<92642>
Bug:<92642>
Bug:<92642>
ElementSettingData - 01_forward.py: PASS
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: FAIL
EnabledLogicalElementCapabilities - 01_enum.py: PASS
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
HostSystem - 01_enum.py: PASS
HostSystem - 02_hostsystem_to_rasd.py: FAIL
HostSystem - 03_hs_to_settdefcap.py: PASS
HostSystem - 04_hs_to_EAPF.py: SKIP
HostSystem - 05_hs_gi_errs.py: PASS
HostSystem - 06_hs_to_vsms.py: PASS
HostedDependency - 01_forward.py: PASS
HostedDependency - 02_reverse.py: PASS
HostedDependency - 03_enabledstate.py: PASS
HostedDependency - 04_reverse_errs.py: PASS
HostedResourcePool - 01_forward.py: PASS
HostedResourcePool - 02_reverse.py: PASS
HostedResourcePool - 03_forward_errs.py: PASS
HostedResourcePool - 04_reverse_errs.py: PASS
HostedService - 01_forward.py: PASS
HostedService - 02_reverse.py: PASS
HostedService - 03_forward_errs.py: PASS
HostedService - 04_reverse_errs.py: PASS
LogicalDisk - 01_disk.py: PASS
LogicalDisk - 02_nodevs.py: PASS
LogicalDisk - 03_ld_gi_errs.py: PASS
Memory - 01_memory.py: PASS
Memory - 02_defgetmem.py: PASS
Memory - 03_mem_gi_errs.py: PASS
NetworkPort - 01_netport.py: FAIL
NetworkPort - 02_np_gi_errors.py: PASS
NetworkPort - 03_user_netport.py: FAIL
Processor - 01_processor.py: PASS
Processor - 02_definesys_get_procs.py: PASS
Processor - 03_proc_gi_errs.py: PASS
Profile - 01_enum.py: PASS
Profile - 02_profile_to_elec.py: SKIP
Profile - 03_rprofile_gi_errs.py: SKIP
RASD - 01_verify_rasd_fields.py: FAIL
RASD - 02_enum.py: PASS
RASD - 03_rasd_errs.py: PASS
ReferencedProfile - 01_verify_refprof.py: SKIP
ReferencedProfile - 02_refprofile_errs.py: SKIP
ResourceAllocationFromPool - 01_forward.py: PASS
ResourceAllocationFromPool - 02_reverse.py: PASS
ResourceAllocationFromPool - 03_forward_errs.py: PASS
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
ResourceAllocationFromPool - 05_RAPF_err.py: FAIL
ResourcePool - 01_enum.py: PASS
ResourcePool - 02_rp_gi_errors.py: PASS
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
ResourcePoolConfigurationService - 01_enum.py: PASS
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: PASS
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
PASS
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: PASS
SettingsDefine - 01_forward.py: PASS
SettingsDefine - 02_reverse.py: PASS
SettingsDefine - 03_sds_fwd_errs.py: PASS
SettingsDefine - 04_sds_rev_errs.py: PASS
SettingsDefineCapabilities - 01_forward.py: PASS
SettingsDefineCapabilities - 03_forward_errs.py: PASS
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
SystemDevice - 01_forward.py: PASS
SystemDevice - 02_reverse.py: PASS
SystemDevice - 03_fwderrs.py: PASS
VSSD - 01_enum.py: PASS
VSSD - 02_bootldr.py: SKIP
VSSD - 03_vssd_gi_errs.py: PASS
VSSD - 04_vssd_to_rasd.py: PASS
VirtualSystemManagementCapabilities - 01_enum.py: PASS
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
VirtualSystemManagementService - 01_definesystem_name.py: PASS
VirtualSystemManagementService - 02_destroysystem.py: PASS
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
VirtualSystemManagementService - 05_destroysystem_neg.py: PASS
VirtualSystemManagementService - 06_addresource.py: PASS
VirtualSystemManagementService - 07_addresource_neg.py: PASS
VirtualSystemManagementService - 08_modifyresource.py: FAIL
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
VirtualSystemMigrationSettingData - 01_enum.py: PASS
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
VirtualSystemSettingDataComponent - 01_forward.py: SKIP
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
VirtualSystemSnapshotService - 01_enum.py: PASS
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py:
PASS
Best,
Regards
Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol(a)cn.ibm.com
TEL: (86)-21-60922144
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203
16 years, 6 months