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)
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, 'all') if addClient[0] == 'PASSED': print 'Added NFS client "all" to volume "%s"' % volname logging.info('Added NFS client "all" to volume "%s"', volname) else: endTime = ctime() logAndresult(testcase, 'BLOCKED', addClient[1], startTime, endTime) volume = {'TSMIPAddress' : tsmIP, 'mountPoint': vol_mntPoint,\ 'name' : volname}
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] print vol1_id, vol1_mnt_pt vol2_info = get_volume_info(volumes, VOL2_NAME) vol2_id, vol2_mnt_pt = vol2_info[2], vol2_info[3] print vol2_id, vol2_mnt_pt # Updating nfs client access property for both volume result = addNFSclient(STDURL, vol1_id, 'ALL') if result[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName,result[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
result = create_volume(vol_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, vsmId) if volumes[0] == 'FAILED': logging.error('Testcase AMSx-WLAx-NSWx-ISCSI-IORx-TC_CONTINUOUS_ISTGTCONTROL_REFRESH is blocked due to' \ ': %s', volumes[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) volumes = volumes[1] # Extract the iSCSI LUN properties from info obtained above vol_info = get_volume_info(volumes, VOL_NAME) if vol_info[0] == 'FAILED': print 'Not able to get volume properties...' logging.error('Testcase AMSx-WLAx-NSWx-ISCSI-IORx-TC_CONTINUOUS_ISTGTCONTROL_REFRESH is '\ 'blocked due to %s', vol_info[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # Assigning vol properties to variables volId = vol_info[2] volMntPoint = vol_info[3] volIqn = vol_info[4] volGrpID = vol_info[5] # Updating iSCSI auth group to ALL, So client can access the iSCSI LUN addAuthGroupResult = assign_iniator_gp_to_LUN(STDURL, volId, account_id, 'ALL') if addAuthGroupResult[0] == 'FAILED':