# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1228774860 28800
# Node ID 625cd6182f62b05bf0292d4174ec13a6682eef3b
# Parent 766607a007ebed33d006e950556c8d745fd0b58d
[TEST] Add function to parse InstanceIDs
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 766607a007eb -r 625cd6182f62 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Tue Dec 02 21:29:39 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Mon Dec 08 14:21:00 2008 -0800
@@ -498,3 +498,15 @@
Globals.CIM_NS = prev_namespace
return status, linux_cs
+
+def parse_instance_id(instid):
+ str_arr = instid.split("/")
+ if len(str_arr) < 2:
+ return None, None, FAIL
+
+ guest_name = str_arr[0]
+
+ devid = instid.lstrip("%s/" % guest_name)
+
+ return guest_name, devid, PASS
+