Fixed issues in CLOUDSTACK-6489

Fixed issues for CLOUDSTACK-6489
Along with fixed few indent issues.

Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com>
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
Santhosh Edukulla 2014-04-24 20:16:35 +05:30 committed by SrikanteswaraRao Talluri
parent d1658c4282
commit ef9e2a9367
7 changed files with 66 additions and 42 deletions

View File

@ -34,10 +34,6 @@ from marvin.lib.common import get_zone, get_domain, get_template
from nose.plugins.attrib import attr
"virtual_machine3" : {
"name" : "testvm3",
"displayname" : "Test VM3",
},
class TestDeployVM(cloudstackTestCase):
"""Test deploy a VM into a user account
"""

View File

@ -27,18 +27,6 @@ from nose.plugins.attrib import attr
_multiprocess_shared_ = True
"sparse": {
"name": "Sparse Type Disk offering",
"displaytext": "Sparse Type Disk offering",
"disksize": 1, # in GB
"provisioningtype" : "sparse"
},
"fat": {
"name": "Fat Type Disk offering",
"displaytext": "Fat Type Disk offering",
"disksize": 1, # in GB
"provisioningtype" : "fat"
}
class TestCreateDiskOffering(cloudstackTestCase):
def setUp(self):

View File

@ -35,12 +35,6 @@ import tempfile
_multiprocess_shared_ = True
"sparse_disk_offering": {
"displaytext": "Sparse",
"name": "Sparse",
"provisioningtype": "sparse",
"disksize": 1
},
class TestCreateVolume(cloudstackTestCase):
@classmethod

View File

@ -205,6 +205,10 @@ test_data = {
"name": "testvm2",
"displayname": "Test VM2",
},
"virtual_machine3": {
"name": "testvm3",
"displayname": "Test VM3",
},
"server_without_disk": {
"displayname": "Test VM-No Disk",
"username": "root",
@ -586,5 +590,25 @@ test_data = {
"startip": "10.223.252.196",
"endip": "10.223.252.197",
"vlan": "1001"
},
"sparse": {
"name": "Sparse Type Disk offering",
"displaytext":
"Sparse Type Disk offering",
"disksize": 1, # in GB
"provisioningtype": "sparse"
},
"fat": {
"name": "Fat Type Disk offering",
"displaytext":
"Fat Type Disk offering",
"disksize": 1, # in GB
"provisioningtype": "fat"
},
"sparse_disk_offering": {
"displaytext": "Sparse",
"name": "Sparse",
"provisioningtype": "sparse",
"disksize": 1
}
}

View File

@ -43,7 +43,8 @@ class MarvinInit:
deploy_dc_flag=None,
test_mod_name="deploydc",
zone=None,
hypervisor_type=None):
hypervisor_type=None,
user_logfolder_path=None):
self.__configFile = config_file
self.__deployFlag = deploy_dc_flag
self.__logFolderPath = None
@ -55,6 +56,7 @@ class MarvinInit:
self.__zoneForTests = zone
self.__parsedConfig = None
self.__hypervisorType = hypervisor_type
self.__userLogFolderPath = user_logfolder_path
def __parseConfig(self):
'''
@ -162,7 +164,8 @@ class MarvinInit:
if log_obj:
ret = log_obj.\
createLogs(self.__testModName,
self.__parsedConfig.logger)
self.__parsedConfig.logger,
self.__userLogFolderPath)
if ret != FAILED:
self.__logFolderPath = log_obj.getLogFolderPath()
self.__tcRunLogger = log_obj.getLogger()

View File

@ -127,7 +127,8 @@ class MarvinLog:
def createLogs(self,
test_module_name=None,
log_cfg=None):
log_cfg=None,
user_provided_logpath=None):
'''
@Name : createLogs
@Desc : Gets the Logger with file paths initialized and created
@ -135,6 +136,10 @@ class MarvinLog:
creating log folder path
log_cfg: Log Configuration provided inside of
Configuration
user_provided_logpath:LogPath provided by user
If user provided log path
is available, then one in cfg
will not be picked up.
@Output : SUCCESS\FAILED
'''
try:
@ -146,8 +151,9 @@ class MarvinLog:
temp_path = str(test_module_name) + \
"__" + str(temp_ts) + "_" + random_gen()
temp_dir = "MarvinLogs"
if ((log_cfg is not None) and
if user_provided_logpath:
temp_dir = user_provided_logpath
elif ((log_cfg is not None) and
('LogFolderPath' in log_cfg.__dict__.keys()) and
(log_cfg.__dict__.get('LogFolderPath') is not None)):
temp_dir = \

View File

@ -64,6 +64,10 @@ class MarvinPlugin(Plugin):
self.__tcRunLogger = None
self.__testModName = ''
self.__hypervisorType = None
'''
The Log Path provided by user where all logs are routed to
'''
self.__userLogPath = None
Plugin.__init__(self)
def configure(self, options, conf):
@ -81,6 +85,7 @@ class MarvinPlugin(Plugin):
self.__deployDcFlag = options.deployDc
self.__zoneForTests = options.zone
self.__hypervisorType = options.hypervisor_type
self.__userLogPath = options.logFolder
self.conf = conf
if self.startMarvin() == FAILED:
print "\nStarting Marvin Failed, exiting. Please Check"
@ -112,6 +117,12 @@ class MarvinPlugin(Plugin):
dest="hypervisor_type",
help="Runs all tests against the specified "
"zone and hypervisor Type")
parser.add_option("--log-folder-path", action="store",
default=None,
dest="logFolder",
help="Collects all logs under the user specified"
"folder"
)
Plugin.options(self, parser, env)
def wantClass(self, cls):
@ -221,7 +232,8 @@ class MarvinPlugin(Plugin):
self.__deployDcFlag,
None,
self.__zoneForTests,
self.__hypervisorType)
self.__hypervisorType,
self.__userLogPath)
if obj_marvininit and obj_marvininit.init() == SUCCESS:
self.__testClient = obj_marvininit.getTestClient()
self.__tcRunLogger = obj_marvininit.getLogger()
@ -275,20 +287,21 @@ class MarvinPlugin(Plugin):
def finalize(self, result):
try:
src = self.__logFolderPath
log_cfg = self.__parsedConfig.logger
tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
dst = tmp + "//" + random_gen()
mod_name = "test_suite"
if self.__testModName:
mod_name = self.__testModName.split(".")
if len(mod_name) > 2:
mod_name = mod_name[-2]
if mod_name:
dst = tmp + "/" + mod_name + "_" + random_gen()
cmd = "mv " + src + " " + dst
os.system(cmd)
print "===final results are now copied to: %s===" % str(dst)
if not self.__userLogPath:
src = self.__logFolderPath
log_cfg = self.__parsedConfig.logger
tmp = log_cfg.__dict__.get('LogFolderPath') + "/MarvinLogs"
dst = tmp + "//" + random_gen()
mod_name = "test_suite"
if self.__testModName:
mod_name = self.__testModName.split(".")
if len(mod_name) > 2:
mod_name = mod_name[-2]
if mod_name:
dst = tmp + "/" + mod_name + "_" + random_gen()
cmd = "mv " + src + " " + dst
os.system(cmd)
print "===final results are now copied to: %s===" % str(dst)
except Exception, e:
print "=== Exception occurred under finalize :%s ===" % \
str(GetDetailExceptionInfo(e))