~ben-blankley/testdrive/fix-940755

« back to all changes in this revision

Viewing changes to testdrive/virt/virtualbox.py

  • Committer: Dustin Kirkland
  • Date: 2013-08-27 16:23:53 UTC
  • mfrom: (424.2.8 hackfest)
  • Revision ID: kirkland@ubuntu.com-20130827162353-ydajs6ttbravumou
* Add 16gb disk size option
* Fix smaller disk sizes
* Remove all references to virtualbox 3 and virtualbox-ose
* Updated translations
* Change copyright format to debian machine readable
* Add support for 2GB RAM sizes
* Bump debhelper version up to 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    # Code to validate if virtualization is installed/supported
46
46
    def validate_virt(self):
47
47
        # Determine which version of VirtualBox we have installed.  What is returned is
48
 
        # typically a string such as '3.1.0r55467', lets assume that the command line
49
 
        # is consistent within 3.1.x, 3.2.x and 4.0.x versions extract this part of the
 
48
        # typically a string such as '4.1.0r55467', lets assume that the command line
 
49
        # is consistent within 4.x.x versions extract this part of the
50
50
        # version string for comparison later
51
51
        self.vboxversion = commands.getoutput("VBoxManage --version")
52
52
        self.vboxversion = ( int(self.vboxversion.split(".")[0]), int(self.vboxversion.split(".")[1]) )
53
 
        if self.vboxversion == (3,1) or self.vboxversion == (3,2) or self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
 
53
        if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
54
54
            logger.info("VirtualBox %s.%s detected." % self.vboxversion)
55
55
        else:
56
 
            logger.error("ERROR: Unsupported version (%s.%s) of VirtualBox; please install v3.1, v3.2, v4.0 or v4.1." % self.vboxversion)
 
56
            logger.error("ERROR: Unsupported version (%s.%s) of VirtualBox; please install v4.0, v4.1 or v4.2." % self.vboxversion)
57
57
            exit(0)
58
58
 
59
59
    # Code to setup virtual machine
65
65
            self.DISK_SIZE = self.DISK_SIZE.replace("G", "000")
66
66
            logger.info("Creating disk image...")
67
67
            self.run_or_die("VBoxManage createhd --filename %s --size %s" % (self.DISK_FILE, self.DISK_SIZE))
68
 
        if self.vboxversion == (3,1) or self.vboxversion == (3,2) or self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
 
68
        if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
69
69
            self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium none" % self.VBOX_NAME)
70
70
            if self.PATH_TO_ISO != "/dev/null":
71
71
                self.run("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 1 --type dvddrive --medium none" % self.VBOX_NAME)
90
90
    # Code launch virtual machine
91
91
    def launch_virt(self):
92
92
        logger.info("Running the Virtual Machine...")
93
 
        if self.vboxversion == (3,1) or self.vboxversion == (3,2) or self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
 
93
        if self.vboxversion == (4,0) or self.vboxversion == (4,1) or self.vboxversion == (4,2):
94
94
            self.run_or_die("VBoxManage storagectl %s --name \"IDE Controller\" --add ide" % self.VBOX_NAME)
95
95
            self.run_or_die("VBoxManage storageattach %s --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium %s" % (self.VBOX_NAME, self.DISK_FILE))
96
96
            if self.PATH_TO_ISO != "/dev/null":