summaryrefslogtreecommitdiffstats
path: root/commands/storage/test
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-11-19 15:25:06 +0100
committerJan Safranek <jsafrane@redhat.com>2013-11-19 15:25:06 +0100
commitc18ebe2007ada8660e82626a17ea580510a5bd4d (patch)
treef09f928b6459d10f5fe625a128b0d57cb6e38060 /commands/storage/test
parentd91223a1638be16b0a77b3a6821b1d7f8b89b0e7 (diff)
downloadopenlmi-scripts-c18ebe2007ada8660e82626a17ea580510a5bd4d.tar.gz
openlmi-scripts-c18ebe2007ada8660e82626a17ea580510a5bd4d.tar.xz
openlmi-scripts-c18ebe2007ada8660e82626a17ea580510a5bd4d.zip
Add some basic tests.
Diffstat (limited to 'commands/storage/test')
-rw-r--r--commands/storage/test/lmi/base.sh40
-rw-r--r--commands/storage/test/lmi/test_fs.sh76
-rw-r--r--commands/storage/test/lmi/test_lvm.sh181
-rw-r--r--commands/storage/test/lmi/test_partition_gpt.sh116
-rw-r--r--commands/storage/test/lmi/test_partition_msdos.sh129
-rw-r--r--commands/storage/test/lmi/test_raid.sh128
6 files changed, 670 insertions, 0 deletions
diff --git a/commands/storage/test/lmi/base.sh b/commands/storage/test/lmi/base.sh
new file mode 100644
index 0000000..1604970
--- /dev/null
+++ b/commands/storage/test/lmi/base.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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>
+
+# Basic framework for all 'lmi' tests.
+# It is based on Beakerlib, https://fedorahosted.org/beakerlib/
+
+. /usr/share/beakerlib/beakerlib.sh
+
+HOSTNAME=$( echo $LMI_CIMOM_URL | sed -e 's!^.*//!!' -e 's!/.*!!')
+PARTITIONS=( $LMI_STORAGE_PARTITIONS )
+
+export LMI="lmi -n --trace --host $LMI_CIMOM_USERNAME:$LMI_CIMOM_PASSWORD@$HOSTNAME"
diff --git a/commands/storage/test/lmi/test_fs.sh b/commands/storage/test/lmi/test_fs.sh
new file mode 100644
index 0000000..e05d639
--- /dev/null
+++ b/commands/storage/test/lmi/test_fs.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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 fs' test.
+# - create all supported filesystems
+# - check that 'lmi fs list' shows them
+# - delete the filesystems
+
+. ./base.sh
+
+rlJournalStart
+
+part=${PARTITIONS[0]}
+rlPhaseStartTest
+ rlLogInfo "Getting list of supported filesystems"
+ rlRun -s "$LMI -N 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"
+
+ rlLogInfo "Test fs list"
+ # the last column is lower-case filesystem type in double quotes
+ fstype=$(cat $rlRun_LOG | cut -f 4 -d ',' | tr '[a-z]' '[A-Z]')
+ rlAssertEquals "Checking fs $fsname is present on $part" "\"$fsname\"" $fstype
+ rm $rlRun_LOG
+
+ rlLogInfo "Test the fs is really created"
+ rlRun -s "file -s $part"
+ rlAssertGrep $fsname $rlRun_LOG -i
+ rlAssertGrep "FILESYSTEM" $rlRun_LOG -i
+ rm $rlRun_LOG
+
+ rlLogInfo "Test fs delete"
+ rlRun "$LMI fs delete $part"
+
+ rlLogInfo "Test the fs is really deleted"
+ rlRun -s "file -s $part"
+ rlAssertGrep "$part: data" $rlRun_LOG -i
+ rm $rlRun_LOG
+ done
+rlPhaseEnd
+
+rlJournalPrintText
+rlJournalEnd
diff --git a/commands/storage/test/lmi/test_lvm.sh b/commands/storage/test/lmi/test_lvm.sh
new file mode 100644
index 0000000..acc367e
--- /dev/null
+++ b/commands/storage/test/lmi/test_lvm.sh
@@ -0,0 +1,181 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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 vg' and 'lmi lv' test.
+# - create vg
+# - check that 'lmi vg list + show' shows it
+# - create lvs on it
+# - check that 'lmi lv list + show' shows it
+# - delete the lvs
+# - delete the vg
+
+. ./base.sh
+
+EXTENT_SIZE=1024K
+VGNAME=mytest
+LVNAME1=mylv1
+LVSIZESPEC1=10M
+LVSIZE1=10M
+LVNAME2=mylv2
+LVSIZE2=20M
+LVSIZESPEC2=20E
+
+rlJournalStart
+
+rlPhaseStartTest "CreateVG"
+ rlLogInfo "Creating a VG with specific extent size"
+ rlRun "$LMI vg create --extent-size=$EXTENT_SIZE $VGNAME ${PARTITIONS[*]}"
+
+ rlLogInfo "Check that the VG exists"
+ rlRun -s "vgs --noheading -o vg_name"
+ rlAssertGrep $VGNAME $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlLogInfo "Check VG has all PVs"
+ rlRun -s "pvs --noheading -o pv_name"
+ for part in ${PARTITIONS[*]}; do
+ rlAssertGrep $part $rlRun_LOG
+ done
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi vg list shows it"
+ rlRun -s "$LMI -N -H -L csv 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"
+ rlAssertGrep "\"InstanceID\",\"LMI:VG:$VGNAME\"" $rlRun_LOG
+ rlAssertGrep "\"ElementName\",\"$VGNAME\"" $rlRun_LOG
+ rlAssertGrep "\"Extent Size\",\"1024K\"" $rlRun_LOG
+ for part in ${PARTITIONS[*]}; do
+ rlAssertGrep "Physical Volumes.*$part" $rlRun_LOG
+ done
+ rlAssertGrep '"Logical Volumes",""' $rlRun_LOG
+ rm $rlRun_LOG
+rlPhaseEnd
+
+
+rlPhaseStartTest "CreateLV"
+ rlLogInfo "Creating LVs"
+ rlRun "$LMI lv create $VGNAME $LVNAME1 $LVSIZESPEC1"
+ rlRun "$LMI lv create $VGNAME $LVNAME2 $LVSIZESPEC2"
+
+ rlLogInfo "Check that the LVs exist"
+ rlRun -s "lvs --noheading -o lv_name"
+ rlAssertGrep $LVNAME1 $rlRun_LOG
+ rlAssertGrep $LVNAME2 $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi lv list shows them"
+ rlRun -s "$LMI -N -H -L csv lv list $VGNAME"
+ rlAssertGrep "\"/dev/disk/by-id/dm-name-$VGNAME-$LVNAME1\"" $rlRun_LOG
+ rlAssertGrep "\"$LVNAME1\"" $rlRun_LOG
+ rlAssertGrep "\"$LVSIZE1\"" $rlRun_LOG
+ rlAssertGrep "\"/dev/disk/by-id/dm-name-$VGNAME-$LVNAME2\"" $rlRun_LOG
+ rlAssertGrep "\"$LVNAME2\"" $rlRun_LOG
+ rlAssertGrep "\"$LVSIZE2\"" $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi lv show shows them"
+ rlRun -s "$LMI -N -H -L csv 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
+ rlAssertGrep "\"ElementName\",\"$LVNAME1\"" $rlRun_LOG
+ rlAssertGrep "\"Total Size\",\"$LVSIZE1\"" $rlRun_LOG
+ rlAssertGrep "\"Extent Size\",\"$EXTENT_SIZE\"" $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlRun -s "$LMI -N -H -L csv 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
+ rlAssertGrep "\"ElementName\",\"$LVNAME2\"" $rlRun_LOG
+ rlAssertGrep "\"Total Size\",\"$LVSIZE2\"" $rlRun_LOG
+ 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"
+ rlAssertGrep "Logical Volumes.*$LVNAME1" $rlRun_LOG
+ rlAssertGrep "Logical Volumes.*$LVNAME2" $rlRun_LOG
+
+rlPhaseEnd
+
+
+rlPhaseStartTest "DeleteLV"
+ rlLogInfo "Deleting LVs"
+ rlRun "$LMI lv delete $LVNAME1 $LVNAME2"
+
+ rlLogInfo "Check that the LVs is deleted"
+ rlRun -s "lvs --noheading -o lv_name"
+ rlAssertNotGrep $LVNAME1 $rlRun_LOG
+ 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"
+ rlAssertNotGrep "\"LMI:/dev/disk/by-id/dm-name-$VGNAME-$LVNAME1\"" $rlRun_LOG
+ rlAssertNotGrep "\"$LVNAME1\"" $rlRun_LOG
+ rlAssertNotGrep "\"$LVSIZE1\"" $rlRun_LOG
+ rlAssertNotGrep "\"LMI:/dev/disk/by-id/dm-name-$VGNAME-$LVNAME2\"" $rlRun_LOG
+ rlAssertNotGrep "\"$LVNAME2\"" $rlRun_LOG
+ 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"
+ rlAssertNotGrep "Logical Volumes.*$LVNAME1" $rlRun_LOG
+ rlAssertNotGrep "Logical Volumes.*$LVNAME2" $rlRun_LOG
+rlPhaseEnd
+
+
+rlPhaseStartTest "DeleteVG"
+ rlLogInfo "Delete the VG"
+ rlRun "$LMI 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"
+ rlAssertNotGrep "\"LMI:VG:$VGNAME\"" $rlRun_LOG
+ rlAssertNotGrep "\"$VGNAME\"" $rlRun_LOG
+ rm $rlRun_LOG
+rlPhaseEnd
+
+rlJournalPrintText
+rlJournalEnd
diff --git a/commands/storage/test/lmi/test_partition_gpt.sh b/commands/storage/test/lmi/test_partition_gpt.sh
new file mode 100644
index 0000000..c869497
--- /dev/null
+++ b/commands/storage/test/lmi/test_partition_gpt.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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 partition' and 'lmi partition-table' test.
+# - create partition table
+# - create few partitions
+# - delete the partitions
+#
+
+. ./base.sh
+
+rlJournalStart
+
+# just the disk name as 'sda', without '/dev/'
+DISKNAME=$( echo $LMI_STORAGE_DISK | sed 's!.*/!!' )
+SIZE1=10M
+SIZE2=20M
+# third partition has the rest of the disk
+
+rlPhaseStartTest "Create the partition table"
+ rlLogInfo "Creating partition table"
+ rlRun "$LMI partition-table create --gpt $LMI_STORAGE_DISK"
+
+ rlLogInfo "Check the partition table exists"
+ rlRun -s "parted $LMI_STORAGE_DISK print"
+ rlAssertGrep "Partition Table: gpt" $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi partition-table list shows it"
+ rlRun -s "$LMI -NHL csv 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"
+ rlAssertGrep "\"Partition Table Type\",\"GPT\"" $rlRun_LOG
+ rlAssertGrep "\"Partition Table Size (in blocks)\",68" $rlRun_LOG
+ rm $rlRun_LOG
+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"
+
+ rlLogInfo "Check lmi partition list shows them"
+ rlRun -s "$LMI -NHL csv 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"
+ 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"
+ 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"
+ rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}3\"" $rlRun_LOG
+ rlAssertGrep "\"ElementName\",\"${DISKNAME}3\"" $rlRun_LOG
+ rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
+ rm $rlRun_LOG
+rlPhaseEnd
+
+rlPhaseStartTest "Delete partitions"
+ rlLogInfo "Deleting partitions"
+ rlRun "$LMI 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"
+ 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
+ rm $rlRun_LOG
+rlPhaseEnd
+
+rlJournalPrintText
+rlJournalEnd
diff --git a/commands/storage/test/lmi/test_partition_msdos.sh b/commands/storage/test/lmi/test_partition_msdos.sh
new file mode 100644
index 0000000..1861717
--- /dev/null
+++ b/commands/storage/test/lmi/test_partition_msdos.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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 partition' and 'lmi partition-table' test.
+# - create partition table
+# - create few partitions
+# - delete the partitions
+#
+
+. ./base.sh
+
+rlJournalStart
+
+# just the disk name as 'sda', without '/dev/'
+DISKNAME=$( echo $LMI_STORAGE_DISK | sed 's!.*/!!' )
+SIZE1=10M # primary one
+SIZE2=20M # first logical
+# third is over rest of the extended partition
+
+rlPhaseStartTest "Create the partition table"
+ rlLogInfo "Creating partition table"
+ rlRun "$LMI 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"
+ 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"
+ rlAssertGrep "\"Partition Table Type\",\"MS-DOS\"" $rlRun_LOG
+ rlAssertGrep "\"Partition Table Size (in blocks)\",1" $rlRun_LOG
+ rm $rlRun_LOG
+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"
+
+ 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"
+ 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
+ rlAssertGrep "\"${LMI_STORAGE_DISK}6\",\"${DISKNAME}6\",\"logical\"," $rlRun_LOG
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi partition show shows them"
+ rlRun -s "$LMI -NHL csv 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"
+ 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"
+ 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"
+ rlAssertGrep "\"Name\",\"${LMI_STORAGE_DISK}6\"" $rlRun_LOG
+ rlAssertGrep "\"ElementName\",\"${DISKNAME}6\"" $rlRun_LOG
+ rlAssertGrep "\"Disk\",\"${LMI_STORAGE_DISK}\"" $rlRun_LOG
+ rlAssertGrep "\"Partition Type\",\"logical\"" $rlRun_LOG
+ rm $rlRun_LOG
+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"
+
+ rlLogInfo "Check lmi partition list does not show them"
+ rlRun -s "$LMI -NHL csv 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
+ rm $rlRun_LOG
+rlPhaseEnd
+
+rlJournalPrintText
+rlJournalEnd
diff --git a/commands/storage/test/lmi/test_raid.sh b/commands/storage/test/lmi/test_raid.sh
new file mode 100644
index 0000000..3afdaae
--- /dev/null
+++ b/commands/storage/test/lmi/test_raid.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+#
+# Copyright (c) 2013, 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 raid'test.
+# - create raid
+# - check that 'lmi raid list + show' shows it
+# - delete the raid
+#
+# - all with various raid levels
+
+. ./base.sh
+
+rlJournalStart
+
+function test_raid() {
+ level=$1
+ name=$2
+ shift 2
+ parts=$@
+
+ rlPhaseStartTest "Create RAID $level: $name on $parts"
+ rlLogInfo "Creating the RAID"
+ rlRun "$LMI raid create --name="$name" $level $parts"
+
+ rlLogInfo "Check that the RAID exists"
+ rlRun "ls -l /dev/md/$name"
+ rlRun -s "mdadm -D /dev/md/$name"
+ for part in $parts; do
+ rlAssertGrep "active.*$part" $rlRun_LOG
+ done
+ rm $rlRun_LOG
+
+ rlLogInfo "Check lmi raid list output"
+ rlRun -s "$LMI -NHL csv 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"
+ rlAssertGrep "\"DeviceID\",\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
+ rlAssertGrep "\"Name\",\"/dev/md/$name\"" $rlRun_LOG
+ rlAssertGrep "\"ElementName\",\"$name\"" $rlRun_LOG
+ rlAssertGrep "\"RAID Level\",$level" $rlRun_LOG
+ for part in $parts; do
+ rlAssertGrep "\"RAID Members.*$part" $rlRun_LOG
+ done
+ rm $rlRun_LOG
+ rlPhaseEnd
+
+ rlPhaseStartTest "Delete RAID $level: $name on $parts"
+ rlLogInfo "deleting the RAID"
+ rlRun "$LMI 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"
+ 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"
+ rlAssertNotGrep "\"DeviceID\",\"/dev/disk/by-id/md-name-.*:$name\"" $rlRun_LOG
+ rlAssertNotGrep "\"Name\",\"/dev/md/$name\"" $rlRun_LOG
+ rlPhaseEnd
+}
+
+# RAID 0, 2 devices
+test_raid 0 raid_0_2 ${PARTITIONS[0]} ${PARTITIONS[1]}
+
+# RAID 0, all devices
+test_raid 0 raid_0_all ${PARTITIONS[*]}
+
+# RAID 1, 2 devices
+test_raid 1 raid_1_2 ${PARTITIONS[0]} ${PARTITIONS[1]}
+
+# RAID 1, all devices
+test_raid 1 raid_1_all ${PARTITIONS[*]}
+
+# RAID 4, all devices
+test_raid 4 raid_4_all ${PARTITIONS[*]}
+
+# RAID 5, all devices
+test_raid 5 raid_5_all ${PARTITIONS[*]}
+
+# RAID 6, all devices
+test_raid 6 raid_6_all ${PARTITIONS[*]}
+
+# RAID 10, all devices
+test_raid 10 raid_10_all ${PARTITIONS[*]}
+
+rlJournalPrintText
+rlJournalEnd