Example #1
0
def get_device_format_label(ns, device):
    """
    Return short text description of the format, ready for printing.

    :type device: LMIInstance/CIM_StorageExtent or string
    :param device: Device to describe.

    :rtype: string
    """
    LOG().debug("get_device_format_label: Loading filesystem information for %s"
            % (device.DeviceID))
    fmt = get_format_on_device(ns, device)
    if fmt:
        return get_format_label(ns, fmt)
    else:
        # check if there is partition table on the device
        table = partition.get_disk_partition_table(ns, device)
        if table:
            cls = ns.LMI_DiskPartitionConfigurationCapabilities
            if table.PartitionStyle == cls.PartitionStyleValues.MBR:
                return "MS-DOS partition table"
            else:
                return cls.PartitionStyleValues.value_name(
                        table.PartitionStyle) + " partition table"
    return "Unknown"
Example #2
0
def device_show_data(ns, device, human_friendly):
    """
    Display description of data on the device.

    :type device: LMIInstance/CIM_StorageExtent or string
    :param device: Device to show.
    """
    device = common.str2device(ns, device)
    fmt = fs.get_format_on_device(ns, device)
    if fmt:
        if "FormatType" in fmt.properties():
            for line in format_show(ns, fmt, human_friendly):
                yield line
        elif "FileSystemType" in fmt.properties():
            for line in fs_show(ns, fmt, human_friendly):
                yield line
        else:
            yield ("Data Format", "Unknown")
    else:
        part_table = partition.get_disk_partition_table(ns, device)
        if part_table:
            for line in partition_table_show(ns, device, human_friendly):
                yield line
        else:
            yield ("Data Format", "Unknown")
Example #3
0
def get_device_format_label(ns, device):
    """
    Return short text description of the format, ready for printing.

    :type device: LMIInstance/CIM_StorageExtent or string
    :param device: Device to describe.

    :rtype: string
    """
    LOG().debug("get_device_format_label: Loading filesystem information for %s"
            % (device.DeviceID))
    fmt = get_format_on_device(ns, device)
    if fmt:
        return get_format_label(ns, fmt)
    else:
        # check if there is partition table on the device
        table = partition.get_disk_partition_table(ns, device)
        if table:
            cls = ns.LMI_DiskPartitionConfigurationCapabilities
            if table.PartitionStyle == cls.PartitionStyleValues.MBR:
                return "MS-DOS partition table"
            else:
                return cls.PartitionStyleValues.value_name(
                        table.PartitionStyle) + " partition table"
    return "Unknown"
Example #4
0
def device_show_data(ns, device, human_friendly):
    """
    Display description of data on the device.

    :type device: LMIInstance/CIM_StorageExtent or string
    :param device: Device to show.
    """
    device = common.str2device(ns, device)
    fmt = fs.get_format_on_device(ns, device)
    if fmt:
        if "FormatType" in fmt.properties():
            for line in format_show(ns, fmt, human_friendly):
                yield line
        elif "FileSystemType" in fmt.properties():
            for line in fs_show(ns, fmt, human_friendly):
                yield line
        else:
            yield ("Data Format", "Unknown")
    else:
        part_table = partition.get_disk_partition_table(ns, device)
        if part_table:
            for line in partition_table_show(ns, device, human_friendly):
                yield line
        else:
            yield ("Data Format", "Unknown")