def _get_capabilities_for_device(self, device):
        """ Return capabilities fir given device. """
        if not self.pool_provider:
            self.pool_provider = self.provider_manager.get_provider_for_device(
                    device)

        redundancy = self.pool_provider.get_redundancy(device)
        caps = {}
        _id = storage.get_persistent_name(device)
        caps['InstanceID'] = self.create_capabilities_id(_id)
        caps['ElementName'] = device.path
        caps['DataRedundancyDefault'] = \
                pywbem.Uint16(redundancy.data_redundancy)
        caps['DataRedundancyMax'] = pywbem.Uint16(redundancy.data_redundancy)
        caps['DataRedundancyMin'] = pywbem.Uint16(redundancy.data_redundancy)
        caps['NoSinglePointOfFailure'] = redundancy.no_single_point_of_failure
        caps['NoSinglePointOfFailureDefault'] = \
                redundancy.no_single_point_of_failure
        caps['ExtentStripeLengthDefault'] = \
                pywbem.Uint16(redundancy.stripe_length)
        caps['PackageRedundancyDefault'] = \
                pywbem.Uint16(redundancy.package_redundancy)
        caps['PackageRedundancyMax'] = pywbem.Uint16(
                redundancy.package_redundancy)
        caps['PackageRedundancyMin'] = pywbem.Uint16(
                redundancy.package_redundancy)
        if redundancy.parity_layout:
            caps['ParityLayoutDefault'] = pywbem.Uint16(
                    redundancy.parity_layout + 1)
        else:
            caps['ParityLayoutDefault'] = None
        return caps
Пример #2
0
    def get_format_id(self, device, fmt):
        """
            Return LMI_DataFormat.Name. The name should be unique and stable
            across reboots or reconfigurations. UUID is used, subclasses
            do not need to override this method.
        """
        uuid = self.get_uuid(device, fmt)
        if uuid:
            return "UUID=" + uuid

        return "DEVICE=" + storage.get_persistent_name(device)
 def _get_setting_for_device(self, device, setting_provider):
     """ Return setting for given device """
     _id = storage.get_persistent_name(device)
     setting = self.setting_manager.create_setting(
             self.setting_classname,
             StorageSetting.TYPE_CONFIGURATION,
             setting_provider.create_setting_id(_id),
             class_to_create=StorageSetting)
     setting.set_setting(self.get_redundancy(device))
     setting['ElementName'] = device.path
     return setting
Пример #4
0
 def get_name_for_device(self, device):
     """
         Returns CIM InstanceName for given Anaconda StorageDevice.
         None if no device is found.
     """
     name = pywbem.CIMInstanceName(self.classname,
             namespace=self.config.namespace,
             keybindings={
                 'SystemName' : self.config.system_name,
                 'SystemCreationClassName' : self.config.system_class_name,
                 'CreationClassName' : self.classname,
                 'DeviceID': storage.get_persistent_name(device)
             })
     return name
 def get_configuration(self, device):
     """
         Return Setting with configuration of given device.
     """
     _id = self.create_setting_id(storage.get_persistent_name(device))
     setting = self.setting_manager.create_setting(
             self.setting_classname,
             Setting.TYPE_CONFIGURATION,
             _id)
     setting['Bootable'] = str(device.bootable)
     flag = device.getFlag(parted.PARTITION_HIDDEN)
     if flag:
         setting['Hidden'] = "True"
     if device.isExtended:
         setting['PartitionType'] = str(self.Values.PartitionType.Extended)
     elif device.isLogical:
         setting['PartitionType'] = str(self.Values.PartitionType.Logical)
     elif device.isPrimary:
         setting['PartitionType'] = str(self.Values.PartitionType.Primary)
     else:
         setting['PartitionType'] = str(self.Values.PartitionType.Unknown)
     setting['ElementName'] = setting.the_id
     return setting