mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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 <talluri@apache.org>
This commit is contained in:
parent
570c3a2130
commit
6f0b57216c
@ -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")
|
||||
|
||||
@ -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"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user