Exemple #1
0
def normalize_disk(disk):
    if disk.startswith('iscsi:'):
        # An rfc4173 spec identifying a LUN in the iBFT.  We
        # should be logged into this already.  Convert this spec into a
        # disk location.
        return diskutil.rfc4173_to_disk(disk)

    if not disk.startswith('/dev/'):
        disk = '/dev/' + disk
    return diskutil.partitionFromId(disk)
Exemple #2
0
 def __init__(self, part, mnt):
     self.partition = part
     self.inventory = util.readKeyValueFile(os.path.join(mnt, constants.INVENTORY_FILE), strip_quotes=True)
     self.name = self.inventory["PRODUCT_NAME"]
     self.brand = self.inventory["PRODUCT_BRAND"]
     self.version = Version.from_string(
         "%s-%s" % (self.inventory["PRODUCT_VERSION"], self.inventory["BUILD_NUMBER"])
     )
     self.build = self.inventory["BUILD_NUMBER"]
     self.root_disk = diskutil.partitionFromId(self.inventory["PRIMARY_DISK"])
    def __init__(self, part, mnt):
        self.partition = part
        self.inventory = util.readKeyValueFile(os.path.join(
            mnt, constants.INVENTORY_FILE),
                                               strip_quotes=True)
        self.build = self.inventory['BUILD_NUMBER']
        self.version = Version.from_string(
            "%s-%s" % (self.inventory['PLATFORM_VERSION'], self.build))
        if 'PRODUCT_NAME' in self.inventory:
            self.name = self.inventory['PRODUCT_NAME']
            self.brand = self.inventory['PRODUCT_BRAND']
        else:
            self.name = self.inventory['PLATFORM_NAME']
            self.brand = self.inventory['PLATFORM_NAME']

        if 'OEM_BRAND' in self.inventory:
            self.oem_brand = self.inventory['OEM_BRAND']
            self.visual_brand = self.oem_brand
        else:
            self.visual_brand = self.brand
        if 'OEM_VERSION' in self.inventory:
            self.oem_version = self.inventory['OEM_VERSION']
            self.visual_version = "%s-%s" % (self.inventory['OEM_VERSION'],
                                             self.build)
        else:
            if '/' in self.build:
                self.visual_version = self.inventory['PRODUCT_VERSION']
            else:
                self.visual_version = "%s-%s" % (
                    self.inventory['PRODUCT_VERSION'], self.build)

        if self.inventory['PRIMARY_DISK'].startswith('/dev/md_'):
            # Handle restoring an installation using a /dev/md_* path
            self.root_disk = os.path.realpath(
                self.inventory['PRIMARY_DISK'].replace('md_', 'md/') + '_0')
        else:
            self.root_disk = diskutil.partitionFromId(
                self.inventory['PRIMARY_DISK'])
            self.root_disk = getMpathMasterOrDisk(self.root_disk)
Exemple #4
0
def normalize_disk(disk):
    if not disk.startswith('/dev/'):
        disk = '/dev/' + disk
    return diskutil.partitionFromId(disk)