コード例 #1
0
 def _get_device(self, object_name):
     """
         Get Anaconda StorageDevice for given name, without any checks.
     """
     path = object_name['DeviceID']
     device = storage.get_device_for_persistent_name(self.storage, path)
     return device
    def get_configuration_for_id(self, instance_id):
        """
            Return Setting instance for given instance_id.
            Return None if no such Setting is found.
        """
        path = self.parse_setting_id(instance_id)
        if not path:
            return None

        device = storage.get_device_for_persistent_name(self.storage, path)
        if not device:
            return None
        return self.get_configuration(device)
    def get_associated_element_name(self, instance_id):
        """
            Return CIMInstanceName for ElementSettingData association.
            Return None if no such element exist.
        """
        path = self.parse_setting_id(instance_id)
        if not path:
            return None

        device = storage.get_device_for_persistent_name(self.storage, path)
        if not device:
            return None

        return self.provider_manager.get_name_for_device(device)
コード例 #4
0
 def get_associated_element_name(self, setting_provider, instance_id):
     """
         Return CIMInstanceName of ManagedElement for ElementSettingData
         association for setting with given ID.
         Return None if no such ManagedElement exists.
     """
     path = setting_provider.parse_setting_id(instance_id)
     if not path:
         return None
     device = storage.get_device_for_persistent_name(self.storage, path)
     if not device:
         return None
     fmt = device.format
     provider = self.provider_manager.get_provider_for_format(device, fmt)
     return provider.get_name_for_format(device, fmt)
コード例 #5
0
 def get_setting_for_id(self, setting_provider, instance_id):
     """
         Return Setting instance, which corresponds to LMI_*Setting with
         given InstanceID.
         Return None if there is no such instance.
     """
     path = setting_provider.parse_setting_id(instance_id)
     if not path:
         return None
     device = storage.get_device_for_persistent_name(self.storage, path)
     if not device:
         return None
     if not device.format:
         return None
     return self._get_setting_for_format(setting_provider, device.format)
コード例 #6
0
 def get_associated_element_name(self, setting_provider, instance_id):
     """
         Return CIMInstanceName of ManagedElement for ElementSettingData
         association for setting with given ID.
         Return None if no such ManagedElement exists.
     """
     path = setting_provider.parse_setting_id(instance_id)
     if not path:
         return None
     device = storage.get_device_for_persistent_name(self.storage, path)
     if not device:
         return None
     if not isinstance(device, blivet.devices.MDRaidArrayDevice):
         cmpi_logging.logger.trace_warn(
                 "InstanceID %s is not LVMLogicalVolumeDevice" % instance_id)
         return None
     return self.get_name_for_device(device)
コード例 #7
0
    def get_setting_for_id(self, setting_provider, instance_id):
        """
            Return Setting instance, which corresponds to LMI_*Setting with
            given InstanceID.
            Return None if there is no such instance.

            Subclasses must override this method.
        """
        path = setting_provider.parse_setting_id(instance_id)
        if not path:
            return None
        device = storage.get_device_for_persistent_name(self.storage, path)
        if not path:
            return None
        if not isinstance(device, blivet.devices.MDRaidArrayDevice):
            cmpi_logging.logger.trace_warn(
                    "InstanceID %s is not LVMLogicalVolumeDevice" % instance_id)
            return None
        return self._get_setting_for_device(device, setting_provider)
コード例 #8
0
    def get_pool_name_for_capabilities(self, instance_id):
        """
            Return CIMInstanceName of storage pool associated with capabilities
            with given id.
        """
        path = self.parse_instance_id(instance_id)
        if not path:
            return None
        device = storage.get_device_for_persistent_name(self.storage, path)
        if not device:
            return None
        if not isinstance(device,
                blivet.devices.LVMVolumeGroupDevice):
            cmpi_logging.logger.trace_warn(
                    "InstanceID %s is not LVMVolumeGroupDevice" % instance_id)
            return None

        if not self.pool_provider:
            self.pool_provider = self.provider_manager.get_provider_for_device(
                    device)
        return self.pool_provider.get_name_for_device(device)
コード例 #9
0
    def get_capabilities_for_id(self, instance_id):
        """
            Return dictionary property_name -> value.
            If the capabilities are the default ones, it must have
            '_default' as a property name.
            Return None if there is no such Capabilities instance.

            Subclasses can override this method.
        """
        path = self.parse_instance_id(instance_id)
        if not path:
            return None
        device = storage.get_device_for_persistent_name(self.storage, path)
        if not device:
            return None
        if not isinstance(device,
                blivet.devices.LVMVolumeGroupDevice):
            cmpi_logging.logger.trace_warn(
                    "InstanceID %s is not LVMVolumeGroupDevice" % instance_id)
            return None

        return self._get_capabilities_for_device(device)
コード例 #10
0
    def get_format_for_id(self, name):
        """
            Return tuple (StorageDevice, DeviceFormat) for given Name property
            of CIMInstance. Return (None, None) if no such format exist.
            This is reverse function to get_format_id().
            Subclasses do not need to override this method if they do not
            override get_format_id().
            The returned device represents one randomly chosen device if the
            format spans over multiple devices, use get_devices() to get all
            of them.
        """

        if name.startswith("DEVICE="):
            (_unused, devname) = name.split("=")
            device = storage.get_device_for_persistent_name(self.storage, devname)
        elif name.startswith("UUID="):
            (_unused, uuid) = name.split("=")
            device = self.storage.devicetree.getDeviceByUuid(uuid)
        else:
            return (None, None)
        if not device:
            return (None, None)
        return (device, device.format)