19
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
20
# MA 02110-1301 USA.
23
23
from VirtualDisk import VirtualDisk
24
import CapabilitiesParser
25
24
from virtinst import _virtinst as _
27
26
class LiveCDInstallerException(Exception):
28
27
def __init__(self, msg):
29
28
Exception.__init__(self, msg)
31
class LiveCDInstaller(Guest.Installer):
30
class LiveCDInstaller(Installer.Installer):
32
31
def __init__(self, type = "xen", location = None, os_type = None,
34
Guest.Installer.__init__(self, type=type, location=location,
35
os_type=os_type, conn=conn)
37
def prepare(self, guest, meter, distro = None):
40
capabilities = CapabilitiesParser.parse(guest.conn.getCapabilities())
43
for guest_caps in capabilities.guests:
44
if guest_caps.os_type == "hvm":
49
raise LiveCDInstallerException(_("Connection does not support HVM virtualisation, cannot boot live CD"))
33
Installer.Installer.__init__(self, type=type, location=location,
34
os_type=os_type, conn=conn)
37
# LiveCD specific methods/overwrites
39
def _get_location(self):
41
def _set_location(self, val):
53
if type(self.location) is tuple:
54
vol_tuple = self.location
58
raise LiveCDInstallerException(_("CDROM media must be specified "
59
"for the live CD installer."))
44
if type(val) is tuple:
61
49
if path or vol_tuple:
62
disk = VirtualDisk(path=path, conn=guest.conn, volName=vol_tuple,
63
device = VirtualDisk.DEVICE_CDROM,
65
guest._install_disks.insert(0, disk)
67
def _get_osblob(self, install, hvm, arch=None, loader=None, conn=None):
69
# XXX: This seems wrong? If install is True, maybe we should
70
# error and say that isn't a valid value for LiveCD?
50
self._install_disk = VirtualDisk(path=path, conn=self.conn,
52
device = VirtualDisk.DEVICE_CDROM,
57
location = property(_get_location, _set_location)
60
# General Installer methods
62
def prepare(self, guest, meter, distro = None):
65
if not self._install_disk:
66
raise ValueError(_("CDROM media must be specified for the live "
69
def get_install_xml(self, guest, isinstall):
71
# Signifies to the 'Guest' that there is no 'install' phase
73
return self._get_osblob_helper(isinstall=install, ishvm=hvm,
74
arch=arch, loader=loader, conn=conn,
74
return self._get_osblob_helper(isinstall=isinstall, guest=guest,
75
75
kernel=None, bootdev="cdrom")
77
77
def post_install_check(self, guest):