def _pygrub_path(conn=None): # FIXME: This should be removed/deprecated when capabilities are # fixed to provide bootloader info if conn: cap = CapabilitiesParser.parse(conn.getCapabilities()) if (cap.host.arch == "i86pc"): return "/usr/lib/xen/bin/pygrub" else: return "/usr/bin/pygrub" if platform.system() == "SunOS": return "/usr/lib/xen/bin/pygrub" return "/usr/bin/pygrub"
def _pygrub_path(conn=None): # FIXME: This should be removed/deprecated when capabilities are # fixed to provide bootloader info if conn: cap = CapabilitiesParser.parse(conn.getCapabilities()) if (cap.host.arch == "i86pc"): return "/usr/lib/xen/bin/pygrub" else: return "/usr/bin/pygrub" if platform.system() == "SunOS": return "/usr/lib/xen/bin/pygrub" return "/usr/bin/pygrub"
def host(conn=None): """ Return the host, as seen in platform.system(), but possibly from a hypervisor connection. Note: use default_arch() in almost all cases, unless you need to detect the OS. In particular, this value gives no indication of 32 vs 64 bitness. """ if conn: cap = CapabilitiesParser.parse(conn.getCapabilities()) if cap.host.arch == "i86pc": return "SunOS" else: # or Linux-alike. Hmm. return "Linux" return platform.system()
def host(conn=None): """ Return the host, as seen in platform.system(), but possibly from a hypervisor connection. Note: use default_arch() in almost all cases, unless you need to detect the OS. In particular, this value gives no indication of 32 vs 64 bitness. """ if conn: cap = CapabilitiesParser.parse(conn.getCapabilities()) if cap.host.arch == "i86pc": return "SunOS" else: # or Linux-alike. Hmm. return "Linux" return platform.system()
def __init__(self, type="xen", location=None, boot=None, extraargs=None, os_type=None, conn=None): self._type = None self._location = None self._initrd_injections = [] self._cdrom = False # XXX: We should set this default based on capabilities? self._os_type = "xen" self._conn = conn self._scratchdir = None self._caps = None self._arch = None self._install_bootconfig = Boot(self.conn) self._bootconfig = Boot(self.conn) # Devices created/added during the prepare() stage self.install_devices = [] if self.conn: self._caps = CapabilitiesParser.parse(self.conn.getCapabilities()) # FIXME: Better solution? Skip validating this since we may not be # able to install a VM of the host arch self._arch = self._caps.host.arch if type is None: type = "xen" self.type = type if not os_type is None: self.os_type = os_type if not location is None: self.location = location if not boot is None: self.boot = boot self.extraargs = extraargs self._tmpfiles = []
def _get_caps(self): if not self.__caps and self.conn: self.__caps = CapabilitiesParser.parse(self.conn.getCapabilities()) return self.__caps
def _get_caps(self): if not self.__caps and self.conn: self.__caps = CapabilitiesParser.parse(self.conn.getCapabilities()) return self.__caps
def _buildCaps(self, filename): path = os.path.join("tests/capabilities-xml", filename) xml = file(path).read() return capabilities.parse(xml)
def _buildCaps(self, filename): path = os.path.join("tests/capabilities-xml", filename) xml = file(path).read() return capabilities.parse(xml)