The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6151

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
- Adds basic quota checks for zfs and lvm (dir, ceph and btrfs not supported)

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From c8c99a261775ea8e9b7406ef4b005568114291f5 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Thu, 5 Sep 2019 11:36:10 +0100
Subject: [PATCH] test: Adds storage quota tests

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 test/suites/storage.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/suites/storage.sh b/test/suites/storage.sh
index 5a3e43a081..64b91df65a 100644
--- a/test/suites/storage.sh
+++ b/test/suites/storage.sh
@@ -761,10 +761,20 @@ test_storage() {
 
   # Test applying quota
   QUOTA1="10GB"
+  rootMinKB1="9767000"
+  rootMaxKB1="9999999"
+
   QUOTA2="11GB"
+  rootMinKB2="10744000"
+  rootMaxKB2="10744999"
+
   if [ "$lxd_backend" = "lvm" ]; then
     QUOTA1="20MB"
+    rootMinKB1="17000"
+    rootMaxKB1="20000"
     QUOTA2="21MB"
+    rootMinKB2="21000"
+    rootMaxKB2="23000"
   fi
 
   if [ "$lxd_backend" != "dir" ] && [ "$lxd_backend" != "ceph" ]; then
@@ -773,6 +783,14 @@ test_storage() {
     lxc stop -f quota1
     lxc start quota1
 
+    if [ "$lxd_backend" != "btrfs" ]; then
+    rootSizeKB=$(lxc exec quota1 -- df -P / | tail -n1 | awk '{print $2}')
+      if [ "$rootSizeKB" -gt "$rootMaxKB1" ] || [ "$rootSizeKB" -lt 
"$rootMinKB1" ] ; then
+        echo "root size not within quota range"
+        false
+      fi
+    fi
+
     lxc launch testimage quota2
     lxc stop -f quota2
     lxc start quota2
@@ -787,6 +805,13 @@ test_storage() {
 
     lxc stop -f quota2
     lxc start quota2
+    if [ "$lxd_backend" != "btrfs" ]; then
+      rootSizeKB=$(lxc exec quota2 -- df -P / | tail -n1 | awk '{print $2}')
+      if [ "$rootSizeKB" -gt "$rootMaxKB2" ] || [ "$rootSizeKB" -lt 
"$rootMinKB2" ] ; then
+        echo "root size not within quota range"
+        false
+      fi
+    fi
 
     lxc stop -f quota3
     lxc start quota3
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to