[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Change the way domain configuration is handled in xm-test.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 1dc393b6501906feac819dec9c05b225a852c9c1
# Parent  ef2fff896422a3133d0abb18cce3923eebb1c321
Change the way domain configuration is handled in xm-test.
This will simplify the way we differentiate between HV and PV domains,
as well as make it easier to run normal tests in either HV or PV mode.

This patch has been modified by Ewan Mellor, to match his recent changes to
remove the nics= configuration option.

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>
Signed-off-by: Dan Stekloff <dsteklof@xxxxxxxxxx>

diff -r ef2fff896422 -r 1dc393b65019 tools/xm-test/lib/XmTestLib/XenDomain.py
--- a/tools/xm-test/lib/XmTestLib/XenDomain.py  Tue Dec 13 10:57:18 2005
+++ b/tools/xm-test/lib/XmTestLib/XenDomain.py  Tue Dec 13 16:26:24 2005
@@ -30,18 +30,140 @@
 
 BLOCK_ROOT_DEV = "hda"
 
-def XmTestDomain(name=None, extraOpts=None, config="/dev/null"):
-    if ENABLE_VMX_SUPPORT:
-        return XmTestVmxDomain(name, extraOpts, config)
+def getDeviceModel():
+    """Get the path to the device model based on
+    the architecture reported in uname"""
+    arch = os.uname()[4]
+    if re.search("64", arch):
+        return "/usr/lib64/xen/bin/qemu-dm"
     else:
-        return XmTestPvDomain(name, extraOpts, config)
+        return "/usr/lib/xen/bin/qemu-dm"
 
 def getDefaultKernel():
+    """Get the path to the default DomU kernel"""
     dom0Ver = commands.getoutput("uname -r");
     domUVer = dom0Ver.replace("xen0", "xenU");
     
     return "/boot/vmlinuz-" + domUVer;
 
+def getUniqueName():
+    """Get a uniqueish name for use in a domain"""
+    unixtime = int(time.time())
+    test_name = sys.argv[0]
+    test_name = re.sub("\.test", "", test_name)
+    test_name = re.sub("[\/\.]", "", test_name)
+    name = "%s-%i" % (test_name, unixtime)
+    
+    return name
+
+def getRdPath():
+    rdpath = os.environ.get("RD_PATH")
+    if not rdpath:
+        rdpath = "../../ramdisk"
+    rdpath = os.path.abspath(rdpath)
+
+    return rdpath
+
+ParavirtDefaults = {"memory"       : 64,
+                    "vcpus"        : 1,
+                    "kernel"       : getDefaultKernel(),
+                    "root"         : "/dev/ram0",
+                    "ramdisk"      : getRdPath() + "/initrd.img"
+                    }
+VmxDefaults =      {"memory"       : 64,
+                    "vcpus"        : 1,
+                    "nics"         : 0,
+                    "disk"         : ["file:%s/disk.img,ioemu:%s,w" %
+                                   (getRdPath(), BLOCK_ROOT_DEV)],
+                    "kernel"       : "/usr/lib/xen/boot/vmxloader",
+                    "builder"      : "vmx",
+                    "sdl"          : 0,
+                    "vnc"          : 0,
+                    "vncviewer"    : 0,
+                    "nographic"    : 1,
+                    "serial"       : "pty",
+                    "device_model" : getDeviceModel()
+                    }
+
+if ENABLE_VMX_SUPPORT:
+    configDefaults = VmxDefaults
+else:
+    configDefaults = ParavirtDefaults
+
+class XenConfig:
+    """An object to help create a xen-compliant config file"""
+    def __init__(self):
+        self.defaultOpts = {}
+
+        # These options need to be lists
+        self.defaultOpts["disk"] = []
+        self.defaultOpts["vif"]  = []
+
+        self.opts = self.defaultOpts
+
+    def toString(self):
+        """Convert this config to a string for writing out
+        to a file"""
+        string = "# Xen configuration generated by xm-test\n"
+        for k, v in self.opts.items():
+            if isinstance(v, int):
+                piece = "%s = %i" % (k, v)
+            elif isinstance(v, list) and v:
+                piece = "%s = %s" % (k, v)
+            elif isinstance(v, str) and v:
+                piece = "%s = \"%s\"" % (k, v)
+            else:
+                piece = None
+
+            if piece:
+                string += "%s\n" % piece
+
+        return string
+
+    def write(self, filename):
+        """Write this config out to filename"""
+        output = file(filename, "w")
+        output.write(self.toString())
+        output.close()
+
+    def __str__(self):
+        """When used as a string, we represent ourself by a config
+        filename, which points to a temporary config that we write
+        out ahead of time"""
+        filename = "/tmp/xm-test.conf"
+        self.write(filename)
+        return filename
+
+    def setOpt(self, name, value):
+        """Set an option in the config"""
+        if name in self.opts.keys() and isinstance(self.opts[name], list) and 
not isinstance(value, list):
+                self.opts[name] = [value]
+        else:
+            self.opts[name] = value
+
+    def appOpt(self, name, value):
+        """Append a value to a list option"""
+        if name in self.opts.keys() and isinstance(self.opts[name], list):
+            self.opts[name].append(value)
+
+    def getOpt(self, name):
+        """Return the value of a config option"""
+        if name in self.opts.keys():
+            return self.opts[name]
+        else:
+            return None
+
+    def setOpts(self, opts):
+        """Batch-set options from a dictionary"""
+        for k, v in opts.items():
+            self.setOpt(k, v)
+
+    def clearOpts(self, name=None):
+        """Clear one or all config options"""
+        if name:
+            self.opts[name] = self.defaultOpts[name]
+        else:
+            self.opts = self.defaultOpts
 
 class DomainError(Exception):
     def __init__(self, msg, extra="", errorcode=0):
@@ -55,62 +177,24 @@
     def __str__(self):
         return str(self.msg)
 
+
 class XenDomain:
 
-    def __init__(self, opts={}, config="/dev/null"):
-        """Create a domain object.  Optionally take a 
-        dictionary of 'xm' options to use"""
-
-        self.domID = None;
+    def __init__(self, name=None, config=None):
+        """Create a domain object.
+        @param config: String filename of config file
+        """
+
+        if name:
+            self.name = name
+        else:
+            self.name = getUniqueName()
+
         self.config = config
 
-        if not opts.has_key("name"):
-            raise DomainError("Missing `name' option")
-        if not opts.has_key("memory"):
-            raise DomainError("Missing `memory' option")
-        if not opts.has_key("kernel"):
-            raise DomainError("Missing `kernel' option")
-
-        self.opts = opts
-
-        self.configVals = None
-
-    def __buildCmdLine(self):
-        c = "xm create %s" % self.config
-
-        for k in self.opts.keys():
-            c += " %s=%s" % (k, self.opts[k])
-        
-        return c
-
-    def getUniqueName(self):
-        #
-        # We avoid multiple duplicate names
-        # here because they stick around in xend
-        # too long
-        #
-        unixtime = int(time.time())
-        test_name = sys.argv[0]
-        test_name = re.sub("\.test", "", test_name)
-        test_name = re.sub("[\/\.]", "", test_name)
-        name = "%s-%i" % (test_name, unixtime)
-
-        return name
-
     def start(self):
 
-        if self.configVals:
-            self.__writeConfig("/tmp/xm-test.conf")
-            self.config = "/tmp/xm-test.conf"
-
-        commandLine = self.__buildCmdLine()
-
-        ret, output = traceCommand(commandLine);
-
-        try:
-            self.domID = self.getId()
-        except:
-            self.domID = -1;
+        ret, output = traceCommand("xm create %s" % self.config)
 
         if ret != 0:
             raise DomainError("Failed to create domain",
@@ -118,190 +202,79 @@
                               errorcode=ret)
 
     def stop(self):
-        prog = "xm";
-        cmd = " shutdown ";
-
-        ret, output = traceCommand(prog + cmd + self.opts["name"]);
-
-        return ret;
+        prog = "xm"
+        cmd = " shutdown "
+
+        ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
+
+        return ret
 
     def destroy(self):
-        prog = "xm";
-        cmd = " destroy ";
-
-        ret, output = traceCommand(prog + cmd + self.opts["name"]);
-
-        return ret;
+        prog = "xm"
+        cmd = " destroy "
+
+        ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
+
+        return ret
 
     def getName(self):
-        return self.opts["name"];
+        return self.name
 
     def getId(self):
         return domid(self.getName());
 
-    def configSetVar(self, key, value):
-        if not self.configVals:
-            self.configVals = {}
-
-        self.configVals[key] = value
-
-    def configAddDisk(self, pdev, vdev, acc):
-        if not self.configVals:
-            self.configVals = {}
-
-        if not self.configVals.has_key("disk"):
-            self.configVals["disk"] = []
-
-        self.configVals["disk"].append("%s,%s,%s" % (pdev,vdev,acc))
-
-    def configAddVif(self, type, mac, bridge):
-        if not self.configVals:
-            self.configVals = {}
-
-        if not self.configVals.has_key("vif"):
-            self.configVals["vif"] = []
-
-        if mac:
-            self.configVals["vif"].append("%s,%s,%s" % (type,mac,bridge))
-        else:
-            self.configVals["vif"].append("%s,%s" % (type,bridge))
-
-    def __writeConfig(self, configFileName):
-
-        conf = file(configFileName, "w")
-
-        for k,v in self.configVals.items():
-            print >>conf, "%s = %s" % (k, v)
-
-        conf.close()
-
-class XmTestVmxDomain(XenDomain):
-
-    def __prepareBlockRoot(self, rdpath):
-        image = os.path.abspath(rdpath + "/disk.img")
-        self.configAddDisk("file:%s" % image, "ioemu:%s" % BLOCK_ROOT_DEV, "w")
-
-    def __prepareVif(self):
-        self.configAddVif("type=ioemu", None, "bridge=xenbr0")
-
-    def __prepareDeviceModel(self):
-        arch = os.uname()[4]
-        if re.search('64', arch):
-            self.configSetVar("device_model", "\"/usr/lib64/xen/bin/qemu-dm\"")
-        else:
-            self.configSetVar("device_model", "\"/usr/lib/xen/bin/qemu-dm\"")
-
-    def __init__(self, name=None, extraOpts=None, config="/dev/null"):
-
-        rdpath = os.environ.get("RD_PATH")
-        if not rdpath:
-            rdpath = "../../ramdisk"
-
-        self.opts = {}
-        self.configVals = {}
-
-        # Defaults
-        self.defaults = {"memory"    : 64,
-                         "vcpus"     : 1,
-                         "kernel"    : "/usr/lib/xen/boot/vmxloader",
-                         "builder"   : "\'vmx\'",
-                         "name"      : name or self.getUniqueName()
-                         }
-
-        self.domID = None;
-        self.config = config;
-
-        self.__prepareBlockRoot(rdpath)
-       #self.__prepareVif()
-        self.__prepareDeviceModel()
-        #self.configSetVar("boot","\'c\'")
-        self.configSetVar("sdl","0")
-        self.configSetVar("vnc","0")
-        self.configSetVar("vncviewer","0")
-        self.configSetVar("nographic","1")
-        self.configSetVar("serial","\'pty\'")
-
-        # Copy over defaults
-        for key in self.defaults.keys():
-            self.opts[key] = self.defaults[key]
-
-        # Merge in extra options
-        if extraOpts:
-            for key in extraOpts.keys():
-                self.opts[key] = extraOpts[key]
+
+class XmTestDomain(XenDomain):
+
+    def __init__(self, name=None, extraConfig=None, baseConfig=configDefaults):
+        """Create a new xm-test domain
+        @param name: The requested domain name
+        @param extraConfig: Additional configuration options
+        @param baseConfig: The initial configuration defaults to use
+        """
+        config = XenConfig()
+        config.setOpts(baseConfig)
+        if extraConfig:
+            config.setOpts(extraConfig)
+
+        if name:
+            config.setOpt("name", name)
+        elif not config.getOpt("name"):
+            config.setOpt("name", getUniqueName())
+
+        XenDomain.__init__(self, config.getOpt("name"), config=config)
 
     def start(self):
-        """We know how about how long everyone will need to wait
-        for our disk image to come up, so we do it here as a convenience"""
-
-#        for i in range(0,5):
-#            status, output = traceCommand("xm list")
-
         XenDomain.start(self)
-        waitForBoot()
+        if ENABLE_VMX_SUPPORT:
+            waitForBoot()
 
     def startNow(self):
         XenDomain.start(self)
 
-    def getMem(self):
-        return int(self.opts["memory"])
-
     def minSafeMem(self):
         return 16
 
-class XmTestPvDomain(XenDomain):
-
-    def __init__(self, name=None, extraOpts=None, config="/dev/null"):
-
-        rdpath = os.environ.get("RD_PATH")
-        if not rdpath:
-            rdpath = "../../ramdisk"
-
-        self.opts = {}
-        self.configVals = None
-
-        # Defaults
-        self.defaults = {"memory"  : 64,
-                         "vcpus"   : 1,
-                         "kernel"  : getDefaultKernel(),
-                         "root"    : "/dev/ram0",
-                         "name"    : name or self.getUniqueName(),
-                         "ramdisk" : rdpath + "/initrd.img"
-                         }
-
-        self.domID = None;
-        self.config = config;
-
-        # Copy over defaults
-        for key in self.defaults.keys():
-            self.opts[key] = self.defaults[key]
-
-        # Merge in extra options
-        if extraOpts:
-            for key in extraOpts.keys():
-                self.opts[key] = extraOpts[key]
-
-    def start(self):
-        """We know how about how long everyone will need to wait
-        for our ramdisk to come up, so we do it here as a convenience"""
-
-#        for i in range(0,5):
-#            status, output = traceCommand("xm list")
-
-        XenDomain.start(self)
-#        waitForBoot()
-
-    def startNow(self):
-        XenDomain.start(self)
-
-    def getMem(self):
-        return int(self.opts["memory"])
-
-    def minSafeMem(self):
-        return 16
-
 if __name__ == "__main__":
 
-    d = XmTestDomain();
-
-    d.start();
+    c = XenConfig()
+
+    c.setOpt("foo", "bar")
+    c.setOpt("foob", 1)
+    opts = {"opt1" : 19,
+            "opt2" : "blah"}
+    c.setOpts(opts)
+
+    c.setOpt("disk", "phy:/dev/ram0,hda1,w")
+    c.appOpt("disk", "phy:/dev/ram1,hdb1,w")
+
+    print str(c)
+
+    
+
+#    c.write("/tmp/foo.conf")
+
+#    d = XmTestDomain();
+#
+#    d.start();
+
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py
--- a/tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py   Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py   Tue Dec 
13 16:26:24 2005
@@ -21,8 +21,9 @@
 
 # Now try to start a DomU with write access to /dev/ram0
 
-domain = XmTestDomain();
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
+
+domain = XmTestDomain(extraConfig=config);
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-create/12_block_attach_shared_domU.py
--- a/tools/xm-test/tests/block-create/12_block_attach_shared_domU.py   Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/block-create/12_block_attach_shared_domU.py   Tue Dec 
13 16:26:24 2005
@@ -5,11 +5,11 @@
 
 from XmTestLib import *
 
-dom1 = XmTestDomain()
-dom2 = XmTestDomain(dom1.getName() + "-2")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
 
-dom1.configAddDisk("phy:/dev/ram0", "hda1", "w")
-dom2.configAddDisk("phy:/dev/ram0", "hda1", "w")
+dom1 = XmTestDomain(extraConfig=config)
+dom2 = XmTestDomain(dom1.getName() + "-2",
+                    extraConfig=config)
 
 try:
     dom1.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py
--- a/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py Tue Dec 
13 16:26:24 2005
@@ -5,9 +5,8 @@
 
 from XmTestLib import *
 
-domain = XmTestDomain()
-
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
+domain = XmTestDomain(extraConfig=config)
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py
--- a/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py  Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py  Tue Dec 
13 16:26:24 2005
@@ -5,9 +5,8 @@
 
 from XmTestLib import *
 
-domain = XmTestDomain()
-
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
+domain = XmTestDomain(extraConfig=config)
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-list/01_block-list_pos.py
--- a/tools/xm-test/tests/block-list/01_block-list_pos.py       Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/block-list/01_block-list_pos.py       Tue Dec 13 
16:26:24 2005
@@ -8,9 +8,8 @@
 
 from XmTestLib import *
 
-domain = XmTestDomain()
-
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
+domain = XmTestDomain(extraConfig=config)
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py
--- a/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py     Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py     Tue Dec 
13 16:26:24 2005
@@ -8,9 +8,8 @@
 
 from XmTestLib import *
 
-domain = XmTestDomain()
-
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+config = {"disk":"phy:/dev/ram0,hda1,w"}
+domain = XmTestDomain(extraConfig=config)
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/01_create_basic_pos.py
--- a/tools/xm-test/tests/create/01_create_basic_pos.py Tue Dec 13 10:57:18 2005
+++ b/tools/xm-test/tests/create/01_create_basic_pos.py Tue Dec 13 16:26:24 2005
@@ -12,9 +12,9 @@
 # Create a domain (default XmTestDomain, with our ramdisk)
 domain = XmTestDomain()
 
-if int(getInfo("free_memory")) < domain.getMem():
+if int(getInfo("free_memory")) < domain.config.getOpt("memory"):
     SKIP("This test needs %i MB of free memory (%i MB avail)" %
-         (domain.getMem(), int(getInfo("free_memory"))))
+         (domain.config.getOpt("memory"), int(getInfo("free_memory"))))
 
 # Start it
 try:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/06_create_mem_neg.py
--- a/tools/xm-test/tests/create/06_create_mem_neg.py   Tue Dec 13 10:57:18 2005
+++ b/tools/xm-test/tests/create/06_create_mem_neg.py   Tue Dec 13 16:26:24 2005
@@ -19,15 +19,8 @@
        rdpath = "../ramdisk"
 
 # Test 1: create a domain with mem=0
-opts1 =  {
-            "name"    : "default",
-            "memory"  : 0,
-            "kernel"  : getDefaultKernel(),
-            "root"    : "/dev/ram0",
-            "ramdisk" : rdpath + "/initrd.img",
-            }
-
-domain1=XenDomain(opts1)
+config1 = {"memory": 0}
+domain1=XmTestDomain(extraConfig=config1)
 
 try:
     domain1.start()
@@ -43,17 +36,10 @@
 # Test 2: create a domain with mem>sys_mem
 
 mem = int(getInfo("total_memory"))
-extreme_mem = str(mem + 100)
+extreme_mem = mem + 100
 
-opts2=  {
-            "name"    : "default",
-            "memory"  : extreme_mem,
-            "kernel"  : getDefaultKernel(),
-            "root"    : "/dev/ram0",
-            "ramdisk" : rdpath + "/initrd.img",
-            }
-
-domain2=XenDomain(opts2)
+config2 = {"memory": extreme_mem}
+domain2=XmTestDomain(extraConfig=config2)
 
 try:
     domain2.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/07_create_mem64_pos.py
--- a/tools/xm-test/tests/create/07_create_mem64_pos.py Tue Dec 13 10:57:18 2005
+++ b/tools/xm-test/tests/create/07_create_mem64_pos.py Tue Dec 13 16:26:24 2005
@@ -23,15 +23,8 @@
        SKIP("This test needs 64 MB of free memory (%i MB avail)" % mem)
 
 #create a domain with mem=64
-opts =  {
-            "name"    : "MEM64",
-            "memory"  : 64,
-            "kernel"  : getDefaultKernel(),
-            "root"    : "/dev/ram0",
-            "ramdisk" : rdpath + "/initrd.img",
-            }
-
-domain_mem64=XenDomain(opts)
+config = {"memory": 64}
+domain_mem64=XmTestDomain(extraConfig=config)
 
 #start it
 try:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/08_create_mem128_pos.py
--- a/tools/xm-test/tests/create/08_create_mem128_pos.py        Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/08_create_mem128_pos.py        Tue Dec 13 
16:26:24 2005
@@ -23,15 +23,8 @@
         SKIP("This test needs 128 MB of free memory (%i MB avail)" % mem)
 
 #create a domain with mem=128
-opts =  {
-            "name"    : "MEM128",
-            "memory"  : 128,
-            "kernel"  : getDefaultKernel(),
-            "root"    : "/dev/ram0",
-            "ramdisk" : rdpath + "/initrd.img",
-            }
-
-domain_mem128=XenDomain(opts)
+config={"memory": 128}
+domain_mem128=XmTestDomain(extraConfig=config)
 
 #start it
 try:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/09_create_mem256_pos.py
--- a/tools/xm-test/tests/create/09_create_mem256_pos.py        Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/09_create_mem256_pos.py        Tue Dec 13 
16:26:24 2005
@@ -23,15 +23,8 @@
         SKIP("This test needs 256 MB of free memory (%i MB avail)" % mem)
 
 #create a domain with mem=256
-opts =  {
-            "name"    : "MEM256",
-            "memory"  : 256,
-            "kernel"  : getDefaultKernel(),
-            "root"    : "/dev/ram0",
-            "ramdisk" : rdpath + "/initrd.img",
-            }
-
-domain_mem256=XenDomain(opts)
+config = {"memory": 256}
+domain_mem256=XmTestDomain(extraConfig=config)
 
 #start it
 try:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/11_create_concurrent_pos.py
--- a/tools/xm-test/tests/create/11_create_concurrent_pos.py    Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/11_create_concurrent_pos.py    Tue Dec 13 
16:26:24 2005
@@ -34,7 +34,7 @@
 
 for d in range(0, NUM_DOMS):
     dom = XmTestDomain(name="11_create_%i" % d,
-                       extraOpts={"memory":str(MEM_PER_DOM)})
+                       extraConfig={"memory":MEM_PER_DOM})
 
     try:
         dom.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/12_create_concurrent_stress_pos.py
--- a/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py     Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py     Tue Dec 
13 16:26:24 2005
@@ -14,7 +14,7 @@
 domains = []
 
 for i in range(0,DOMS):
-    dom = XmTestDomain(extraOpts={"memory" : str(MEM)})
+    dom = XmTestDomain(extraConfig={"memory" : MEM})
 
     try:
         dom.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/13_create_multinic_pos.py
--- a/tools/xm-test/tests/create/13_create_multinic_pos.py      Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/13_create_multinic_pos.py      Tue Dec 13 
16:26:24 2005
@@ -6,8 +6,8 @@
 from XmTestLib import *
 
 for i in range(0,10):
-    domain = XmTestDomain()
-    domain.configSetVar('vif', str(['' for _ in range(0, i)]))
+    config = {"vif": ['' for _ in range(0, i)]}
+    domain = XmTestDomain(extraConfig=config)
 
     try:
         domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/14_create_blockroot_pos.py
--- a/tools/xm-test/tests/create/14_create_blockroot_pos.py     Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/14_create_blockroot_pos.py     Tue Dec 13 
16:26:24 2005
@@ -6,10 +6,9 @@
 from XmTestLib import *
 
 import os
+import time
 
-CONF_FILE = "/tmp/14_create_blockroot_pos.conf"
-
-rdpath = os.path.abspath(os.environ.get("RD_PATH"))
+rdpath = getRdPath()
 
 # status, output = traceCommand("losetup -f %s" % rdpath)
 # if status != 0:
@@ -17,22 +16,26 @@
 # 
 # if verbose:
 #     print "Using %s" % output
- 
-opts = {"memory" : "64",
-        "root"   : "/dev/hda1",
-        "name"   : "14_create_blockroot",
-        "kernel" : getDefaultKernel() }
 
-domain = XenDomain(opts=opts)
-
-domain.configAddDisk("file:%s/initrd.img" % rdpath, "hda1", "w")
+if ENABLE_VMX_SUPPORT:
+    domain = XmTestDomain(name="14_create_blockroot")
+else:
+    config = {"memory" : "64",
+              "root"   : "/dev/hda1",
+              "name"   : "14_create_blockroot",
+              "kernel" : getDefaultKernel(),
+              "disk"   : "file:%s/initrd.img,hda1,w" % rdpath
+              }
+    domConfig = XenConfig()
+    domConfig.setOpts(config)
+    domain = XenDomain(name=domConfig.getOpt("name"), config=domConfig)
 
 try:
     domain.start()
 except DomainError, e:
       FAIL(str(e))
 
-waitForBoot()
+#waitForBoot()
 
 try:
     console = XmConsole(domain.getName(), historySaveCmds=True)
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/create/15_create_smallmem_pos.py
--- a/tools/xm-test/tests/create/15_create_smallmem_pos.py      Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/create/15_create_smallmem_pos.py      Tue Dec 13 
16:26:24 2005
@@ -7,8 +7,8 @@
 
 MEM = 16
 
-domain = XmTestDomain(extraOpts={"memory":"%i" % MEM,
-                                 "extra" :"mem=%iM" % MEM})
+domain = XmTestDomain(extraConfig={"memory": MEM,
+                                   "extra" :"mem=%iM" % MEM})
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/memset/03_memset_random_pos.py
--- a/tools/xm-test/tests/memset/03_memset_random_pos.py        Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/memset/03_memset_random_pos.py        Tue Dec 13 
16:26:24 2005
@@ -20,8 +20,8 @@
     FAIL(str(e))
 
 times = random.randint(10,50)
-origmem = domain.getMem()
-currmem = domain.getMem()
+origmem = domain.config.getOpt("memory")
+currmem = domain.config.getOpt("memory")
 
 try:
     console = XmConsole(domain.getName())
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/network/02_network_local_ping_pos.py
--- a/tools/xm-test/tests/network/02_network_local_ping_pos.py  Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/network/02_network_local_ping_pos.py  Tue Dec 13 
16:26:24 2005
@@ -28,9 +28,9 @@
 mask = Net.mask("dom1", "eth0")
 
 # Fire up a guest domain w/1 nic
-domain = XmTestDomain()
+config = {"vif" : ['ip=%s' % ip]}
+domain = XmTestDomain(extraConfig=config)
 try:
-    domain.configSetVar('vif', " [ 'ip=" + ip + "' ]")
     domain.start()
 except DomainError, e:
     if verbose:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/network/05_network_dom0_ping_pos.py
--- a/tools/xm-test/tests/network/05_network_dom0_ping_pos.py   Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/network/05_network_dom0_ping_pos.py   Tue Dec 13 
16:26:24 2005
@@ -31,9 +31,9 @@
         FAIL(str(e))
 
 # Fire up a guest domain w/1 nic
-domain = XmTestDomain()
+config = {"vif"  : ["ip=%s" % ip]}
+domain = XmTestDomain(extraConfig=config)
 try:
-    domain.configSetVar('vif', " [ 'ip=" + ip + "' ]")
     domain.start()
 except DomainError, e:
     if verbose:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/network/11_network_domU_ping_pos.py
--- a/tools/xm-test/tests/network/11_network_domU_ping_pos.py   Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py   Tue Dec 13 
16:26:24 2005
@@ -15,15 +15,12 @@
 pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
               32767, 65507 ]
 
-
-
 from XmTestLib import *
 
-
 def netDomain(ip):
-    dom = XmTestDomain()
+    config = {"vif"  : ["ip=%s" % ip]}
+    domain = XmTestDomain(extraConfig=config)
     try:
-        dom.configSetVar('vif', " [ 'ip=" + ip + "' ]")
         dom.start()
     except DomainError, e:
         if verbose:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/restore/04_restore_withdevices_pos.py
--- a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py Tue Dec 13 
10:57:18 2005
+++ b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py Tue Dec 13 
16:26:24 2005
@@ -7,12 +7,9 @@
 
 import re
 
-domain = XmTestDomain()
-
-domain.configSetVar('vif', "[ '', '' ]")
-
-domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
-domain.configAddDisk("phy:/dev/ram1", "hdb2", "w")
+config = {"disk": ["phy:/dev/ram0,hda1,w", "phy:/dev/ram1,hdb2,w"],
+          "vif":  ['', '']}
+domain = XmTestDomain(extraConfig=config)
 
 s, o = traceCommand("mke2fs -q /dev/ram0")
 if s != 0:
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/sedf/01_sedf_multi_pos.py
--- a/tools/xm-test/tests/sedf/01_sedf_multi_pos.py     Tue Dec 13 10:57:18 2005
+++ b/tools/xm-test/tests/sedf/01_sedf_multi_pos.py     Tue Dec 13 16:26:24 2005
@@ -7,7 +7,7 @@
 
 sedf_opts = "20000000 5000000 0 0 0"
 
-domain = XmTestDomain(extraOpts = {"sched":"sedf"})
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
     domain.start()
diff -r ef2fff896422 -r 1dc393b65019 
tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py
--- a/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py     Tue Dec 
13 10:57:18 2005
+++ b/tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py     Tue Dec 
13 16:26:24 2005
@@ -39,7 +39,7 @@
     SKIP("Host not capable of running test")
 
 # Start a XmTestDomain with 2 VCPUs
-domain = XmTestDomain(extraOpts = {"vcpus":"2"})
+domain = XmTestDomain(extraConfig={"vcpus":2})
 
 try:
     domain.start()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.