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())
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:
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()