Repository: cloudstack
Updated Branches:
  refs/heads/master 570c3a213 -> 6f0b57216


Fix for Marvin utils.py:checkVolumeSize Fix for test_01_create_volume to use 
the correct volume name for XenServer

Signed-off-by: SrikanteswaraRao Talluri <tall...@apache.org>


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

Branch: refs/heads/master
Commit: 6f0b57216cd1b0ee79687fa98f1f4970984b805e
Parents: 570c3a2
Author: Doug Clark <doug.cl...@citrix.com>
Authored: Wed May 21 12:06:45 2014 +0000
Committer: SrikanteswaraRao Talluri <tall...@apache.org>
Committed: Thu May 22 11:12:37 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_volumes.py | 13 +++++++++++--
 tools/marvin/marvin/lib/utils.py       |  5 ++---
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f0b5721/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py 
b/test/integration/smoke/test_volumes.py
index a151df9..e2539b8 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -33,7 +33,7 @@ from marvin.lib.common import (get_domain,
                                 get_zone,
                                 get_template)
 from marvin.lib.utils import checkVolumeSize
-from marvin.codes import SUCCESS, FAILED, ERROR_CODE_530
+from marvin.codes import SUCCESS, FAILED, ERROR_CODE_530, XEN_SERVER
 from nose.plugins.attrib import attr
 #Import System modules
 import os
@@ -213,7 +213,16 @@ class TestCreateVolume(cloudstackTestCase):
             ssh = self.virtual_machine.get_ssh_client(
                                                       reconnect=True
                                                       )
-            ret = checkVolumeSize(ssh_handle=ssh,size_to_verify=vol_sz)
+            # Get the updated volume information
+            list_volume_response = Volume.list(
+                                               self.apiClient,
+                                               id=volume.id)
+            if list_volume_response[0].hypervisor.lower() == 
XEN_SERVER.lower():
+                volume_name = "/dev/xvd" + chr(ord('a') + 
int(list_volume_response[0].deviceid))
+                self.debug(" Using XenServer volume_name: %s" % (volume_name))
+                ret = 
checkVolumeSize(ssh_handle=ssh,volume_name=volume_name,size_to_verify=vol_sz)
+            else:
+                ret = checkVolumeSize(ssh_handle=ssh,size_to_verify=vol_sz)
             self.debug(" Volume Size Expected %s  Actual :%s" %(vol_sz,ret[1]))
             self.virtual_machine.detach_volume(self.apiClient, volume)
             self.assertEqual(ret[0],SUCCESS,"Check if promised disk size 
actually available")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f0b5721/tools/marvin/marvin/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index cb5dcfb..b095911 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -460,10 +460,9 @@ def checkVolumeSize(ssh_handle=None,
             fdisk_output = ssh_handle.runCommand(cmd_inp)
             if fdisk_output["status"] != SUCCESS:
                 return FAILED
-            temp_out = fdisk_output["stdout"]
-            for line in temp_out.split("\n"):
+            for line in fdisk_output["stdout"]:
                 if volume_name in line:
-                    parts = line.split()
+                    parts = line.strip().split()
                     if str(parts[-2]) == str(size_to_verify):
                         return [SUCCESS,str(parts[-2])]
             return [FAILED,"Volume Not Found"]

Reply via email to