3
# Paravirtualized guest support
5
# Copyright 2006-2007 Red Hat, Inc.
6
# Jeremy Katz <katzj@redhat.com>
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27
from virtinst import _virtinst as _
29
class ParaVirtGuest(Guest.XenGuest):
30
def __init__(self, type=None, connection=None, hypervisorURI=None, installer=None):
32
installer = DistroManager.DistroInstaller(type = type)
33
Guest.Guest.__init__(self, type, connection, hypervisorURI, installer)
36
def _get_osblob(self, install):
37
return self.installer._get_osblob(install, hvm = False)
39
def _connectSerialConsole(self):
40
cmd = ["/usr/bin/virsh", "console", "%s" %(self.domain.ID(),)]
43
os.execvp(cmd[0], cmd)
47
def get_input_device(self):
48
return ("mouse", "xen")
50
def validate_parms(self):
51
if not self.location and not self.boot:
52
raise ValueError, _("A location must be specified to install from")
53
Guest.Guest.validate_parms(self)
55
def _prepare_install(self, meter):
56
Guest.Guest._prepare_install(self, meter)
57
self._installer.prepare(guest = self, meter = meter)
58
if self._installer.install_disk is not None:
59
self._install_disks.append(self._installer.install_disk)
62
def _get_disk_xml(self, install = True):
63
"""Get the disk config in the libvirt XML format"""
67
n = "%s%c" % (self.disknode, ord('a') + i)
69
for d in self._install_disks:
70
if d.transient and not install:
74
for t in sorted(nodes.keys()):
78
if target is None or nodes[target] is not None:
79
raise ValueError, _("Can't use more than 16 disks on a PV guest")
81
ret += d.get_xml_config(target)