Skip to content

Commit

Permalink
Merge pull request canonical#61 from roosterfish/powerflex_tests
Browse files Browse the repository at this point in the history
Adapt VM storage tests to support Dell PowerFlex
  • Loading branch information
tomponline authored Feb 8, 2024
2 parents 72bb3aa + 474282e commit 998d1c5
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 27 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ Or to run individual tests (`tests/pylxd` against `latest/edge`):
./bin/openstack-run jammy default tests/pylxd latest/edge
```

# Running Dell PowerFlex VM storage tests

To run the VM storage tests on the Dell PowerFlex driver, provide the following environment variables:

* `POWERFLEX_POOL`: Name of the PowerFlex storage pool
* `POWERFLEX_DOMAIN`: Name of the PowerFlex domain
* `POWERFLEX_GATEWAY`: Address of the PowerFlex HTTP gateway
* `POWERFLEX_GATEWAY_VERIFY`: Whether to verify the HTTP gateway's certificate. The default is `true`.
* `POWERFLEX_USER`: Name of the PowerFlex user
* `POWERFLEX_PASSWORD`: Password of the PowerFlex user

# Infrastructure managed by IS

The PS6 environment has inbound and outbound firewalling applied at the network edge. In order to access some external sites here are the firewall rules we added to firewall maintained by IS:
Expand Down
11 changes: 11 additions & 0 deletions bin/helpers
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ runsMinimumKernel() (
return 0
)

# createPowerFlexPool: creates a new storage pool using the PowerFlex driver.
createPowerFlexPool() (
lxc storage create "${1}" powerflex \
powerflex.pool="${POWERFLEX_POOL}" \
powerflex.domain="${POWERFLEX_DOMAIN}" \
powerflex.gateway="${POWERFLEX_GATEWAY}" \
powerflex.gateway.verify="${POWERFLEX_GATEWAY_VERIFY:-true}" \
powerflex.user.name="${POWERFLEX_USER}" \
powerflex.user.password="${POWERFLEX_PASSWORD}"
)

# cleanup: report if the test passed or not and return the appropriate return code.
cleanup() {
set +e
Expand Down
128 changes: 103 additions & 25 deletions tests/storage-vm
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ do
lxc storage create "${poolName}" "${poolDriver}" size=60GiB lvm.use_thinpool=false
elif [ "${poolDriver}" = "lvm-thin" ]; then
lxc storage create "${poolName}" lvm size=20GiB
elif [ "${poolDriver}" = "powerflex" ]; then
createPowerFlexPool "${poolName}"
else
lxc storage create "${poolName}" "${poolDriver}" size=20GiB
fi

echo "==> Create VM and boot with small root"
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v1 --vm -s "${poolName}" -d root,size=4GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v1 --vm -s "${poolName}" -d root,size=4GiB
else
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v1 --vm -s "${poolName}" -d root,size=8GiB
fi
lxc start v1
waitInstanceReady v1
lxc info v1
Expand All @@ -57,8 +63,13 @@ do
! lxc exec v1 -- touch /srv/lxd-test || false
lxc exec v1 -- umount /srv

echo "==> Checking VM root disk size is 4GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "4" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking VM root disk size is 4GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "4" ]
else
echo "==> Checking VM root disk size is 8GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "8" ]
fi

echo "foo" | lxc exec v1 -- tee /root/foo.txt
lxc exec v1 -- sync
Expand Down Expand Up @@ -89,8 +100,13 @@ do
waitInstanceReady v2
lxc exec v2 -- cat /root/foo.txt | grep -Fx "foo"

echo "==> Checking VM snapshot copy root disk size is 4GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "4" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking VM snapshot copy root disk size is 4GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "4" ]
else
echo "==> Checking VM snapshot copy root disk size is 8GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "8" ]
fi
lxc delete -f v2
lxc delete v1/snap0

Expand Down Expand Up @@ -129,14 +145,23 @@ do
waitInstanceReady v1

echo "==> Increasing VM root disk size for next boot"
lxc config device set v1 root size=11GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc config device set v1 root size=11GiB
else
lxc config device set v1 root size=16GiB
fi
lxc config get v1 volatile.root.apply_quota | grep true
lxc stop -f v1
lxc start v1
waitInstanceReady v1

echo "==> Checking VM root disk size is 11GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking VM root disk size is 11GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
else
echo "==> Checking VM root disk size is 16GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "16" ]
fi

echo "==> Check VM shrink is blocked"
! lxc config device set v1 root size=10GiB || false
Expand Down Expand Up @@ -225,7 +250,11 @@ do
waitInstanceReady v1

# Hotplug disks
lxc storage volume create "${poolName}" vol1 --type=block size=10MB
if [ "${poolDriver}" != "powerflex" ]; then
lxc storage volume create "${poolName}" vol1 --type=block size=10MB
else
lxc storage volume create "${poolName}" vol1 --type=block size=8GiB
fi
lxc storage volume attach "${poolName}" vol1 v1
sleep 3
lxc exec v1 -- stat -c "%F" /dev/sdb | grep "block special file"
Expand Down Expand Up @@ -262,14 +291,24 @@ do
lxc delete -f v1

echo "==> Change volume.size on pool and create VM"
lxc storage set "${poolName}" volume.size 6GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc storage set "${poolName}" volume.size 6GiB
else
# Set to something else than the default of 8GiB.
lxc storage set "${poolName}" volume.size 16GiB
fi
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v1 --vm -s "${poolName}"
lxc start v1
waitInstanceReady v1
lxc info v1

echo "==> Checking VM root disk size is 6GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "6" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking VM root disk size is 6GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "6" ]
else
echo "==> Checking VM root disk size is 16GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "16" ]
fi

echo "==> Deleting VM and reset pool volume.size"
lxc delete -f v1
Expand All @@ -294,14 +333,23 @@ do

echo "==> Create VM from profile with small disk size"
lxc profile copy default vmsmall
lxc profile device add vmsmall root disk pool="${poolName}" path=/ size=3GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc profile device add vmsmall root disk pool="${poolName}" path=/ size=3GiB
else
lxc profile device add vmsmall root disk pool="${poolName}" path=/ size=8GiB
fi
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v1 --vm -p vmsmall
lxc start v1
waitInstanceReady v1
lxc info v1

echo "==> Checking VM root disk size is 3GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking VM root disk size is 3GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
else
echo "==> Checking VM root disk size is 8GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "8" ]
fi
lxc stop -f v1

echo "==> Copy to different storage pool with same driver and check size"
Expand All @@ -311,6 +359,8 @@ do
lxc storage create "${poolName}2" "${poolDriver}" size=40GiB lvm.use_thinpool=false
elif [ "${poolDriver}" = "lvm-thin" ]; then
lxc storage create "${poolName}2" lvm size=20GiB
elif [ "${poolDriver}" = "powerflex" ]; then
createPowerFlexPool "${poolName}2"
else
lxc storage create "${poolName}2" "${poolDriver}" size=20GiB
fi
Expand All @@ -320,8 +370,13 @@ do
waitInstanceReady v2
lxc info v2

echo "==> Checking copied VM root disk size is 3GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking copied VM root disk size is 3GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
else
echo "==> Checking copied VM root disk size is 8GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "8" ]
fi
lxc delete -f v2
lxc storage delete "${poolName}2"

Expand All @@ -337,19 +392,33 @@ do
waitInstanceReady v2
lxc info v2

echo "==> Checking copied VM root disk size is 3GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking copied VM root disk size is 3GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "3" ]
else
echo "==> Checking copied VM root disk size is 8GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "8" ]
fi
lxc delete -f v2

echo "==> Grow above default volume size and copy to different storage pool"
lxc config device override v1 root size=11GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc config device override v1 root size=11GiB
else
lxc config device override v1 root size=16GiB
fi
lxc copy v1 v2 -s "${poolName}2"
lxc start v2
waitInstanceReady v2
lxc info v2

echo "==> Checking copied VM root disk size is 11GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking copied VM root disk size is 11GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
else
echo "==> Checking copied VM root disk size is 16GiB"
[ "$(($(lxc exec v2 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "16" ]
fi
lxc delete -f v2
lxc storage delete "${poolName}2"

Expand All @@ -360,7 +429,11 @@ do
lxc stop -f v1
lxc publish v1 --alias vmbig
lxc delete -f v1
lxc storage set "${poolName}" volume.size 9GiB
if [ "${poolDriver}" != "powerflex" ]; then
lxc storage set "${poolName}" volume.size 9GiB
else
lxc storage set "${poolName}" volume.size 8GiB
fi

echo "==> Check VM create fails when image larger than volume.size"
! lxc init vmbig v1 --vm -s "${poolName}" || false
Expand All @@ -372,8 +445,13 @@ do
waitInstanceReady v1
lxc info v1

echo "==> Checking new VM root disk size is 11GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
if [ "${poolDriver}" != "powerflex" ]; then
echo "==> Checking new VM root disk size is 11GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "11" ]
else
echo "==> Checking new VM root disk size is 16GiB"
[ "$(($(lxc exec v1 -- blockdev --getsize64 /dev/sda) / GiB))" -eq "16" ]
fi

echo "===> Renaming VM"
lxc stop -f v1
Expand Down
14 changes: 12 additions & 2 deletions tests/storage-volumes-vm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ do
lxc storage create "${poolName}" "${poolDriver}" size=40GiB lvm.use_thinpool=false volume.size=5GB
elif [ "${poolDriver}" = "lvm-thin" ]; then
lxc storage create "${poolName}" lvm size=20GiB volume.size=5GB
elif [ "${poolDriver}" = "powerflex" ]; then
createPowerFlexPool "${poolName}"
else
lxc storage create "${poolName}" "${poolDriver}" size=20GB volume.size=5GB
fi
Expand All @@ -39,11 +41,19 @@ do
lxc init "${TEST_IMG:-ubuntu-minimal-daily:22.04}" v2 --vm -s "${poolName}"

echo "==> Create custom block volume and attach it to VM"
lxc storage volume create "${poolName}" vol1 --type=block size=10MB
if [ "${poolDriver}" != "powerflex" ]; then
lxc storage volume create "${poolName}" vol1 --type=block size=10MB
else
lxc storage volume create "${poolName}" vol1 --type=block size=8GiB
fi
lxc storage volume attach "${poolName}" vol1 v1

echo "==> Create custom volume and attach it to VM"
lxc storage volume create "${poolName}" vol4 size=10MB
if [ "${poolDriver}" != "powerflex" ]; then
lxc storage volume create "${poolName}" vol4 size=10MB
else
lxc storage volume create "${poolName}" vol4 size=8GiB
fi
lxc storage volume attach "${poolName}" vol4 v1 /foo

echo "==> Start VM and add content to custom block volume"
Expand Down

0 comments on commit 998d1c5

Please sign in to comment.