cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [3/3] git commit: updated refs/heads/resize-root to 4a21da6
Date Sat, 08 Mar 2014 00:21:01 GMT
resizeVolume: add a few root resize integration tests


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4a21da6b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4a21da6b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4a21da6b

Branch: refs/heads/resize-root
Commit: 4a21da6b79f92363b232772cc92bf13029305a32
Parents: 6fc75a9
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Mon Feb 10 02:48:49 2014 -0700
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Mon Feb 10 02:48:49 2014 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  |  6 ++
 test/integration/smoke/test_volumes.py          | 69 +++++++++++++++++++-
 .../devcloud-kvm-advanced-fusion.cfg            | 13 +---
 3 files changed, 77 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a21da6b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 1056bcf..4193be2 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -1773,6 +1773,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
         boolean shrinkOk = cmd.getShrinkOk();
         StorageFilerTO spool = cmd.getPool();
 
+        if ( currentSize == newSize) {
+            // nothing to do
+            s_logger.info("No need to resize volume: current size " + currentSize + " is
same as new size " + newSize);
+            return new ResizeVolumeAnswer(cmd, true, "success", currentSize);
+        }
+
         try {
             KVMStoragePool pool = _storagePoolMgr.getStoragePool(spool.getType(), spool.getUuid());
             KVMPhysicalDisk vol = pool.getPhysicalDisk(volid);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a21da6b/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 8f41803..719c824 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -571,6 +571,31 @@ class TestVolumes(cloudstackTestCase):
                 success,
                 True,
                 "ResizeVolume - verify disk offering is handled appropriately")
+
+        # try to resize a root disk with a disk offering, root can only be resized by size=
+        # get root vol from created vm
+        list_volume_response = list_volumes(
+                                            self.apiClient,
+                                            virtualmachineid=self.virtual_machine.id,
+                                            type='ROOT',
+                                            listall=True
+                                            )
+
+        rootvolume = list_volume_response[0]
+
+        cmd.id             = rootvolume.id
+        cmd.diskofferingid = self.services['diskofferingid']
+        success            = False
+        try:
+            response = self.apiClient.resizeVolume(cmd)
+        except Exception as ex:
+            if "Can only resize Data volumes" in str(ex):
+                success = True
+        self.assertEqual(
+                success,
+                True,
+                "ResizeVolume - verify root disks cannot be resized by disk offering id")
+            
         # Ok, now let's try and resize a volume that is not custom.
         cmd.id             = self.volume.id
         cmd.diskofferingid = self.services['diskofferingid']
@@ -647,6 +672,7 @@ class TestVolumes(cloudstackTestCase):
         elif hosts[0].hypervisor.lower() == "vmware":
             self.skipTest("Resize Volume is unsupported on VmWare")
 
+        # resize the data disk
         self.debug("Resize Volume ID: %s" % self.volume.id)
 
         cmd                = resizeVolume.resizeVolumeCmd()
@@ -675,7 +701,48 @@ class TestVolumes(cloudstackTestCase):
         self.assertEqual(
                          success,
                          True,
-                         "Check if the volume resized appropriately"
+                         "Check if the data volume resized appropriately"
+                         )
+
+        # resize the root disk
+        self.debug("Resize Root for : %s" % self.virtual_machine.id)
+
+        # get root vol from created vm
+        list_volume_response = list_volumes(
+                                            self.apiClient,
+                                            virtualmachineid=self.virtual_machine.id,
+                                            type='ROOT',
+                                            listall=True
+                                            )
+
+        rootvolume = list_volume_response[0]
+
+        cmd                = resizeVolume.resizeVolumeCmd()
+        cmd.id             = rootvolume.id
+        cmd.size           = 10
+
+        self.apiClient.resizeVolume(cmd)
+
+        count = 0
+        success = False
+        while count < 3:
+            list_volume_response = list_volumes(
+                                                self.apiClient,
+                                                id=rootvolume.id
+                                                )
+            for vol in list_volume_response:
+                if vol.id == rootvolume.id and vol.size == 10737418240L and vol.state ==
'Ready':
+                    success = True
+            if success:
+                break
+            else:
+                time.sleep(10)
+                count += 1
+
+        self.assertEqual(
+                         success,
+                         True,
+                         "Check if the root volume resized appropriately"
                          )
 
         #start the vm if it is on xenserver

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a21da6b/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg
----------------------------------------------------------------------
diff --git a/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg b/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg
index 53e1a44..d2e8c7b 100644
--- a/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg
+++ b/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg
@@ -120,16 +120,9 @@
         "port": 3306, 
         "user": "cloud"
     }, 
-    "logger": [
-        {
-            "name": "TestClient", 
-            "file": "/var/log/testclient.log"
-        }, 
-        {
-            "name": "TestCase", 
-            "file": "/var/log/testcase.log"
-        }
-    ], 
+    "logger": {
+        "LogFolderPath": "/tmp/"
+    },
     "mgtSvr": [
         {
             "mgtSvrIp": "172.17.10.10", 


Mime
View raw message