summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2014-02-17 10:10:30 +0100
committerJan Safranek <jsafrane@redhat.com>2014-02-17 10:10:30 +0100
commite8c6f0034bed952fe4c20cd8204253f0d0698b84 (patch)
treec13edadf970123fd5dba061f8205dabc6b2b86f2
parent79480a0f6904f45a65a276828b6df4d101ef1567 (diff)
downloadopenlmi-scripts-e8c6f0034bed952fe4c20cd8204253f0d0698b84.tar.gz
openlmi-scripts-e8c6f0034bed952fe4c20cd8204253f0d0698b84.tar.xz
openlmi-scripts-e8c6f0034bed952fe4c20cd8204253f0d0698b84.zip
Introduce 'lmi storage' multiplexer.
All storage commands are now under 'lmi storage'.
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/__init__.py35
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/fs.py (renamed from commands/storage/lmi/scripts/storage/fs_cmd.py)50
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/lv.py (renamed from commands/storage/lmi/scripts/storage/lv_cmd.py)41
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/mount.py (renamed from commands/storage/lmi/scripts/storage/mount_cmd.py)55
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/partition.py (renamed from commands/storage/lmi/scripts/storage/partition_cmd.py)38
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/partition_table.py (renamed from commands/storage/lmi/scripts/storage/partitiontable_cmd.py)35
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/raid.py (renamed from commands/storage/lmi/scripts/storage/raid_cmd.py)38
-rw-r--r--commands/storage/lmi/scripts/storage/cmd/vg.py (renamed from commands/storage/lmi/scripts/storage/vg_cmd.py)38
-rw-r--r--commands/storage/lmi/scripts/storage/storage_cmd.py58
-rw-r--r--commands/storage/setup.py7
-rw-r--r--commands/storage/test/lmi/test_deps.sh34
-rw-r--r--commands/storage/test/lmi/test_fs.sh8
-rw-r--r--commands/storage/test/lmi/test_lvm.sh36
-rw-r--r--commands/storage/test/lmi/test_mount.sh16
-rw-r--r--commands/storage/test/lmi/test_partition_gpt.sh30
-rw-r--r--commands/storage/test/lmi/test_partition_msdos.sh40
-rw-r--r--commands/storage/test/lmi/test_raid.sh20
17 files changed, 340 insertions, 239 deletions
diff --git a/commands/storage/lmi/scripts/storage/cmd/__init__.py b/commands/storage/lmi/scripts/storage/cmd/__init__.py
new file mode 100644
index 0000000..2053981
--- /dev/null
+++ b/commands/storage/lmi/scripts/storage/cmd/__init__.py
@@ -0,0 +1,35 @@
+# Storage Management Providers
+#
+# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and documentation are
+# those of the authors and should not be interpreted as representing official
+# policies, either expressed or implied, of the FreeBSD Project.
+#
+# Authors: Jan Safranek <jsafrane@redhat.com>
+#
+"""
+LMI storage provider command multiplexer. To be used only by 'lmi' command
+line utility.
+"""
diff --git a/commands/storage/lmi/scripts/storage/fs_cmd.py b/commands/storage/lmi/scripts/storage/cmd/fs.py
index 7623bd5..038cfc0 100644
--- a/commands/storage/lmi/scripts/storage/fs_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/fs.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
Filesystem and other data format management.
@@ -40,11 +40,11 @@ Usage:
%(cmd)s list-supported
Commands:
- list List filesystems and and other data formats (RAID metadata, ...)
- on given devices.
+ list List filesystems and and other data formats (RAID metadata,
+ ...) on given devices.
If no devices are provided, all filesystems are listed.
- If --all option is set, all filesystem, including system ones
- like tmpfs, cgroups, procfs, sysfs etc are listed.
+ If --all option is set, all filesystem, including system
+ ones like tmpfs, cgroups, procfs, sysfs etc are listed.
create Format device(s) with given filesystem.
If more devices are given, the filesystem will span
@@ -53,8 +53,8 @@ Commands:
For list of available filesystem types, see output of
%(cmd)s list-supported.
- delete Delete given filesystem or data format (like partition table,
- RAID metadata, LUKS, physical volume metadata etc)
+ delete Delete given filesystem or data format (like partition
+ table, RAID metadata, LUKS, physical volume metadata etc)
on given devices.
list-supported
@@ -62,10 +62,17 @@ Commands:
%(cmd)s create <fstype> option.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import fs
+from lmi.scripts.common import get_logger
+from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
-class Lister(command.LmiLister):
+LOG = get_logger(__name__)
+
+class FSList(command.LmiLister):
COLUMNS = ('Device', 'Name', "ElementName", "Type")
def transform_options(self, options):
@@ -98,7 +105,7 @@ class Lister(command.LmiLister):
yield (devname, name, label, fstype)
-class ListSupported(command.LmiLister):
+class FSListSupported(command.LmiLister):
COLUMNS = ('Filesystem',)
def execute(self, ns):
@@ -112,7 +119,7 @@ class ListSupported(command.LmiLister):
yield [fsname.lower()]
-class Create(command.LmiCheckResult):
+class FSCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -129,7 +136,7 @@ class Create(command.LmiCheckResult):
fs.create_fs(ns, devices, fstype, _label)
-class Delete(command.LmiCheckResult):
+class FSDelete(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -146,12 +153,11 @@ class Delete(command.LmiCheckResult):
for dev in devices:
fs.delete_format(ns, dev)
-
-Fs = command.register_subcommands(
- 'fs', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'delete' : Delete,
- 'list-supported': ListSupported,
- },
- )
+class FS(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : FSList,
+ 'create' : FSCreate,
+ 'delete' : FSDelete,
+ 'list-supported': FSListSupported,
+ }
diff --git a/commands/storage/lmi/scripts/storage/lv_cmd.py b/commands/storage/lmi/scripts/storage/cmd/lv.py
index 51d9f2e..bee5fcb 100644
--- a/commands/storage/lmi/scripts/storage/lv_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/lv.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
Logical Volume management.
@@ -58,19 +58,24 @@ Options:
'T', 'G', 'M' or 'K' suffix can be used to use specify other
units (TiB, GiB, MiB and KiB) - '1K' specifies 1 KiB
(= 1024 bytes).
- The suffix is case insensitive, i.e. 1g = 1G = 1073741824 bytes.
+ The suffix is case insensitive, i.e. 1g = 1G = 1073741824
+ bytes.
'E' suffix can be used to specify number of volume group
extents, '100e' means 100 extents.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import lvm, show
-from lmi.scripts.storage.common import str2size, size2str, str2device, str2vg
-from lmi.scripts.common import formatter
+from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
+LOG = get_logger(__name__)
-class Lister(command.LmiLister):
+class LVList(command.LmiLister):
COLUMNS = ('DeviceID', "Name", "ElementName", "Size")
def transform_options(self, options):
@@ -93,7 +98,7 @@ class Lister(command.LmiLister):
size)
-class Create(command.LmiCheckResult):
+class LVCreate(command.LmiCheckResult):
EXPECT = None
def execute(self, ns, vg, name, size):
@@ -104,7 +109,7 @@ class Create(command.LmiCheckResult):
lvm.create_lv(ns, vg, name, str2size(size, vg.ExtentSize, 'E'))
-class Delete(command.LmiCheckResult):
+class LVDelete(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -122,7 +127,7 @@ class Delete(command.LmiCheckResult):
lvm.delete_lv(ns, lv)
-class Show(command.LmiLister):
+class LVShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
def transform_options(self, options):
@@ -145,12 +150,12 @@ class Show(command.LmiLister):
for line in show.lv_show(ns, lv, self.app.config.human_friendly):
yield line
+class LV(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : LVList,
+ 'create' : LVCreate,
+ 'delete' : LVDelete,
+ 'show' : LVShow,
+ }
-Lv = command.register_subcommands(
- 'Lv', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'delete' : Delete,
- 'show' : Show,
- },
- )
diff --git a/commands/storage/lmi/scripts/storage/mount_cmd.py b/commands/storage/lmi/scripts/storage/cmd/mount.py
index 97a18d9..5107924 100644
--- a/commands/storage/lmi/scripts/storage/mount_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/mount.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,6 +29,7 @@
# policies, either expressed or implied, of the FreeBSD Project.
#
# Authors: Jan Synacek <jsynacek@redhat.com>
+# Jan Safranek <jsafrane@redhat.com>
#
"""
Mount management.
@@ -80,11 +82,15 @@ Commands:
attached to them. Optionally, show all mounted filesystems.
"""
-from lmi.scripts.common import command, get_logger
-from lmi.scripts.common.errors import LmiFailed
+from lmi.shell.LMIUtil import lmi_isinstance
+from lmi.scripts.common import command
+from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
-from lmi.scripts.storage import mount
-from lmi.scripts.storage.common import str2device
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
+LOG = get_logger(__name__)
def get_mounts_for_devices(ns, devices):
"""
@@ -99,9 +105,8 @@ def get_mounts_for_devices(ns, devices):
mounts += fs.associators(ResultClass="LMI_MountedFileSystem")
return mounts
-class Lister(command.LmiLister):
+class MountList(command.LmiLister):
COLUMNS = ('FileSystemSpec', 'FileSystemType', 'MountPointPath', 'Options', 'OtherOptions')
- OPT_NO_UNDERSCORES = True
def transform_options(self, options):
"""
@@ -110,7 +115,7 @@ class Lister(command.LmiLister):
"""
options['<devices>'] = options.pop('<device>')
- def execute(self, ns, all=None, devices=None):
+ def execute(self, ns, devices=None, _all=None):
"""
Implementation of 'mount list' command.
"""
@@ -119,7 +124,7 @@ class Lister(command.LmiLister):
else:
mounts = mount.get_mounts(ns)
- if all is False:
+ if _all is False:
transients = [mnt.Name for mnt in ns.LMI_TransientFileSystem.instances()]
for mnt in mounts:
@@ -128,7 +133,7 @@ class Lister(command.LmiLister):
if mnt.FileSystemSpec == 'rootfs':
continue
- if all is False and mnt.MountPointPath != '/':
+ if _all is False and mnt.MountPointPath != '/':
# do not list nodevice filesystems
name = 'PATH=' + mnt.MountPointPath
if name in transients:
@@ -142,9 +147,8 @@ class Lister(command.LmiLister):
opts_str[0],
opts_str[1])
-class Show(command.LmiLister):
+class MountShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
- OPT_NO_UNDERSCORES = True
def transform_options(self, options):
"""
@@ -154,7 +158,7 @@ class Show(command.LmiLister):
options['<devices>'] = options.pop('<device>')
- def execute(self, ns, all=None, devices=None):
+ def execute(self, ns, _all=None, devices=None):
"""
Implementation of 'mount show' command.
"""
@@ -163,7 +167,7 @@ class Show(command.LmiLister):
else:
mounts = mount.get_mounts(ns)
- if all is False:
+ if _all is False:
transients = [mnt.Name for mnt in ns.LMI_TransientFileSystem.instances()]
yield fcmd.NewTableCommand('Mounted filesystems')
@@ -173,7 +177,7 @@ class Show(command.LmiLister):
if mnt.FileSystemSpec == 'rootfs':
continue
- if all is False and mnt.MountPointPath != '/':
+ if _all is False and mnt.MountPointPath != '/':
# do not list nodevice filesystems
name = 'PATH=' + mnt.MountPointPath
if name in transients:
@@ -187,7 +191,7 @@ class Show(command.LmiLister):
yield('OtherOptions', opts_str[1])
yield ''
-class Create(command.LmiCheckResult):
+class MountCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -204,7 +208,7 @@ class Create(command.LmiCheckResult):
"""
return mount.mount_create(ns, device, mountpoint, fs_type, options, other_options)
-class Delete(command.LmiCheckResult):
+class MountDelete(command.LmiCheckResult):
EXPECT = None
def execute(self, ns, target):
@@ -213,11 +217,12 @@ class Delete(command.LmiCheckResult):
"""
return mount.mount_delete(ns, target)
-Mount = command.register_subcommands(
- 'Mount', __doc__,
- { 'list' : Lister,
- 'create' : Create,
- 'delete' : Delete,
- 'show' : Show,
- },
- )
+class Mount(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : MountList,
+ 'create' : MountCreate,
+ 'delete' : MountDelete,
+ 'show' : MountShow,
+ }
+
diff --git a/commands/storage/lmi/scripts/storage/partition_cmd.py b/commands/storage/lmi/scripts/storage/cmd/partition.py
index fbb3552..ae514ea 100644
--- a/commands/storage/lmi/scripts/storage/partition_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/partition.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
Partition management.
@@ -97,13 +97,17 @@ Options:
--extended Override the automatic behavior and request extended partition.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import partition, show
-from lmi.scripts.storage.common import str2size, str2device, size2str
-from lmi.scripts.common import formatter
+from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
+LOG = get_logger(__name__)
-class Lister(command.LmiLister):
+class PartitionList(command.LmiLister):
COLUMNS = ('DeviceID', "Name", "ElementName", "Type", "Size")
def transform_options(self, options):
@@ -138,7 +142,7 @@ class Lister(command.LmiLister):
size)
-class Create(command.LmiCheckResult):
+class PartitionCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
"""
@@ -165,7 +169,7 @@ class Create(command.LmiCheckResult):
print "Partition %s, with DeviceID %s created." % (p.Name, p.DeviceID)
-class Delete(command.LmiCheckResult):
+class PartitionDelete(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -183,7 +187,7 @@ class Delete(command.LmiCheckResult):
partition.delete_partition(ns, part)
-class Show(command.LmiLister):
+class PartitionShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
def transform_options(self, options):
@@ -207,12 +211,12 @@ class Show(command.LmiLister):
self.app.config.human_friendly):
yield line
+class Partition(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : PartitionList,
+ 'create' : PartitionCreate,
+ 'delete' : PartitionDelete,
+ 'show' : PartitionShow,
+ }
-Partition = command.register_subcommands(
- 'Partition', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'delete' : Delete,
- 'show' : Show,
- },
- )
diff --git a/commands/storage/lmi/scripts/storage/partitiontable_cmd.py b/commands/storage/lmi/scripts/storage/cmd/partition_table.py
index 33ea3f8..d10736e 100644
--- a/commands/storage/lmi/scripts/storage/partitiontable_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/partition_table.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
Partition table management.
@@ -70,15 +70,17 @@ Options:
--msdos Create MS-DOS partition table.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import partition, show
-from lmi.scripts.storage.common import size2str, str2device
-from lmi.scripts.common import formatter
-from lmi.scripts.common.formatter import command as fcmd
from lmi.scripts.common import get_logger
+from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
LOG = get_logger(__name__)
-class Lister(command.LmiLister):
+class PartitionTableList(command.LmiLister):
COLUMNS = ('DeviceID', 'Name', 'ElementName', 'Type', 'Largest free region')
def transform_options(self, options):
@@ -113,7 +115,7 @@ class Lister(command.LmiLister):
)
-class Create(command.LmiCheckResult):
+class PartitionTableCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -135,7 +137,7 @@ class Create(command.LmiCheckResult):
partition.create_partition_table(ns, device, ptype)
-class Show(command.LmiLister):
+class PartitionTableShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
def transform_options(self, options):
@@ -160,10 +162,11 @@ class Show(command.LmiLister):
ns, device, self.app.config.human_friendly):
yield line
-PartitionTable = command.register_subcommands(
- 'PartitionTable', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'show' : Show,
- },
- )
+class PartitionTable(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : PartitionTableList,
+ 'create' : PartitionTableCreate,
+ 'show' : PartitionTableShow,
+ }
+
diff --git a/commands/storage/lmi/scripts/storage/raid_cmd.py b/commands/storage/lmi/scripts/storage/cmd/raid.py
index 35bf748..c519d9d 100644
--- a/commands/storage/lmi/scripts/storage/raid_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/raid.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
MD RAID management.
@@ -69,13 +69,17 @@ Options:
level RAID level. Supported levels are: 0, 1, 4, 5, 6, 10.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import raid, show
-from lmi.scripts.storage.common import str2device
-from lmi.scripts.common import formatter
+from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
+LOG = get_logger(__name__)
-class Lister(command.LmiLister):
+class RaidList(command.LmiLister):
COLUMNS = ('DeviceID', 'Name', "Level", "Nr. of members")
def execute(self, ns):
@@ -87,7 +91,7 @@ class Lister(command.LmiLister):
yield (r.DeviceID, r.ElementName, r.Level, len(members))
-class Create(command.LmiCheckResult):
+class RaidCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -104,7 +108,7 @@ class Create(command.LmiCheckResult):
raid.create_raid(ns, devices, int(level), _name)
-class Delete(command.LmiCheckResult):
+class RaidDelete(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -122,7 +126,7 @@ class Delete(command.LmiCheckResult):
raid.delete_raid(ns, dev)
-class Show(command.LmiLister):
+class RaidShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
def transform_options(self, options):
@@ -145,12 +149,12 @@ class Show(command.LmiLister):
for line in show.raid_show(ns, r, self.app.config.human_friendly):
yield line
+class Raid(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : RaidList,
+ 'create' : RaidCreate,
+ 'delete' : RaidDelete,
+ 'show' : RaidShow,
+ }
-Raid = command.register_subcommands(
- 'raid', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'delete' : Delete,
- 'show' : Show,
- },
- )
diff --git a/commands/storage/lmi/scripts/storage/vg_cmd.py b/commands/storage/lmi/scripts/storage/cmd/vg.py
index c2b0dc1..5a2a61d 100644
--- a/commands/storage/lmi/scripts/storage/vg_cmd.py
+++ b/commands/storage/lmi/scripts/storage/cmd/vg.py
@@ -1,6 +1,7 @@
+# coding=utf-8
# Storage Management Providers
#
-# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -29,7 +30,6 @@
#
# Authors: Jan Safranek <jsafrane@redhat.com>
#
-
"""
Volume Group management.
@@ -76,12 +76,17 @@ Options:
The suffix is case insensitive, i.e. 1g = 1G = 1073741824 bytes.
"""
+from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
-from lmi.scripts.storage import lvm, show
-from lmi.scripts.storage.common import str2size, size2str, str2vg
+from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
+from lmi.scripts.storage.common import (size2str, get_devices, get_children,
+ get_parents, str2device, str2size, str2vg)
+
+LOG = get_logger(__name__)
-class Lister(command.LmiLister):
+class VGList(command.LmiLister):
COLUMNS = ('InstanceID', 'ElementName', "ExtentSize", "Total space",
"Free space")
@@ -103,7 +108,7 @@ class Lister(command.LmiLister):
remaining_space)
-class Create(command.LmiCheckResult):
+class VGCreate(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -122,7 +127,7 @@ class Create(command.LmiCheckResult):
lvm.create_vg(ns, devices, name, _extent_size)
-class Delete(command.LmiCheckResult):
+class VGDelete(command.LmiCheckResult):
EXPECT = None
def transform_options(self, options):
@@ -140,7 +145,7 @@ class Delete(command.LmiCheckResult):
lvm.delete_vg(ns, vg)
-class Show(command.LmiLister):
+class VGShow(command.LmiLister):
COLUMNS = ('Name', 'Value')
def transform_options(self, options):
@@ -163,12 +168,13 @@ class Show(command.LmiLister):
for line in show.vg_show(ns, vg, self.app.config.human_friendly):
yield line
+class VG(command.LmiCommandMultiplexer):
+ OWN_USAGE = __doc__
+ COMMANDS = {
+ 'list' : VGList,
+ 'create' : VGCreate,
+ 'delete' : VGDelete,
+ 'show' : VGShow,
+ }
+
-Vg = command.register_subcommands(
- 'vg', __doc__,
- { 'list' : Lister ,
- 'create' : Create,
- 'delete' : Delete,
- 'show' : Show,
- },
- )
diff --git a/commands/storage/lmi/scripts/storage/storage_cmd.py b/commands/storage/lmi/scripts/storage/storage_cmd.py
index 80641df..b4b750f 100644
--- a/commands/storage/lmi/scripts/storage/storage_cmd.py
+++ b/commands/storage/lmi/scripts/storage/storage_cmd.py
@@ -35,13 +35,34 @@
Basic storage device information.
Usage:
- %(cmd)s list [ <device> ...]
+ %(cmd)s fs <cmd> [<args> ...]
+ %(cmd)s lv <cmd> [<args> ...]
+ %(cmd)s mount <cmd> [<args> ...]
+ %(cmd)s partition <cmd> [<args> ...]
+ %(cmd)s partition-table <cmd> [<args> ...]
+ %(cmd)s raid <cmd> [<args> ...]
+ %(cmd)s vg <cmd> [<args> ...]
%(cmd)s depends [ --deep ] [ <device> ...]
+ %(cmd)s list [ <device> ...]
%(cmd)s provides [ --deep ] [ <device> ...]
%(cmd)s show [ <device> ...]
%(cmd)s tree [ <device> ]
Commands:
+ fs Filesystem and other data format management.
+
+ lv Logical Volume management.
+
+ mount Mount management.
+
+ partition Partition management.
+
+ partition-table Partition table management.
+
+ raid MD RAID management.
+
+ vg Volume Group management.
+
list List short information about given device. If no devices
are given, all devices are listed.
@@ -51,7 +72,7 @@ Commands:
provides Show devices, which are created from given devices
(= show children of the devices).
- For example, if disk is provided, all partitions on it are
+ For example, if a disk is provided, all partitions on it are
returned. If 'deep' is used, all RAIDs, Volume Groups and
Logical Volumes indirectly allocated from it are returned too.
@@ -60,11 +81,9 @@ Commands:
For example, if a Logical Volume is provided, its Volume Group
is returned. If 'deep' is used, also all Physical Volumes and
- disk are returned.
+ appropriate disk(s) are returned.
tree Show tree of devices, similar to lsblk.
- (Note that the output is really crude and needs to be worked
- on).
If no device is provided, all devices are shown, starting
with physical disks.
@@ -72,6 +91,7 @@ Commands:
If a device is provided, tree starts with the device
and all dependent devices are shown.
+
Options:
device Identifier of the device. Either one of:
@@ -98,12 +118,24 @@ from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
-from lmi.scripts.storage import show, fs
+from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
from lmi.scripts.storage.common import (size2str, get_devices, get_children,
- get_parents, str2device)
-from lmi.scripts.storage.lvm import get_vgs
+ get_parents, str2device, str2size, str2vg)
+
+import lmi.scripts.storage.cmd.fs
+import lmi.scripts.storage.cmd.lv
+import lmi.scripts.storage.cmd.mount
+import lmi.scripts.storage.cmd.partition
+import lmi.scripts.storage.cmd.partition_table
+import lmi.scripts.storage.cmd.raid
+import lmi.scripts.storage.cmd.vg
+
LOG = get_logger(__name__)
+##############################################################################
+# Storage
+##############################################################################
+
def get_device_info(ns, device, human_friendly):
"""
Return detailed information of the device to show.
@@ -274,7 +306,7 @@ class Tree(command.LmiLister):
for dev in get_devices(ns):
devices[self.get_obj_id(ns, dev)] = dev
# Add *all* LMI_VGStoragePools.
- for vg in get_vgs(ns):
+ for vg in lvm.get_vgs(ns):
devices[self.get_obj_id(ns, vg)] = vg
# deps = array of tuples (parent devid, child devid)
@@ -372,5 +404,13 @@ Storage = command.register_subcommands(
'tree' : Tree,
'provides': Provides,
'depends' : Depends,
+ 'fs' : lmi.scripts.storage.cmd.fs.FS,
+ 'lv' : lmi.scripts.storage.cmd.lv.LV,
+ 'mount' : lmi.scripts.storage.cmd.mount.Mount,
+ 'partition': lmi.scripts.storage.cmd.partition.Partition,
+ 'partition-table': lmi.scripts.storage.cmd.partition_table.PartitionTable,
+ 'raid' : lmi.scripts.storage.cmd.raid.Raid,
+ 'vg' : lmi.scripts.storage.cmd.vg.VG,
},
)
+
diff --git a/commands/storage/setup.py b/commands/storage/setup.py
index 04935cb..3524da5 100644
--- a/commands/storage/setup.py
+++ b/commands/storage/setup.py
@@ -40,14 +40,7 @@ setup(
entry_points={
'lmi.scripts.cmd': [
- 'fs = lmi.scripts.storage.fs_cmd:Fs',
- 'partition = lmi.scripts.storage.partition_cmd:Partition',
- 'partition-table = lmi.scripts.storage.partitiontable_cmd:PartitionTable',
- 'raid = lmi.scripts.storage.raid_cmd:Raid',
- 'lv = lmi.scripts.storage.lv_cmd:Lv',
- 'vg = lmi.scripts.storage.vg_cmd:Vg',
'storage = lmi.scripts.storage.storage_cmd:Storage',
- 'mount = lmi.scripts.storage.mount_cmd:Mount',
],
},
)
diff --git a/commands/storage/test/lmi/test_deps.sh b/commands/storage/test/lmi/test_deps.sh
index 701df4a..7ec8aa6 100644
--- a/commands/storage/test/lmi/test_deps.sh
+++ b/commands/storage/test/lmi/test_deps.sh
@@ -56,24 +56,24 @@ DISKNAME=$( echo $LMI_STORAGE_DISK | sed 's!.*/!!' )
rlPhaseStartTest "Setup"
rlLogInfo "Create partitions"
- rlRun "$LMI partition-table create --gpt $LMI_STORAGE_DISK"
- rlRun "$LMI partition create $LMI_STORAGE_DISK $PARTSIZE"
- rlRun "$LMI partition create $LMI_STORAGE_DISK $PARTSIZE"
- rlRun "$LMI partition create $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition-table create --gpt $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK $PARTSIZE"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK $PARTSIZE"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK"
rlLogInfo "Create MD RAID"
- rlRun "$LMI raid create --name=$MDNAME 0 ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2"
+ rlRun "$LMI storage raid create --name=$MDNAME 0 ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2"
rlLogInfo "Create VG"
- rlRun "$LMI vg create $VGNAME $MDNAME ${LMI_STORAGE_DISK}3"
+ rlRun "$LMI storage vg create $VGNAME $MDNAME ${LMI_STORAGE_DISK}3"
rlLogInfo "Create LVs"
- rlRun "$LMI lv create $VGNAME ${LVNAME}1 $PARTSIZE"
- rlRun "$LMI lv create $VGNAME ${LVNAME}2 $PARTSIZE"
+ rlRun "$LMI storage lv create $VGNAME ${LVNAME}1 $PARTSIZE"
+ rlRun "$LMI storage lv create $VGNAME ${LVNAME}2 $PARTSIZE"
rlLogInfo "Create filesystems"
- rlRun "$LMI fs create xfs ${LVNAME}1"
- rlRun "$LMI fs create ext4 ${LVNAME}2"
+ rlRun "$LMI storage fs create xfs ${LVNAME}1"
+ rlRun "$LMI storage fs create ext4 ${LVNAME}2"
rlPhaseEnd
function check_part1()
@@ -246,21 +246,21 @@ rlPhaseEnd
rlPhaseStartTest "Cleanup"
rlLogInfo "Delete filesystems"
- rlRun "$LMI fs delete ${LVNAME}1"
- rlRun "$LMI fs delete ${LVNAME}2"
+ rlRun "$LMI storage fs delete ${LVNAME}1"
+ rlRun "$LMI storage fs delete ${LVNAME}2"
rlLogInfo "Delete LVs"
- rlRun "$LMI lv delete ${LVNAME}1"
- rlRun "$LMI lv delete ${LVNAME}2"
+ rlRun "$LMI storage lv delete ${LVNAME}1"
+ rlRun "$LMI storage lv delete ${LVNAME}2"
rlLogInfo "Delete VG"
- rlRun "$LMI vg delete $VGNAME"
+ rlRun "$LMI storage vg delete $VGNAME"
rlLogInfo "Delete MD RAID"
- rlRun "$LMI raid delete $MDNAME"
+ rlRun "$LMI storage raid delete $MDNAME"
rlLogInfo "Delete partitions"
- rlRun "$LMI partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2 ${LMI_STORAGE_DISK}3"
+ rlRun "$LMI storage partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2 ${LMI_STORAGE_DISK}3"
rlPhaseEnd
rlJournalPrintText
diff --git a/commands/storage/test/lmi/test_fs.sh b/commands/storage/test/lmi/test_fs.sh
index afcbe69..c16acb7 100644
--- a/commands/storage/test/lmi/test_fs.sh
+++ b/commands/storage/test/lmi/test_fs.sh
@@ -42,13 +42,13 @@ rlJournalStart
part=${PARTITIONS[0]}
rlPhaseStartTest
rlLogInfo "Getting list of supported filesystems"
- rlRun -s "$LMI -N fs list-supported"
+ rlRun -s "$LMI -N storage fs list-supported"
filesystems=$(cat $rlRun_LOG)
rm $rlRun_LOG
for fsname in $filesystems; do
rlLogInfo "Test fs create $fsname"
- rlRun "$LMI fs create $fsname $part"
- rlRun -s "$LMI -N -L csv fs list $part"
+ rlRun "$LMI storage fs create $fsname $part"
+ rlRun -s "$LMI -N -L csv storage fs list $part"
rlLogInfo "Test fs list"
# the last column is lower-case filesystem type in double quotes
@@ -63,7 +63,7 @@ rlPhaseStartTest
rm $rlRun_LOG
rlLogInfo "Test fs delete"
- rlRun "$LMI fs delete $part"
+ rlRun "$LMI storage fs delete $part"
rlLogInfo "Test the fs is really deleted"
rlRun -s "file -s $part"
diff --git a/commands/storage/test/lmi/test_lvm.sh b/commands/storage/test/lmi/test_lvm.sh
index b2478db..f07d3dd 100644
--- a/commands/storage/test/lmi/test_lvm.sh
+++ b/commands/storage/test/lmi/test_lvm.sh
@@ -53,7 +53,7 @@ rlJournalStart
rlPhaseStartTest "CreateVG"
rlLogInfo "Creating a VG with specific extent size"
- rlRun "$LMI vg create --extent-size=$EXTENT_SIZE $VGNAME ${PARTITIONS[*]}"
+ rlRun "$LMI storage vg create --extent-size=$EXTENT_SIZE $VGNAME ${PARTITIONS[*]}"
rlLogInfo "Check that the VG exists"
rlRun -s "vgs --noheading -o vg_name"
@@ -68,13 +68,13 @@ rlPhaseStartTest "CreateVG"
rm $rlRun_LOG
rlLogInfo "Check lmi vg list shows it"
- rlRun -s "$LMI -N -H -L csv vg list"
+ rlRun -s "$LMI -N -H -L csv storage vg list"
rlAssertGrep "\"LMI:VG:$VGNAME\"" $rlRun_LOG
rlAssertGrep "\"$VGNAME\"" $rlRun_LOG
rm $rlRun_LOG
rlLogInfo "Check lmi vg show shows it"
- rlRun -s "$LMI -N -H -L csv vg show"
+ rlRun -s "$LMI -N -H -L csv storage vg show"
rlAssertGrep "\"InstanceID\",\"LMI:VG:$VGNAME\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"$VGNAME\"" $rlRun_LOG
rlAssertGrep "\"Extent Size\",\"1024K\"" $rlRun_LOG
@@ -88,8 +88,8 @@ rlPhaseEnd
rlPhaseStartTest "CreateLV"
rlLogInfo "Creating LVs"
- rlRun "$LMI lv create $VGNAME $LVNAME1 $LVSIZESPEC1"
- rlRun "$LMI lv create $VGNAME $LVNAME2 $LVSIZESPEC2"
+ rlRun "$LMI storage lv create $VGNAME $LVNAME1 $LVSIZESPEC1"
+ rlRun "$LMI storage lv create $VGNAME $LVNAME2 $LVSIZESPEC2"
rlLogInfo "Check that the LVs exist"
rlRun -s "lvs --noheading -o lv_name"
@@ -98,7 +98,7 @@ rlPhaseStartTest "CreateLV"
rm $rlRun_LOG
rlLogInfo "Check lmi lv list shows them"
- rlRun -s "$LMI -N -H -L csv lv list $VGNAME"
+ rlRun -s "$LMI -N -H -L csv storage lv list $VGNAME"
rlAssertGrep "\"/dev/disk/by-id/dm-name-$VGNAME-$LVNAME1\"" $rlRun_LOG
rlAssertGrep "\"$LVNAME1\"" $rlRun_LOG
rlAssertGrep "\"$LVSIZE1\"" $rlRun_LOG
@@ -108,7 +108,7 @@ rlPhaseStartTest "CreateLV"
rm $rlRun_LOG
rlLogInfo "Check lmi lv show shows them"
- rlRun -s "$LMI -N -H -L csv lv show $LVNAME1"
+ rlRun -s "$LMI -N -H -L csv storage lv show $LVNAME1"
rlAssertGrep "\"DeviceID\",\"/dev/disk/by-id/dm-name-$VGNAME-$LVNAME1\"" $rlRun_LOG
rlAssertGrep "\"Name\",\"/dev/mapper/$VGNAME-$LVNAME1\"" $rlRun_LOG
rlAssertGrep "\"Volume Group\",\"$VGNAME\"" $rlRun_LOG
@@ -117,7 +117,7 @@ rlPhaseStartTest "CreateLV"
rlAssertGrep "\"Extent Size\",\"$EXTENT_SIZE\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -N -H -L csv lv show $LVNAME2"
+ rlRun -s "$LMI -N -H -L csv storage lv show $LVNAME2"
rlAssertGrep "\"DeviceID\",\"/dev/disk/by-id/dm-name-$VGNAME-$LVNAME2\"" $rlRun_LOG
rlAssertGrep "\"Name\",\"/dev/mapper/$VGNAME-$LVNAME2\"" $rlRun_LOG
rlAssertGrep "\"Volume Group\",\"$VGNAME\"" $rlRun_LOG
@@ -126,8 +126,8 @@ rlPhaseStartTest "CreateLV"
rlAssertGrep "\"Extent Size\",\"$EXTENT_SIZE\"" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi vg show shows them"
- rlRun -s "$LMI -N -H -L csv vg show"
+ rlLogInfo "Check lmi storage vg show shows them"
+ rlRun -s "$LMI -N -H -L csv storage vg show"
rlAssertGrep "Logical Volumes.*$LVNAME1" $rlRun_LOG
rlAssertGrep "Logical Volumes.*$LVNAME2" $rlRun_LOG
@@ -136,7 +136,7 @@ rlPhaseEnd
rlPhaseStartTest "DeleteLV"
rlLogInfo "Deleting LVs"
- rlRun "$LMI lv delete $LVNAME1 $LVNAME2"
+ rlRun "$LMI storage lv delete $LVNAME1 $LVNAME2"
rlLogInfo "Check that the LVs is deleted"
rlRun -s "lvs --noheading -o lv_name"
@@ -144,8 +144,8 @@ rlPhaseStartTest "DeleteLV"
rlAssertNotGrep $LVNAME2 $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi lv list doesn't show them"
- rlRun -s "$LMI -N -H -L csv lv list $VGNAME"
+ rlLogInfo "Check lmi storage lv list doesn't show them"
+ rlRun -s "$LMI -N -H -L csv storage lv list $VGNAME"
rlAssertNotGrep "\"LMI:/dev/disk/by-id/dm-name-$VGNAME-$LVNAME1\"" $rlRun_LOG
rlAssertNotGrep "\"$LVNAME1\"" $rlRun_LOG
rlAssertNotGrep "\"$LVSIZE1\"" $rlRun_LOG
@@ -154,8 +154,8 @@ rlPhaseStartTest "DeleteLV"
rlAssertNotGrep "\"$LVSIZE2\"" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi vg show doesn't show them"
- rlRun -s "$LMI -N -H -L csv vg show"
+ rlLogInfo "Check lmi storage vg show doesn't show them"
+ rlRun -s "$LMI -N -H -L csv storage vg show"
rlAssertNotGrep "Logical Volumes.*$LVNAME1" $rlRun_LOG
rlAssertNotGrep "Logical Volumes.*$LVNAME2" $rlRun_LOG
rlPhaseEnd
@@ -163,15 +163,15 @@ rlPhaseEnd
rlPhaseStartTest "DeleteVG"
rlLogInfo "Delete the VG"
- rlRun "$LMI vg delete $VGNAME"
+ rlRun "$LMI storage vg delete $VGNAME"
rlLogInfo "Check that the VG is removed"
rlRun -s "vgs --noheading -o vg_name"
rlAssertNotGrep $VGNAME $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi vg list does not show"
- rlRun -s "$LMI -N -L csv vg list"
+ rlLogInfo "Check lmi storage vg list does not show"
+ rlRun -s "$LMI -N -L csv storage vg list"
rlAssertNotGrep "\"LMI:VG:$VGNAME\"" $rlRun_LOG
rlAssertNotGrep "\"$VGNAME\"" $rlRun_LOG
rm $rlRun_LOG
diff --git a/commands/storage/test/lmi/test_mount.sh b/commands/storage/test/lmi/test_mount.sh
index 6a25ad2..1d8f615 100644
--- a/commands/storage/test/lmi/test_mount.sh
+++ b/commands/storage/test/lmi/test_mount.sh
@@ -43,23 +43,23 @@ testdir=$( mktemp -d /var/tmp/XXXXXXXXX )
rlPhaseStartTest "Create filesystem"
rlLogInfo "Create filesystem"
- rlRun "$LMI fs create ext3 $part"
+ rlRun "$LMI storage fs create ext3 $part"
rlPhaseEnd
rlPhaseStartTest "Mount without any options"
rlLogInfo "Mount the fs"
- rlRun "$LMI mount create $part $testdir"
+ rlRun "$LMI storage mount create $part $testdir"
rlLogInfo "Check it is mounted"
rlAssertGrep "$part.*$testdir" /proc/mounts
rlLogInfo "Check lmi mount list shows it"
- rlRun -s "$LMI -NHL csv mount list"
+ rlRun -s "$LMI -NHL csv storage mount list"
rlAssertGrep "\"$part\",\"ext3\",\"$testdir\"" $rlRun_LOG
rm $rlRun_LOG
rlLogInfo "Check lmi mount show shows it"
- rlRun -s "$LMI -NHL csv mount show"
+ rlRun -s "$LMI -NHL csv storage mount show"
rlAssertGrep "\"Mountpoint\",\"$testdir\"" $rlRun_LOG
rlAssertGrep "\"Filesystem\",\"$part" $rlRun_LOG
rm $rlRun_LOG
@@ -67,13 +67,13 @@ rlPhaseEnd
rlPhaseStartTest "Unmount"
rlLogInfo "Unmount the fs"
- rlRun "$LMI mount delete $part"
+ rlRun "$LMI storage mount delete $part"
rlLogInfo "Check it is unmounted"
rlAssertNotGrep "$part.*$testdir" /proc/mounts
- rlLogInfo "Check lmi mount list doesn't show it"
- rlRun -s "$LMI -NHL csv mount list"
+ rlLogInfo "Check lmi storage mount list doesn't show it"
+ rlRun -s "$LMI -NHL csv storage mount list"
rlAssertNptGrep "\"$part\",\"ext3\",\"$testdir\"" $rlRun_LOG
rm $rlRun_LOG
rlPhaseEnd
@@ -81,7 +81,7 @@ rlPhaseEnd
rlPhaseStartTest "Delete filesystem"
rlLogInfo "Delete filesystem"
- rlRun "$LMI fs delete $part"
+ rlRun "$LMI storage fs delete $part"
rlPhaseEnd
rlJournalPrintText
diff --git a/commands/storage/test/lmi/test_partition_gpt.sh b/commands/storage/test/lmi/test_partition_gpt.sh
index 55e932f..2423fc5 100644
--- a/commands/storage/test/lmi/test_partition_gpt.sh
+++ b/commands/storage/test/lmi/test_partition_gpt.sh
@@ -48,7 +48,7 @@ SIZE2=20M
rlPhaseStartTest "Create the partition table"
rlLogInfo "Creating partition table"
- rlRun "$LMI partition-table create --gpt $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition-table create --gpt $LMI_STORAGE_DISK"
rlLogInfo "Check the partition table exists"
rlRun -s "parted $LMI_STORAGE_DISK print"
@@ -56,12 +56,12 @@ rlPhaseStartTest "Create the partition table"
rm $rlRun_LOG
rlLogInfo "Check lmi partition-table list shows it"
- rlRun -s "$LMI -NHL csv partition-table list $LMI_STORAGE_DISK"
+ rlRun -s "$LMI -NHL csv storage partition-table list $LMI_STORAGE_DISK"
rlAssertGrep "\"$LMI_STORAGE_DISK\"" $rlRun_LOG
rm $rlRun_LOG
rlLogInfo "Check lmi partition-table show shows it"
- rlRun -s "$LMI -NHL csv partition-table show $LMI_STORAGE_DISK"
+ rlRun -s "$LMI -NHL csv storage partition-table show $LMI_STORAGE_DISK"
rlAssertGrep "\"Partition Table Type\",\"GPT\"" $rlRun_LOG
rlAssertGrep "\"Partition Table Size (in blocks)\",68" $rlRun_LOG
rm $rlRun_LOG
@@ -69,31 +69,31 @@ rlPhaseEnd
rlPhaseStartTest "Create partitions"
rlLogInfo "Creating partitions"
- rlRun "$LMI partition create $LMI_STORAGE_DISK $SIZE1"
- rlRun "$LMI partition create $LMI_STORAGE_DISK $SIZE2"
- rlRun "$LMI partition create $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK $SIZE1"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK $SIZE2"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK"
- rlLogInfo "Check lmi partition list shows them"
- rlRun -s "$LMI -NHL csv partition list $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition list shows them"
+ rlRun -s "$LMI -NHL csv storage partition list $LMI_STORAGE_DISK"
rlAssertGrep "\"${LMI_STORAGE_DISK}1\",\"${DISKNAME}1\",\"\",\"$SIZE1\"" $rlRun_LOG
rlAssertGrep "\"${LMI_STORAGE_DISK}2\",\"${DISKNAME}2\",\"\",\"$SIZE2\"" $rlRun_LOG
rlAssertGrep "\"${LMI_STORAGE_DISK}3\",\"${DISKNAME}3\"" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi partition show shows them"
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}1"
+ rlLogInfo "Check lmi storage partition show shows them"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}1"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}1\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}1\"" $rlRun_LOG
rlAssertGrep "\"Total Size\",\"$SIZE1\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}2"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}2"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}2\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}2\"" $rlRun_LOG
rlAssertGrep "\"Total Size\",\"$SIZE2\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}3"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}3"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}3\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}3\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
@@ -102,10 +102,10 @@ rlPhaseEnd
rlPhaseStartTest "Delete partitions"
rlLogInfo "Deleting partitions"
- rlRun "$LMI partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2 ${LMI_STORAGE_DISK}3"
+ rlRun "$LMI storage partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}2 ${LMI_STORAGE_DISK}3"
- rlLogInfo "Check lmi partition list does not show them"
- rlRun -s "$LMI -NHL csv partition list $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition list does not show them"
+ rlRun -s "$LMI -NHL csv storage partition list $LMI_STORAGE_DISK"
rlAssertNotGrep "\"${LMI_STORAGE_DISK}1\",\"${DISKNAME}1\",\"\",\"$SIZE1\"" $rlRun_LOG
rlAssertNotGrep "\"${LMI_STORAGE_DISK}2\",\"${DISKNAME}2\",\"\",\"$SIZE2\"" $rlRun_LOG
rlAssertNotGrep "\"${LMI_STORAGE_DISK}3\",\"${DISKNAME}3\"" $rlRun_LOG
diff --git a/commands/storage/test/lmi/test_partition_msdos.sh b/commands/storage/test/lmi/test_partition_msdos.sh
index 97a0ed3..2c05a47 100644
--- a/commands/storage/test/lmi/test_partition_msdos.sh
+++ b/commands/storage/test/lmi/test_partition_msdos.sh
@@ -48,20 +48,20 @@ SIZE2=20M # first logical
rlPhaseStartTest "Create the partition table"
rlLogInfo "Creating partition table"
- rlRun "$LMI partition-table create --msdos $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition-table create --msdos $LMI_STORAGE_DISK"
rlLogInfo "Check the partition table exists"
rlRun -s "parted $LMI_STORAGE_DISK print"
rlAssertGrep "Partition Table: msdos" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi partition-table list shows it"
- rlRun -s "$LMI -NHL csv partition-table list $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition-table list shows it"
+ rlRun -s "$LMI -NHL csv storage partition-table list $LMI_STORAGE_DISK"
rlAssertGrep "\"$LMI_STORAGE_DISK\"" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi partition-table show shows it"
- rlRun -s "$LMI -NHL csv partition-table show $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition-table show shows it"
+ rlRun -s "$LMI -NHL csv storage partition-table show $LMI_STORAGE_DISK"
rlAssertGrep "\"Partition Table Type\",\"MS-DOS\"" $rlRun_LOG
rlAssertGrep "\"Partition Table Size (in blocks)\",1" $rlRun_LOG
rm $rlRun_LOG
@@ -69,15 +69,15 @@ rlPhaseEnd
rlPhaseStartTest "Create partitions"
rlLogInfo "Creating partitions"
- rlRun "$LMI partition create $LMI_STORAGE_DISK $SIZE1"
- rlRun "$LMI partition create --extended $LMI_STORAGE_DISK"
- rlRun "$LMI partition create --logical $LMI_STORAGE_DISK $SIZE2"
- rlRun "$LMI partition create --logical $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition create $LMI_STORAGE_DISK $SIZE1"
+ rlRun "$LMI storage partition create --extended $LMI_STORAGE_DISK"
+ rlRun "$LMI storage partition create --logical $LMI_STORAGE_DISK $SIZE2"
+ rlRun "$LMI storage partition create --logical $LMI_STORAGE_DISK"
- rlLogInfo "Check lmi partition list shows them"
- rlRun "$LMI -NHL csv partition list"
- rlRun "$LMI -NHL csv partition list ${LMI_STORAGE_DISK}2"
- rlRun -s "$LMI -NHL csv partition list $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition list shows them"
+ rlRun "$LMI -NHL csv storage partition list"
+ rlRun "$LMI -NHL csv storage partition list ${LMI_STORAGE_DISK}2"
+ rlRun -s "$LMI -NHL csv storage partition list $LMI_STORAGE_DISK"
rlAssertGrep "\"${LMI_STORAGE_DISK}1\",\"${DISKNAME}1\",\"primary\",\"$SIZE1\"" $rlRun_LOG
rlAssertGrep "\"${LMI_STORAGE_DISK}2\",\"${DISKNAME}2\",\"extended\"," $rlRun_LOG
rlAssertGrep "\"${LMI_STORAGE_DISK}5\",\"${DISKNAME}5\",\"logical\",\"$SIZE2\"" $rlRun_LOG
@@ -85,27 +85,27 @@ rlPhaseStartTest "Create partitions"
rm $rlRun_LOG
rlLogInfo "Check lmi partition show shows them"
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}1"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}1"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}1\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}1\"" $rlRun_LOG
rlAssertGrep "\"Total Size\",\"$SIZE1\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
rlAssertGrep "\"Partition Type\",\"primary\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}2"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}2"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}2\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}2\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
rlAssertGrep "\"Partition Type\",\"extended\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}5"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}5"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}5\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}5\"" $rlRun_LOG
rlAssertGrep "\"Total Size\",\"$SIZE2\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
rlAssertGrep "\"Partition Type\",\"logical\"" $rlRun_LOG
rm $rlRun_LOG
- rlRun -s "$LMI -NHL csv partition show ${LMI_STORAGE_DISK}6"
+ rlRun -s "$LMI -NHL csv storage partition show ${LMI_STORAGE_DISK}6"
rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}6\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"${DISKNAME}6\"" $rlRun_LOG
rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
@@ -115,10 +115,10 @@ rlPhaseEnd
rlPhaseStartTest "Delete partitions"
rlLogInfo "Deleting partitions"
- rlRun "$LMI partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}5 ${LMI_STORAGE_DISK}5 ${LMI_STORAGE_DISK}2"
+ rlRun "$LMI storage partition delete ${LMI_STORAGE_DISK}1 ${LMI_STORAGE_DISK}5 ${LMI_STORAGE_DISK}5 ${LMI_STORAGE_DISK}2"
- rlLogInfo "Check lmi partition list does not show them"
- rlRun -s "$LMI -NHL csv partition list $LMI_STORAGE_DISK"
+ rlLogInfo "Check lmi storage partition list does not show them"
+ rlRun -s "$LMI -NHL csv storage partition list $LMI_STORAGE_DISK"
rlAssertNotGrep "\"${LMI_STORAGE_DISK}1\",\"${DISKNAME}1\",\"\",\"$SIZE1\"" $rlRun_LOG
rlAssertNotGrep "\"${LMI_STORAGE_DISK}2\",\"${DISKNAME}2\"" $rlRun_LOG
rlAssertNotGrep "\"${LMI_STORAGE_DISK}5\",\"${DISKNAME}5\"" $rlRun_LOG
diff --git a/commands/storage/test/lmi/test_raid.sh b/commands/storage/test/lmi/test_raid.sh
index 3bd5ed1..8d8d15f 100644
--- a/commands/storage/test/lmi/test_raid.sh
+++ b/commands/storage/test/lmi/test_raid.sh
@@ -49,7 +49,7 @@ function test_raid() {
rlPhaseStartTest "Create RAID $level: $name on $parts"
rlLogInfo "Creating the RAID"
- rlRun "$LMI raid create --name="$name" $level $parts"
+ rlRun "$LMI storage raid create --name="$name" $level $parts"
rlLogInfo "Check that the RAID exists"
rlRun "ls -l /dev/md/$name"
@@ -59,16 +59,16 @@ function test_raid() {
done
rm $rlRun_LOG
- rlLogInfo "Check lmi raid list output"
- rlRun -s "$LMI -NHL csv raid list"
+ rlLogInfo "Check lmi storage raid list output"
+ rlRun -s "$LMI -NHL csv storage raid list"
rlAssertGrep "\"$name\"" $rlRun_LOG
rlAssertGrep "\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
member_count=$(echo $parts | wc -w)
rlAssertGrep ",$level,$member_count\$" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi raid show output"
- rlRun -s "$LMI -NHL csv raid show $name"
+ rlLogInfo "Check lmi storage raid show output"
+ rlRun -s "$LMI -NHL csv storage raid show $name"
rlAssertGrep "\"DeviceID\",\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
rlAssertGrep "\"Name\",\"/dev/md/$name\"" $rlRun_LOG
rlAssertGrep "\"ElementName\",\"$name\"" $rlRun_LOG
@@ -81,20 +81,20 @@ function test_raid() {
rlPhaseStartTest "Delete RAID $level: $name on $parts"
rlLogInfo "deleting the RAID"
- rlRun "$LMI raid delete $name"
+ rlRun "$LMI storage raid delete $name"
rlLogInfo "Check that the RAID does not exist"
rlRun "ls -l /dev/md/$name" 2
rlRun "mdadm -D /dev/md/$name" 1
- rlLogInfo "Check lmi raid list output"
- rlRun -s "$LMI -NHL csv raid list"
+ rlLogInfo "Check lmi storage raid list output"
+ rlRun -s "$LMI -NHL csv storage raid list"
rlAssertNotGrep "\"$name\"" $rlRun_LOG
rlAssertNotGrep "\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
rm $rlRun_LOG
- rlLogInfo "Check lmi raid show output"
- rlRun -s "$LMI -NHL csv raid show $name" 1
+ rlLogInfo "Check lmi storage raid show output"
+ rlRun -s "$LMI -NHL csv storage raid show $name" 1
rlAssertNotGrep "\"DeviceID\",\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
rlAssertNotGrep "\"Name\",\"/dev/md/$name\"" $rlRun_LOG
rlPhaseEnd