Exemplo n.º 1
0
    def post_install_check(self, guest):
        """
        Attempt to verify that installing to disk was successful.
        @param guest: guest instance that was installed
        @type L{Guest}
        """

        if _util.is_uri_remote(guest.conn.getURI()):
            # XXX: Use block peek for this?
            return True

        if len(guest.disks) == 0 \
           or guest.disks[0].device != VirtualDisk.DEVICE_DISK:
            return True

        if _util.is_vdisk(guest.disks[0].path):
            return True

        # Check for the 0xaa55 signature at the end of the MBR
        try:
            fd = os.open(guest.disks[0].path, os.O_RDONLY)
        except OSError, (err, msg):
            logging.debug("Failed to open guest disk: %s" % msg)
            if err == errno.EACCES and os.geteuid() != 0:
                return True  # non root might not have access to block devices
            else:
                raise
Exemplo n.º 2
0
    def post_install_check(self, guest):
        """
        Attempt to verify that installing to disk was successful.
        @param guest: guest instance that was installed
        @type L{Guest}
        """

        if _util.is_uri_remote(guest.conn.getURI(), conn=guest.conn):
            # XXX: Use block peek for this?
            return True

        if (len(guest.disks) == 0 or
            guest.disks[0].device != VirtualDisk.DEVICE_DISK):
            return True

        disk = guest.disks[0]

        if _util.is_vdisk(disk.path):
            return True

        if (disk.driver_type and
            disk.driver_type not in [disk.DRIVER_TAP_RAW,
                                     disk.DRIVER_QEMU_RAW]):
            # Might be a non-raw format
            return True

        # Check for the 0xaa55 signature at the end of the MBR
        try:
            fd = os.open(disk.path, os.O_RDONLY)
        except OSError, (err, msg):
            logging.debug("Failed to open guest disk: %s", msg)
            if err == errno.EACCES and os.geteuid() != 0:
                return True # non root might not have access to block devices
            else:
                raise