~ubuntu-branches/ubuntu/precise/virtinst/precise-updates

« back to all changes in this revision

Viewing changes to virtinst/ImportInstaller.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-01 15:40:11 UTC
  • mfrom: (1.3.16 experimental)
  • Revision ID: james.westby@ubuntu.com-20110201154011-op0nusgc240xajvb
Tags: 0.500.5-1ubuntu1
* Merge from debian experimental. Remaining changes:
  - debian/patches/9001_Ubuntu.patch:
     + Updated to add maverick and natty to OS list and enable virtio
       for them.
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch. (refreshed)
  - debian/control: added acl package to depends.
  - Demote virt-viewer to Suggests, as it's in universe.
  - Recommends libvirt-bin
* Removed patches:
  - debian/patches/9002-libvirt_disk_format.patch: Upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    stage.
27
27
 
28
28
    ImportInstaller sets the Guest's boot device to that of the first disk
29
 
    attached to the Guest (so, one of 'hd', 'cdrom', or 'floppy'). All the
 
29
    attached to the Guest (so, one of 'hd', 'cdrom', or 'fd'). All the
30
30
    user has to do is fill in the Guest object with the desired parameters.
31
31
    """
32
32
 
33
33
    # General Installer methods
34
 
 
35
 
    def prepare(self, guest, meter, distro = None):
36
 
        if len(guest.disks) == 0:
37
 
            raise ValueError(_("A disk device must be specified."))
38
 
 
39
 
    def get_install_xml(self, guest, isinstall):
40
 
        if isinstall:
41
 
            # Signifies to the 'Guest' that there is no 'install' phase
42
 
            return None
43
 
        else:
44
 
            bootdev = self._disk_to_bootdev(guest.disks[0])
45
 
 
46
 
        return self._get_osblob_helper(isinstall=isinstall, guest=guest,
47
 
                                       kernel=None, bootdev=bootdev)
 
34
    def prepare(self, guest, meter):
 
35
        pass
48
36
 
49
37
    def post_install_check(self, guest):
50
38
        return True
51
39
 
 
40
    def has_install_phase(self):
 
41
        return False
52
42
 
53
43
    # Private methods
 
44
    def _get_bootdev(self, isinstall, guest):
 
45
        if not guest.disks:
 
46
            return self.bootconfig.BOOT_DEVICE_HARDDISK
 
47
        return self._disk_to_bootdev(guest.disks[0])
54
48
 
55
49
    def _disk_to_bootdev(self, disk):
56
50
        if disk.device == VirtualDisk.DEVICE_DISK:
57
 
            return "hd"
 
51
            return self.bootconfig.BOOT_DEVICE_HARDDISK
58
52
        elif disk.device == VirtualDisk.DEVICE_CDROM:
59
 
            return "cdrom"
 
53
            return self.bootconfig.BOOT_DEVICE_CDROM
60
54
        elif disk.device == VirtualDisk.DEVICE_FLOPPY:
61
 
            return "floppy"
 
55
            return self.bootconfig.BOOT_DEVICE_FLOPPY
62
56
        else:
63
 
            return "hd"
 
57
            return self.bootconfig.BOOT_DEVICE_HARDDISK