Ejemplo n.º 1
0
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"
Ejemplo n.º 2
0
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"
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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()
Ejemplo n.º 5
0
    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 = []
Ejemplo n.º 6
0
 def _get_caps(self):
     if not self.__caps and self.conn:
         self.__caps = CapabilitiesParser.parse(self.conn.getCapabilities())
     return self.__caps
Ejemplo n.º 7
0
 def _get_caps(self):
     if not self.__caps and self.conn:
         self.__caps = CapabilitiesParser.parse(self.conn.getCapabilities())
     return self.__caps
Ejemplo n.º 8
0
    def _buildCaps(self, filename):
        path = os.path.join("tests/capabilities-xml", filename)
        xml = file(path).read()

        return capabilities.parse(xml)
Ejemplo n.º 9
0
    def _buildCaps(self, filename):
        path = os.path.join("tests/capabilities-xml", filename)
        xml = file(path).read()

        return capabilities.parse(xml)