diff options
author | Jan Safranek <jsafrane@redhat.com> | 2014-02-17 10:35:01 +0100 |
---|---|---|
committer | Jan Safranek <jsafrane@redhat.com> | 2014-02-17 10:35:01 +0100 |
commit | 56469ddbfd99f3a76d7c4f6dbd8fec130cea0b6b (patch) | |
tree | 7142581df5ae32aad28984750937640f7ab74bc9 /commands/storage/lmi | |
parent | 4130fd07bb27b447bdd230bf7323208379f007b6 (diff) | |
download | openlmi-scripts-56469ddbfd99f3a76d7c4f6dbd8fec130cea0b6b.tar.gz openlmi-scripts-56469ddbfd99f3a76d7c4f6dbd8fec130cea0b6b.tar.xz openlmi-scripts-56469ddbfd99f3a76d7c4f6dbd8fec130cea0b6b.zip |
Do not show DeviceID in lists.
DeviceID is internal OpenLMI ID to identify block devices. It's quite long
and most admins will use '/dev/sda' (or just 'sda') anyway, so let's remove
it from all 'list' commands output.
'show' command will show it, if anybody is interested.
Diffstat (limited to 'commands/storage/lmi')
7 files changed, 18 insertions, 50 deletions
diff --git a/commands/storage/lmi/scripts/storage/cmd/fs.py b/commands/storage/lmi/scripts/storage/cmd/fs.py index 038cfc0..55b8d43 100644 --- a/commands/storage/lmi/scripts/storage/cmd/fs.py +++ b/commands/storage/lmi/scripts/storage/cmd/fs.py @@ -73,7 +73,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class FSList(command.LmiLister): - COLUMNS = ('Device', 'Name', "ElementName", "Type") + COLUMNS = ("Name", "ElementName", "Type") def transform_options(self, options): """ @@ -87,11 +87,6 @@ class FSList(command.LmiLister): Implementation of 'fs list' command. """ for fmt in fs.get_formats(ns, devices, fs.FORMAT_ALL, _all): - device = fmt.first_associator(AssocClass="CIM_ResidesOnExtent") - if device: - devname = device.DeviceID - else: - devname = "(none)" name = fmt.Name label = fmt.ElementName if "FileSystemType" in fmt.properties(): @@ -102,7 +97,7 @@ class FSList(command.LmiLister): # it must be LMI_DataFormat fstype = fmt.FormatTypeDescription # TODO: add free space when OpenLMI provides it - yield (devname, name, label, fstype) + yield (name, label, fstype) class FSListSupported(command.LmiLister): diff --git a/commands/storage/lmi/scripts/storage/cmd/lv.py b/commands/storage/lmi/scripts/storage/cmd/lv.py index bee5fcb..c524965 100644 --- a/commands/storage/lmi/scripts/storage/cmd/lv.py +++ b/commands/storage/lmi/scripts/storage/cmd/lv.py @@ -76,7 +76,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class LVList(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Size") + COLUMNS = ("Name", "Size") def transform_options(self, options): """ @@ -92,10 +92,7 @@ class LVList(command.LmiLister): for lv in lvm.get_lvs(ns, vgs): size = size2str(lv.NumberOfBlocks * lv.BlockSize, self.app.config.human_friendly) - yield (lv.DeviceID, - lv.Name, - lv.ElementName, - size) + yield (lv.Name, size) class LVCreate(command.LmiCheckResult): diff --git a/commands/storage/lmi/scripts/storage/cmd/partition.py b/commands/storage/lmi/scripts/storage/cmd/partition.py index ae514ea..62bd110 100644 --- a/commands/storage/lmi/scripts/storage/cmd/partition.py +++ b/commands/storage/lmi/scripts/storage/cmd/partition.py @@ -108,7 +108,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class PartitionList(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Type", "Size") + COLUMNS = ("Name", "Type", "Size") def transform_options(self, options): """ @@ -135,11 +135,7 @@ class PartitionList(command.LmiLister): ptype = "unknown" size = size2str(part.NumberOfBlocks * part.BlockSize, self.app.config.human_friendly) - yield (part.DeviceID, - part.Name, - part.ElementName, - ptype, - size) + yield (part.Name, ptype, size) class PartitionCreate(command.LmiCheckResult): diff --git a/commands/storage/lmi/scripts/storage/cmd/partition_table.py b/commands/storage/lmi/scripts/storage/cmd/partition_table.py index d10736e..06549e1 100644 --- a/commands/storage/lmi/scripts/storage/cmd/partition_table.py +++ b/commands/storage/lmi/scripts/storage/cmd/partition_table.py @@ -81,7 +81,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class PartitionTableList(command.LmiLister): - COLUMNS = ('DeviceID', 'Name', 'ElementName', 'Type', 'Largest free region') + COLUMNS = ('Name', 'Type', 'Largest free region') def transform_options(self, options): """ @@ -107,12 +107,7 @@ class PartitionTableList(command.LmiLister): table_type = cls.PartitionStyleValues.value_name( table.PartitionStyle) - yield (device.DeviceID, - device.Name, - device.ElementName, - table_type, - largest_size - ) + yield (device.Name, table_type, largest_size) class PartitionTableCreate(command.LmiCheckResult): diff --git a/commands/storage/lmi/scripts/storage/cmd/raid.py b/commands/storage/lmi/scripts/storage/cmd/raid.py index c519d9d..a524a07 100644 --- a/commands/storage/lmi/scripts/storage/cmd/raid.py +++ b/commands/storage/lmi/scripts/storage/cmd/raid.py @@ -80,7 +80,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class RaidList(command.LmiLister): - COLUMNS = ('DeviceID', 'Name', "Level", "Nr. of members") + COLUMNS = ('Name', "Level", "Nr. of members") def execute(self, ns): """ @@ -88,7 +88,7 @@ class RaidList(command.LmiLister): """ for r in raid.get_raids(ns): members = raid.get_raid_members(ns, r) - yield (r.DeviceID, r.ElementName, r.Level, len(members)) + yield (r.ElementName, r.Level, len(members)) class RaidCreate(command.LmiCheckResult): diff --git a/commands/storage/lmi/scripts/storage/cmd/vg.py b/commands/storage/lmi/scripts/storage/cmd/vg.py index 5a2a61d..8ac39b2 100644 --- a/commands/storage/lmi/scripts/storage/cmd/vg.py +++ b/commands/storage/lmi/scripts/storage/cmd/vg.py @@ -87,8 +87,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children, LOG = get_logger(__name__) class VGList(command.LmiLister): - COLUMNS = ('InstanceID', 'ElementName', "ExtentSize", "Total space", - "Free space") + COLUMNS = ('ElementName', "ExtentSize", "Total space", "Free space") def execute(self, ns): """ @@ -101,8 +100,7 @@ class VGList(command.LmiLister): self.app.config.human_friendly) remaining_space = size2str(vg.RemainingManagedSpace, self.app.config.human_friendly) - yield (vg.InstanceID, - vg.ElementName, + yield (vg.ElementName, extent_size, total_space, remaining_space) diff --git a/commands/storage/lmi/scripts/storage/storage_cmd.py b/commands/storage/lmi/scripts/storage/storage_cmd.py index b4b750f..77851b7 100644 --- a/commands/storage/lmi/scripts/storage/storage_cmd.py +++ b/commands/storage/lmi/scripts/storage/storage_cmd.py @@ -146,9 +146,7 @@ def get_device_info(ns, device, human_friendly): size = 'N/A' fslabel = fs.get_device_format_label(ns, device) - return (device.DeviceID, - device.Name, - device.ElementName, + return (device.Name, size, fslabel) @@ -157,9 +155,7 @@ def get_pool_info(_ns, pool, human_friendly): Return detailed information of the Volume Group to show. """ size = size2str(pool.TotalManagedSpace, human_friendly) - return (pool.InstanceID, - pool.ElementName, - pool.ElementName, + return (pool.ElementName, size, "volume group (LVM)") @@ -174,7 +170,7 @@ def get_obj_info(ns, obj, human_friendly): class Lister(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Size", "Format") + COLUMNS = ("Name", "Size", "Format") def transform_options(self, options): """ @@ -191,15 +187,6 @@ class Lister(command.LmiLister): for dev in devices: yield get_device_info(ns, dev, self.app.config.human_friendly) - def execute(self, ns, devices=None): - """ - Implementation of 'device list' command. - """ - devices = get_devices(ns, devices) - for dev in devices: - yield get_device_info(ns, dev, self.app.config.human_friendly) - - class Show(command.LmiLister): COLUMNS = ('Name', 'Value') def transform_options(self, options): @@ -226,7 +213,7 @@ class Show(command.LmiLister): class Depends(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Size", "Format") + COLUMNS = ("Name", "Size", "Format") def transform_options(self, options): """ @@ -246,7 +233,7 @@ class Depends(command.LmiLister): class Provides(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Size", "Format") + COLUMNS = ("Name", "Size", "Format") def transform_options(self, options): """ @@ -266,7 +253,7 @@ class Provides(command.LmiLister): class Tree(command.LmiLister): - COLUMNS = ('DeviceID', "Name", "ElementName", "Size", "Format") + COLUMNS = ("Name", "Size", "Format") def prepare_tree_line(self, level, name, subsequent): """ |