def verify_getDiskAllocatedToISCSI(result, mountpoint): startTime = ctime() if result[0] == 'PASSED' and mountpoint in str(result[1]): logging.debug('iscsi logged device... %s', result[1][mountpoint]) return result[1][mountpoint] endTime = ctime() msg = 'Not able to get iscsi logged device' logAndresult(testcase, 'BLOCKED', msg, startTime, endTime)
def verify_vdbench_during_prop_edit(volname): logging.info('Sleeping for 10s....') time.sleep(10) #waiting 10s before editing other properties logging.info('Checking whether vdbench is still running or not....') check_vdbench = is_vdbench_alive(volname) if not check_vdbench: endTime = ctime() msg = 'Vdbench has stopped running after editing lun attributes' logAndresult(testcase, 'FAILED', msg, startTime, endTime)
def verify_iscsi_operation(result, vol_name, action): if result[0] == 'PASSED': logging.debug('%s successfully for iSCSI LUN %s', action, vol_name) return if 'already exists' in str(result[1]): logging.debug('iscsi LUN %s is already loged in, lets go ahead and' \ 'get the iscsi device name', vol_name) return endTime = ctime() logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime)
def nfsShareMount(volume): ### Mounting NFS shares logging.info("Mounting NFS Shares '%s'", volume['name']) nfsMount = mountNFS(volume) if nfsMount == 'PASSED': logging.info('Mounted Nfs Share "%s" successfully', volume['name']) else: endTime = ctime() msg = 'failed to mount NFS share "%s"' % volume['name'] logAndresult(testcase, 'FAILED', msg, startTime, endTime)
def nfsShareUnmount(volume): ### Unmounting NFS shares logging.info('Unmounting NFS shares "%s"', volume['name']) nfsUnmount = umountVolume(volume) if nfsUnmount == 'PASSED': logging.info('NFS share "%s" unmounted successfully', volume['name']) else: endTime = ctime() msg = 'failed to Unmount NFS share "%s"' % volume['name'] logAndresult(testcase, 'FAILED', msg, startTime, endTime)
def file_compare(firstFile, secondFile, prptName): logging.info('Comparing QOS result files...') qos_output = executeCmdNegative('diff %s %s' % (firstFile, secondFile)) logging.debug('compared result is %s', (qos_output)) if qos_output[0] == 'FAILED': msg = 'Qos values are same after updating "%s"' % prptName endTime = ctime() logAndresult(testcase, 'FAILED', msg, startTime, endTime) elif qos_output[0] == 'PASSED': msg = 'Qos values are different after updating "%s"' % prptName logging.debug('%s', msg) else: logging.error('Failed to compare files having qos values') print "problem in comparing files"
def file_compare(file1, file2, state): logging.info('Comparing Iops result files...') cmp_output = executeCmdNegative('diff %s %s' %(file1, file2)) logging.debug('compared result is %s', (cmp_output)) endTime = ctime() if cmp_output[0] == 'FAILED': msg = 'IOPs are not running %s adding clients to exports' %state logAndresult(testcase, 'FAILED', msg, startTime, endTime) elif cmp_output[0] == 'PASSED': msg = 'IOPs are running fine %s adding clients to exports' %(state) logging.debug('%s', msg) else: logging.error('Failed to compare files having IOPS values') print "problem in comparing files"
def addVol_client_Mount(vol, stdurl, tsmID, tsmName, ClientIP): startTime = ctime() result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result[1] logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime) else: print "Volume '%s' created successfully" % (vol['name']) startTime = ctime() logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsmName) volList = listVolumeWithTSMId_new(stdurl, tsmID) if volList[0] == 'PASSED': logging.info('Volumes present in the TSM "%s"', tsmName) else: endTime = ctime() print 'Not able to list Volumes in TSM "%s" due to: ' \ %(tsmName) + volList[1] logAndresult(testcase, 'BLOCKED', volList[1], startTime, endTime) volume_name = vol['name'] get_volInfo = get_volume_info(volList[1], volume_name) volname, volid, vol_mntPoint = get_volInfo[1], get_volInfo[2], get_volInfo[ 3] logging.debug('volname: %s, volid: %s, vol_mntPoint: %s',\ volname, volid, vol_mntPoint) startTime = ctime() addClient = addNFSclient(stdurl, volid, ClientIP) if addClient[0] == 'PASSED': print 'Added NFS client "%s" to volume "%s"' % (ClientIP, volname) logging.info('Added NFS client "%s" to volume "%s"', \ ClientIP, volname) else: endTime = ctime() logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime) volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\ 'name' : volname} startTime = ctime() logging.info("Mounting NFS Share '%s'", volname) nfsMount = mountNFS(volume) if nfsMount == 'PASSED': logging.info('Mounted Nfs Share "%s" successfully', volume['name']) else: endTime = ctime() msg = 'failed to mount NFS share "%s"' % volume['name'] logAndresult(testcase, 'FAILED', msg, startTime, endTime) return [volume, volid]
def space_increase_nfs(stdurl, tsmID): startTime = ctime() volList = listVolumeWithTSMId_new(stdurl, tsmID) endTime = ctime() if volList[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', volList[1], startTime, endTime) get_volInfo = get_volume_info(volList[1], volname) vol_quota = get_volInfo[6] logging.debug('volume size is: %s', vol_quota) logging.info('Increasing space of NFS volume') vol_quota1 = vol_quota.strip('G') quota = int(vol_quota1) + 2 quota = '%sG' % quota quota1 = quota.rstrip('G') edit_quota = edit_vol_quota(volid, quota, stdurl) if edit_quota[0] == 'FAILED': logAndresult(tcName, 'FAILED', edit_quota[1], startTime, endTime) logging.debug('Successfully updated quota of volume "%s" from %s to %s'\ ,volname, vol_quota, quota) time.sleep(5) logging.info('verifying quota update of client side') mountDetails1 = mountPointDetails('-h', mount_point) size = mountDetails1[1].strip('G') if float(size) == float(quota1): logging.debug('Quota on client after size update is : %sG', size) logging.debug('Quota of Nfs share has been updated on client side') else: endTime = ctime() msg = 'Size is not updated on client side, current size is : %s' % size logAndresult(tcName, 'FAILED', msg, startTime, endTime)
def space_increase_iscsi(stdurl, tsmID, tsmIP, volname, volid, vol_iqn, vol_mntPoint): startTime = ctime() logout_result = iscsi_login_logout(vol_iqn, tsmIP, 'logout') if logout_result[0] == 'FAILED': logging.error('%s', logout_result[1]) logging.debug('%s', logout_result[1]) volList = listVolumeWithTSMId_new(stdurl, tsmID) endTime = ctime() if volList[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', volList[1], startTime, endTime) get_volInfo = get_volume_info(volList[1], volname) vol_quota = get_volInfo[6] logging.debug('volume size is: %s', vol_quota) logging.info('Increasing space of Iscsi volume') vol_quota1 = vol_quota.strip('G') quota = int(vol_quota1) + 2 quota = '%sG' % quota quota1 = quota.rstrip('G') edit_quota = edit_vol_quota(volid, quota, stdurl) if edit_quota[0] == 'FAILED': logAndresult(tcName, 'FAILED', edit_quota[1], startTime, endTime) logging.debug('Successfully updated quota of volume "%s" from %s to %s'\ ,volname, vol_quota, quota) get_quota = iscsi_get_quota(tsmIP, vol_iqn, vol_mntPoint) endTime = ctime() if get_quota[0] == 'FAILED': logginig.error('After editting quota: %s', get_quota[1]) logAndresult(tcName, 'BLOCKED', volList[1], startTime, endTime) quota2 = get_quota[1] quota3 = '%sG' % quota2 logging.debug('Size of lun after quota update on client : %s', quota3) if float(quota2) == float(quota1): logging.debug('Quota of iSCSI has been updated on client side ') else: msg = 'Size is not updated on client side, current size is : %s' % size logAndresult(tcName, 'FAILED', msg, startTime, endTime)
logging.info('----Start of testcase "%s"----', testcase) if len(sys.argv) < 2: print "Argument are not correct, Please provide as follows" print "python provision_deprovision_nfs_iscsi.py conf.txt " logging.debug('----Ending script because of parameter mismatch----') exit() config = configFile(sys.argv) api_key = get_apikey(config) stdurl = get_url(config, api_key[1]) startTime = ctime() verify_tsmIP = verify_tsmIP_from_configFile(config, stdurl) endTime = ctime() if verify_tsmIP[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', verify_tsmIP[1], startTime, endTime) tsmIP = verify_tsmIP[1] tsmInterface = verify_tsmIP[2] #----------create pool--------------- startTime = ctime() poolName = 'nPoolPD' pool_create = pool_creation_flow(stdurl, poolName, 2, 'SAS', 'mirror') endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('%s', pool_create[1]) #------------------------------------ #----------create tsm--------------------- startTime = ctime()
startTime = ctime() infile = '/etc/default/useradd' HOME = getoutput('cat /etc/default/useradd | grep HOME | cut -d "=" -f 2') HOME = HOME[0].rstrip('\n') usr1 = 'user1' pwd = 'test123' usr2 = 'user2' list_tsm = listTSMWithIP_new(stdurl, tsm_ip) if list_tsm[0] == 'PASSED': logging.info('Tsm present with the given IP "%s"', tsm_ip) else: endTime = ctime() print 'Not able to list list_tsms due to: ' + list_tsm[1] logAndresult(testcase, 'BLOCKED', list_tsm[1], startTime, endTime) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(list_tsm[1]) tsm_id = get_tsmInfo[0] tsm_name = get_tsmInfo[1] dataset_id = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id) vol = {'name': 'NFSHome', 'tsmid': tsm_id, 'datasetid': dataset_id, \ 'protocoltype': 'NFS', 'iops': 500} result = create_volume(vol, stdurl) if result[0] == 'PASSED': print "Volume '%s' created successfully" % (vol['name'])
logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) logging.info('Getting account Name and ID') accountName = tsmList[1][0].get('accountname') account_id = tsmList[1][0].get('accountid') logging.debug('account_Name: %s, account_id: %s', accountName, account_id) #------------------------------------------------------------------------ #------------Volume details------------------- vol = {'name': 'iscsiAuto', 'tsmid': tsmID, 'datasetid': datasetID, \ 'protocoltype': 'ISCSI', 'iops': 400} result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime)
#listing tsm and getting required details startTime = ctime() list_tsm = listTSMWithIP_new(stdurl, tsmIP) if 'PASSED' in list_tsm: logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(list_tsm[1]) tsm_id = get_tsmInfo[0] tsm_name = get_tsmInfo[1] dataset_id = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id) else: endTime = ctime() print list_tsm[1] logAndresult(testcase, 'BLOCKED', list_tsm[1], startTime, endTime) ## creating volume and getting required details vol = {'name': 'nfsVolInUse', 'tsmid': tsm_id, 'datasetid': dataset_id, \ 'protocoltype': 'NFS', 'iops': 100} startTime = ctime() result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result[1] logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime) else: print "Volume '%s' created successfully" %(vol['name']) startTime = ctime() logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsm_name)
conf = configFile(sys.argv) apikey = get_apikey(conf) stdurl = get_url(conf, apikey[1]) tsmIP = conf['ipVSM2'] startTime = ctime() logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) path = tsmList[1][0]['storageBuckets'][0]['path'] volume = {'name': 'iscsiVolcreate', 'tsmid': tsmID, 'datasetid': datasetID, \ 'protocoltype': 'ISCSI', 'iops': 123, 'compression': 'on', \ 'recordsize': '64k', 'latency': 25} startTime = ctime() result = create_volume(volume, stdurl)
logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) vol1 = {'name': 'nfsDataset1', 'tsmid': tsmID, \ 'datasetid': datasetID, 'protocoltype': 'NFS', 'iops': 200} #creating volume and mouting the same final_result1 = addVol_client_Mount(vol1, stdurl, tsmID, tsmName, ClientIP) #running vdbench on the first volume logging.info('Running vdbench by using file') exe1 = executeVdbenchFile(final_result1[0], VdbFile) logging.info('waiting for 30s for vdbench to run on first dataset') time.sleep(30) check_vdbench1 = is_vdbench_alive(vol1['name'])
#listing tsm and getting required details startTime = ctime() list_tsm = listTSMWithIP_new(stdurl, tsmIP) if list_tsm[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(list_tsm[1]) tsm_id = get_tsmInfo[0] tsm_name = get_tsmInfo[1] dataset_id = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id) else: endTime = ctime() print list_tsm[1] logAndresult(testcase, 'BLOCKED', list_tsm[1], startTime, endTime) ## Creating volume and getting required details vol = {'name': 'NfsVolInfo', 'tsmid': tsm_id, 'datasetid': dataset_id, \ 'protocoltype': 'NFS', 'iops': 100} startTime = ctime() result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime) else: print "Volume '%s' created successfully" % (vol['name']) startTime = ctime() logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsm_name)
logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) logging.info('Getting account Name and ID') accountName = tsmList[1][0].get('accountname') account_id = tsmList[1][0].get('accountid') logging.debug('account_Name: %s, account_id: %s', accountName, account_id) vol = {'name': 'iscsiMountUmount', 'tsmid': tsmID, 'datasetid': datasetID, \ 'protocoltype': 'ISCSI', 'iops': 500} startTime = ctime() result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime)
logging.info('----Start of testcase "%s"----', testcase) if len(sys.argv) < 2: print "Argument are not correct, Please provide as follows" print "python provision_deprovision_nfs_iscsi.py conf.txt " logging.debug('----Ending script because of parameter mismatch----') exit() config = configFile(sys.argv) api_key = get_apikey(config) stdurl = get_url(config, api_key[1]) startTime = ctime() verify_tsmIP = verify_tsmIP_from_configFile(config, stdurl) endTime = ctime() if verify_tsmIP[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', verify_tsmIP[1], startTime, endTime) tsmIP = verify_tsmIP[1] tsmInterface = verify_tsmIP[2] #----------create pool--------------- startTime = ctime() poolName = 'iPoolPD' pool_create = pool_creation_flow(stdurl, poolName, 2, 'SAS', 'mirror') endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('%s', pool_create[1]) #------------------------------------ #----------create tsm--------------------- startTime = ctime()
#****************************************************************************** #**************PREREQUSITES: POOL AND VSM CREATION***************************** ####-------------------------Pool creation---------------------------------#### poolName = 'nPoolspace' pool_paras = {'name': poolName, 'grouptype': pool_type, \ 'iops': pool_iops} startTime = ctime() pool_create = pool_creation_flow(stdurl, pool_paras, no_of_disk, disk_type) endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('Pool "%s" is created successfully', poolName) ####--------------------------Vsm creation---------------------------------#### startTime = ctime() tsm_params = {'name': 'nTsmSpace', 'ipaddress': tsmIP, 'totaliops': pool_iops, \ 'tntinterface': tsmInterface} tsm_create = tsm_creation_flow(stdurl, poolName, acctName, tsm_params) endTime = ctime() if tsm_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', tsm_create[1], startTime, endTime) logging.debug('%s', tsm_create[1]) #****************************************************************************** #***************Listing VSM and extracting IDs********************************* tsmList = listTSMWithIP_new(stdurl, tsmIP)
logAndresult(tcName, 'FAILED', msg, startTime, endTime) #****************************************************************************** #**************PREREQUSITES: POOL AND VSM CREATION***************************** ####-------------------------Pool creation---------------------------------#### startTime = ctime() poolName = 'iPoolspace' pool_paras = {'name': poolName, 'grouptype': pool_type, \ 'iops': pool_iops} pool_create = pool_creation_flow(stdurl, pool_paras, no_of_disk, disk_type) endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('Pool "%s" is created successfully', poolName) ####--------------------------Vsm creation---------------------------------#### startTime = ctime() tsm_params = {'name': 'iTsmSpace', 'ipaddress': tsmIP, 'totaliops': pool_iops, \ 'tntinterface': tsmInterface} tsm_create = tsm_creation_flow(stdurl, poolName, acctName, tsm_params) endTime = ctime() if tsm_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', tsm_create[1], startTime, endTime) logging.debug('%s', tsm_create[1]) #****************************************************************************** #***************Listing VSM and extracting IDs********************************* startTime = ctime()
if len(sys.argv) < 2: print "Argument are not correct, Please provide as follows" print "python provision_deprovision_nfs_iscsi.py conf.txt " logging.debug('----Ending script because of parameter mismatch----') exit() config = configFile(sys.argv) api_key = get_apikey(config) stdurl = get_url(config, api_key[1]) link_iso = 'http://20.10.1.101/dailybuilds/1.4.0.p5/Apr22-1.4.0.891/ElastiStor_1_4_0_Apr22_1.4.0.891.iso' startTime = ctime() verify_tsmIP = verify_tsmIP_from_configFile(config, stdurl) endTime = ctime() if verify_tsmIP[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', verify_tsmIP[1], startTime, endTime) tsmIP = verify_tsmIP[1] tsmInterface = verify_tsmIP[2] #---------create pool-------- poolName = 'iPoolspace' pool_create = pool_creation_flow(stdurl, poolName, 2, 'SAS', 'mirror') endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('Pool "%s" is created successfully', poolName) #------------------------------------ #----------create tsm--------------------- startTime = ctime() acctName = 'Account'
config = configFile(sys.argv) apikey = get_apikey(config) stdurl = get_url(config, apikey[1]) prtcl = sys.argv[2] tsm_ip = config['ipVSM1'] startTime = ctime() logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsm_ip) tsm_list = listTSMWithIP_new(stdurl, tsm_ip) if tsm_list[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsm_ip) else: endTime = ctime() print 'Not able to list TSMs due to: ' + tsm_list[1] logAndresult(testcase, 'BLOCKED', tsm_list[1], startTime, endTime) logging.info('Getting tsm_name, tsm_id, and dataset_id...') #get_tsmInfo = get_tsm_info(list_tsm[1]) -- ERROR get_tsmInfo = get_tsm_info(tsm_list[1]) tsm_id, tsm_name, dataset_id = get_tsmInfo[0], get_tsmInfo[1], get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id) volume1 = {'name': 'NFS%sPrtcl'%prtcl, 'tsmid': tsm_id, \ 'datasetid': dataset_id, 'protocoltype': 'NFS'} startTime = ctime() create_vol = create_volume(volume1, stdurl) if create_vol[0] == 'FAILED': endTime = ctime() logAndresult(testcase, 'BLOCKED', create_vol[1], startTime, endTime)
updateGlobalSettings('monitor.storage.stats.interval', 60, stdurl) time.sleep(2) #****************************************************************************** #**************PREREQUSITES: POOL AND VSM CREATION***************************** ####-------------------------Pool creation---------------------------------#### startTime = ctime() poolName = 'iPoolgrace' pool_iops = int(pool_iops) pool_paras = {'name': poolName, 'grouptype': pool_type, \ 'iops': pool_iops} pool_create = pool_creation_flow(stdurl, pool_paras, no_of_disk, disk_type) endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('Pool "%s" is created successfully', poolName) ####--------------------------Vsm creation---------------------------------#### startTime = ctime() acctName = 'Account' tsmIops = pool_iops - 50 if tsmIops <= 0: endTime = ctime() print 'pool iops should be more than 50, recommended for minimum value 100' logAndresult(tcName, 'BLOCKED', 'iops are less', startTime, endTime) tsm_params = {'name': 'iTsmGrace', 'ipaddress': tsmIP, 'totaliops': tsmIops, \ 'tntinterface': tsmInterface} tsm_create = tsm_creation_flow(stdurl, poolName, acctName, tsm_params)
ssh.close() #****************************************************************************** #**************PREREQUSITES: POOL AND VSM CREATION***************************** ####-------------------------Pool creation---------------------------------#### startTime = ctime() poolName = 'nPoolClient' pool_paras = {'name': poolName, 'grouptype': pool_type, \ 'iops': pool_iops} pool_create = pool_creation_flow(stdurl, pool_paras, no_of_disk, disk_type) endTime = ctime() if pool_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', pool_create[1], startTime, endTime) logging.debug('Pool "%s" is created successfully', poolName) ####--------------------------Vsm creation---------------------------------#### startTime = ctime() tsm_params = {'name': 'nTsmClient', 'ipaddress': tsmIP, 'totaliops': (pool_iops), \ 'tntinterface': tsmInterface} tsm_create = tsm_creation_flow(stdurl, poolName, acctName, tsm_params) endTime = ctime() if tsm_create[0] == 'FAILED': logAndresult(tcName, 'BLOCKED', tsm_create[1], startTime, endTime) logging.debug('%s', tsm_create[1]) #****************************************************************************** #***************Listing VSM and extracting IDs********************************* startTime = ctime()
print "Argument are not correct, Please provide as follows" print "python provision_deprovision_nfs_iscsi.py conf.txt " logging.debug('----Ending script because of parameter mismatch----') exit() config = configFile(sys.argv) api_key = get_apikey(config) stdurl = get_url(config, api_key[1]) otherClientIP = config["Client1_IP"] tsmIP = config["ipVSM1"] startTime = ctime() tsmList = listTSMWithIP_new(stdurl, tsmIP) endTime = ctime() if tsmList[0] == 'FAILED': logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] account_id = tsmList[1][0].get('accountid') poolName = tsmList[1][0].get('hapoolname') logging.debug('tsm_name:%s, tsm_id:%s, dataset_id:%s, poolName:%s, account_id:%s', \ tsmName, tsmID, datasetID, poolName, account_id) startTime = ctime() for i in range(1, 6): vol = {'name': 'iscsiPD%s' %i, 'tsmid': tsmID, 'datasetid': datasetID, \ 'protocoltype': 'ISCSI', 'iops': 100, 'quotasize': '5G'} volname = vol['name']
resultCollectionNew('\n"%s" testcase starts....' % testcase, ['', '']) print('----Start of testcase "%s"----' % testcase) #----config/basic details--------------------------------------- config = configFile(sys.argv) api_key = get_apikey(config) stdurl = get_url(config, api_key[1]) tsmIP = config["ipVSM1"] #getting this client IP logging.info('Getting local client IP') localClientIP = get_ntwInterfaceAndIP(tsmIP) if localClientIP[0] == 'FAILED': endTime = ctime() logAndresult(testcase, 'BLOCKED', localClientIP[1], startTime, endTime) else: localClientIP = localClientIP[1] logging.debug('local client IP : "%s"', localClientIP) ntw = "%s/8" % localClientIP logging.debug('Network to be provided during initiator grp creation is: %s', \ ntw) #getting this client iqn logging.info('Getting Intiator IQN of local machine from /etc/iscsi Directory') InitIqn = getoutput('cat /etc/iscsi/initiatorname.iscsi '\ '| grep iqn | cut -d "=" -f 2') InitIqn = InitIqn[0].rstrip('\n') logging.debug('Got client IQN : "%s"', InitIqn) print 'IQN of Local client is : %s' % InitIqn
logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime) vol = {'name': 'nfsMountUmount', 'tsmid': tsmID, 'datasetid': datasetID, \ 'protocoltype': 'NFS', 'iops': 100} startTime = ctime() result = create_volume(vol, stdurl) if result[0] == 'FAILED': endTime = ctime() print result[1] logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime) else: print "Volume '%s' created successfully" % (vol['name']) startTime = ctime() logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsmName)
logging.debug('%s successfully for iSCSI LUN %s', action, vol_name) return if 'already exists' in str(result[1]): logging.debug('iscsi LUN %s is already loged in, lets go ahead and' \ 'get the iscsi device name', vol_name) return endTime = ctime() logAndresult(testcase, 'BLOCKED', result[1], startTime, endTime) logging.info('Getting local client IP') localClientIP = get_ntwInterfaceAndIP(tsmIP) if 'FAILED' in localClientIP: endTime = ctime() print localClientIP[1] logAndresult(testcase, 'BLOCKED', localClientIP[1], startTime, endTime) else: localClientIP = localClientIP[1] logging.debug('local client IP : "%s"', localClientIP) ntw1 = "%s/8" % localClientIP ntw2 = "%s/8" % otherClientIP network = '%s,%s' % (ntw1, ntw2) ###Getting Intiator IQN from /etc/iscsi Directory logging.info('Getting Intiator IQN of local machine from /etc/iscsi Directory') InitiatorIqn = getoutput('cat /etc/iscsi/initiatorname.iscsi '\ '| grep iqn | cut -d "=" -f 2') InitiatorIqn = InitiatorIqn[0].rstrip('\n') logging.debug('Got IQN "%s"', InitiatorIqn) print 'IQN of Local client is : %s' % InitiatorIqn