def getiSCSIDevice(volName, vsm_id, POOL_IOPS, vsm_dataset_id, STDURL): volumeDict = {'name': volName, 'tsmid': vsm_id, 'datasetid': \ vsm_dataset_id, 'protocoltype': 'ISCSI', 'iops': POOL_IOPS, \ 'quotasize': '20G'} result = create_volume(volumeDict, STDURL) verify_create_volume(result) logging.info('listing volume...') volumes = listVolumeWithTSMId_new(STDURL, vsm_id) if volumes[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName, volumes[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) volumes = volumes[1] vol_id, vol_iqn, account_id, mnt_point = get_vol_id( volumes, volumeDict['name']) logging.debug('volume_id: %s, aacount_id: %s, mountpoint: %s and vol_iqn: %s', \ vol_id, account_id, mnt_point, vol_iqn) add_auth_group = assign_iniator_gp_to_LUN(STDURL, vol_id, account_id, 'ALL') verify_add_auth_gp(add_auth_group, 'ALL') logging.debug('getting iqn for volume %s', volumeDict['name']) iqn = discover_iscsi_lun(VSM_IP, vol_iqn) iqn = verify_iqn(iqn) logging.debug('iqn for discovered iSCSI LUN... %s', iqn) login_result = iscsi_login_logout(iqn, VSM_IP, 'login') verify_iscsi_operation(login_result, volumeDict['name'], 'login') time.sleep(2) result = getDiskAllocatedToISCSI(VSM_IP, mnt_point) iscsiDevice = verify_getDiskAllocatedToISCSI(result, mnt_point) return iscsiDevice, vol_id, account_id, mnt_point, iqn
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 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_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)
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) 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()
DATASET_IDs[x - 1] = datasetid #------------------------------------------------------------------------------ ###volume creation------------------------------------------------------------- for x in range(1, 6): for y in range(1, 21): volDict = {'name': 'T100%sv%s' %(x, y), 'tsmid': TSM_IDs[x-1], \ 'iops': 100, 'datasetid': DATASET_IDs[x-1], \ 'protocoltype': 'NFS'} result = create_volume(volDict, STDURL) verify_create_volume(result) #------------------------------------------------------------------------------ ###getting volumes id and mountpoint-------------------------------------------- for x in range(1, 6): volumes = listVolumeWithTSMId_new(STDURL, TSM_IDs[x - 1]) if volumes[0] == 'PASSED': volumes = volumes[1] else: print 'Not able to list the volumes...' logging.error('Not able to list volumes %s', volumes[1]) logging.debug('mount/umount 100 NFS volumes test case is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) update_volid_mntpoint(volumes) #------------------------------------------------------------------------------ ###Updating network to access the share---------------------------------------- for x in range(1, 101): result = addNFSclient(STDURL, VOLUME_IDs[x - 1], 'ALL') if result[0] == 'FAILED' and 'already exists' in str(result[1]): pass
'datasetid': vsm_dataset_id, 'protocoltype': 'NFS'} vol2_dict = {'name': VOL2_NAME, 'quotasize': '500G', 'tsmid': vsm_id, 'iops': VOL2_IOPS, \ 'datasetid': vsm_dataset_id, 'protocoltype': 'NFS'} # Create Volume1 & Volume2 using the vsm_ids and params specified result = create_volume(vol1_dict, STDURL) verify_create_volume(result) result = create_volume(vol2_dict, STDURL) verify_create_volume(result) # Get the info for the Volume created above (this list method response contains id, etc.., not create, so needed) volumes = listVolumeWithTSMId_new(STDURL, vsm_id) if volumes[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName,volumes[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) volumes = volumes[1] # Extract the vol_id & vol_mnt_pt for both volumes from info obtained above ''' for vol in volumes: vol_id = vol.get('id') vol_mnt_pt = vol.get('mountpoint') ''' vol1_info = get_volume_info(volumes, VOL1_NAME) vol1_id, vol1_mnt_pt = vol1_info[2], vol1_info[3]
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) else: print "Volume '%s' created successfully" % (volume1['name']) logging.info('Listing volumes in the TSM "%s" w.r.t its TSM ID', tsm_name) vol_list = listVolumeWithTSMId_new(stdurl, tsm_id) if vol_list[0] == 'PASSED': logging.info('Volumes present in the TSM "%s"', tsm_name) else: endTime = ctime() logAndresult(testcase, 'BLOCKED', vol_list[1], startTime, endTime) volume_name = volume1['name'] #get_volInfo = get_volume_info(volList[1], volume_name) -- ERROR get_volInfo = get_volume_info(vol_list[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, 'all')