libvirt-cim-bounces(a)redhat.com wrote on 2008-04-01 01:55:05:
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206986066 25200
# Node ID ace377826c9c8f3b034f5c696ffb71dfb163d77b
# Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x)
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
+1 from me. Test it on python-2.5.1-15.fc8.
diff -r 5d4743710455 -r ace377826c9c suites/libvirt-
cim/lib/XenKvmLib/test_doms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 07:
54:19 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 10:
54:26 2008 -0700
@@ -22,11 +22,23 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
#
import tempfile
-import uuid
import os
from VirtLib import utils
from VirtLib import live
from CimTest.Globals import CIM_FUUID
+
+try:
+ import uuid as _uuid
+ def uuid():
+ return str(_uuid.uuid1())
+except ImportError:
+ def uuid():
+ from commands import getstatusoutput as run
+ s, o = run('uuidgen')
+ if s == 0:
+ return o
+ else:
+ raise ImportError("Missing uuid library (and can't fake
it)")
def define_test_domain(xml, server, virt="Xen"):
name = tempfile.mktemp()
@@ -74,7 +86,7 @@ def set_uuid(myuuid=0):
"""Generate a random uuid and record it into
CIM_FUUID"""
if myuuid == 0:
- myuuid = uuid.uuid1().urn[9:]
+ myuuid = uuid()
f = file(CIM_FUUID, 'a')
f.write('%s\n' % myuuid)
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim