minor edits
authorTony Mack <tmack@cs.princeton.edu>
Fri, 18 Jan 2008 17:15:06 +0000 (17:15 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Fri, 18 Jan 2008 17:15:06 +0000 (17:15 +0000)
qaapi/qa/modules/plc/boot_node.py

index cae230c..987870a 100644 (file)
@@ -3,19 +3,25 @@ import base64
 from qa.Test import Test
 from qa import utils
 
+image_types = ['node-iso', 'node-usb', 'generic-iso', 'generic-usb']
+
 class boot_node(Test):
+    """
+    Attempts to boot the specified node using qemu. 
+    """
 
-    def call(self, hostname, disk_size = "500M"):
+    def call(self, hostname, image_type = 'node-iso', disk_size="4G"):
        api = self.config.api
        auth = self.config.auth
+       tdir = "/tmp/"
        
        # validate hostname
        nodes = api.GetNodes(auth, [hostname], ['hostname'])
        if not nodes:
            raise Exception, "No such node %s" 
 
-       bootimage = api.GetBootMedium(auth, hostname, 'node-iso', '')
-       bootimage_path = '/tmp/%(hostname)s-bootcd.iso' % locals()
+       bootimage = api.GetBootMedium(auth, hostname, image_type, '')
+       bootimage_path = '/$(tdir)s/%(hostname)s-bootcd.iso' % locals()
 
        if self.config.verbose:
             utils.header("Creating bootcd for %(hostname)s at %(bootimage_path)s" % locals())  
@@ -25,8 +31,8 @@ class boot_node(Test):
        file.close()
        
        # Create a temporary disk image
-       diskimage_path = "/tmp/%(hostname)s-hda.img" % locals() 
-       qemu_img_cmd = "qemu-img create %(diskimage_path)s %(disk_size)s" % locals()
+       diskimage_path = "/%(tdir)s/%(hostname)s-hda.img" % locals() 
+       qemu_img_cmd = "qemu-img create -f qcow2 %(diskimage_path)s %(disk_size)s" % locals()
        (stdin, stdout, stderr) = os.popen3(qemu_img_cmd)
        self.errors = stderr.readlines()
        if self.errors: 
@@ -36,7 +42,7 @@ class boot_node(Test):
        if self.config.verbose:
             utils.header("Booting %(hostname)s" % locals())
        # Attempt to boot this node image
-       bootcmd = "qemu -kernel-kqemu -hda %(diskimage_path)s -cdrom %(bootimage_path)s" % \
+       bootcmd = "qemu -hda %(diskimage_path)s -cdrom %(bootimage_path)s -smp 1 -m 256 -monitor stdio" % \
                  locals()
        (stdin, stdout, stderr) = os.popen3(bootcmd)
        self.errors = stderr.readlines()