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 iscsi_get_quota(tsm_ip, vol_iqn, vol_mntPoint): discover_lun = discover_iscsi_lun(tsm_ip, vol_iqn) if discover_lun[0] == 'FAILED': return ['FAILED', discover_lun[1]] logging.debug('IQN of discovered lun is "%s"', discover_lun[1]) lun_login = iscsi_login_logout(discover_lun[1], tsm_ip, 'login') if lun_login[0] == "FAILED": return ["FAILED", lun_login[1]] time.sleep(3) result = getDiskAllocatedToISCSI(tsm_ip, vol_mntPoint) if result[0] == 'PASSED' and vol_mntPoint in str(result[1]): logging.debug('iscsi logged device... %s', result[1][vol_mntPoint]) device = result[1][vol_mntPoint] else: return ['FAILED', 'Not able to get logged in device'] time.sleep(5) #Getting device size and converting into GB quota = getoutput('fdisk -l | grep /dev/%s: | awk {\'print $5\'}' % (device)) quota1 = int(quota[0]) / (1024 * 1024 * 1024) return ['PASSED', quota1]
dataset_id, 'protocoltype': 'ISCSI', 'iops': 500} result = create_volume(volumeDict, STDURL) verify_create_volume(result) logging.info('listing volume...') volumes = listVolumeWithTSMId_new(STDURL, tsm_id) volumes = verify_list_volumes(volumes) 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) iscsi_device = verify_getDiskAllocatedToISCSI(result, mnt_point) result = execute_mkfs(iscsi_device, 'ext3') verify_execute_mkfs(result) mount_result = mount_iscsi(iscsi_device, volumeDict['name']) verify_mount(mount_result) #mount_dir = 'mount/%s' %(volumeDict['name']) mount_dir = {'name': volumeDict['name'], 'mountPoint': volumeDict['name']} logging.info('...executing vdbench....')
startTime = ctime() auto = update_iscsi_services(stdurl, volid, account_id, services) if auto[0] == 'PASSED': msg = 'Successfully update Auth method to "%s" for volume "%s"' \ %(services.get('auth_method'), volname) logging.debug('%s', msg) print msg else: endTime = ctime() msg = 'Failed to update Auth method to "%s" for volume "%s"' \ %(services.get('auth_method'), volname) logAndresult(testcase, 'FAILED', msg, startTime, endTime) #discover, login.... startTime = ctime() discover = discover_iscsi_lun(tsmIP, iqnName) if discover[0] == 'FAILED': endTime = ctime() logAndresult(testcase, 'FAILED', discover[1], startTime, endTime) else: print discover[1] logging.debug('lun discovered : %s', discover[1]) ilogin = iscsi_login_logout(iqnName, tsmIP, 'login') if result[0] == 'PASSED': logging.debug('Login successfully for iSCSI LUN %s', volname) else: endTime = ctime() logAndresult(testcase, 'FAILED', result[1], startTime, endTime) endTime = ctime()
# 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': logging.error('Testcase AMSx-WLAx-NSWx-ISCSI-IORx-TC_CONTINUOUS_ISTGTCONTROL_REFRESH is '\ 'blocked, not able to assign auth group due to: %s', \ addAuthGroupResult[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # discover iSCSI LUN and getting iqn for the same discovered LUN discoverIqn = discover_iscsi_lun(VSM_IP, volIqn) if discoverIqn[0] == 'FAILED': print 'Not able to discover iSCSI LUN' logging.debug('Testcase AMSx-WLAx-NSWx-ISCSI-IORx-TC_CONTINUOUS_ISTGTCONTROL_REFRESH is '\ 'blocked, getting iqn as None for discovered iSCSI LUN') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) discoverIqn = discoverIqn[1] logging.debug('iqn for discovered iSCSI LUN: %s', discoverIqn) # going to login newly discovered iSCSI LUN login_result = iscsi_login_logout(discoverIqn, VSM_IP, 'login') if login_result[0] == 'FAILED' and 'already' in str(login_result[1]): print 'iscsi LUN with iqn: %s already logged-in' % discoverIqn elif login_result[0] == 'FAILED': print 'Not able to login iSCSI LUN with iqn: %s' % (discoverIqn) logging.debug('Testcase AMSx-WLAx-NSWx-ISCSI-IORx-TC_CONTINUOUS_ISTGTCONTROL_REFRESH is '\
volume_name = volume['name'] get_volInfo = get_volume_info(vol_list[1], volume_name) volname, volid, vol_iqn, group_id = get_volInfo[1], get_volInfo[2], \ get_volInfo[4], get_volInfo[5] logging.debug('volname: %s, volid: %s, vol_iqn: %s, vol_grpID: %s',\ volname, volid, vol_iqn, group_id) vl = vol_list[1][0] old_attri = {'iops': vl.get('iops'), 'quota':vl.get('quota'), \ 'compression': vl.get('compression'), 'sync': vl.get('sync'), \ 'readonly': vl.get('readonly'), 'grace': vl.get('graceallowed')} result = assign_iniator_gp_to_LUN(stdurl, volid, accId, 'ALL') verify_add_auth_gp(result) logging.debug('getting iqn for volume %s', volname) iqn = discover_iscsi_lun(tsm_ip, vol_iqn) iqn = verify_iqn(iqn) logging.debug('iqn for discovered iSCSI LUN... %s', iqn) login_result = iscsi_login_logout(iqn, tsm_ip, 'login') verify_iscsi_login(login_result, volname) time.sleep(5) mountpoint = accName + volname result = getDiskAllocatedToISCSI(tsm_ip, mountpoint) device = verify_getDiskAllocatedToISCSI(result, mountpoint) mkfs_result = execute_mkfs(device, 'ext3') verify_execute_mkfs(mkfs_result) mount_result = mount_iscsi(device, volname) verify_mount(mount_result) mount_dir = {'name': volname, 'mountPoint': volname} qos_datapath = poolName + '/' + accName + tsm_name + '/' + volname
endTime = ctime() resultCollection('Listing of volume Blocked the testcase', \ ['BLOCKED',''], startTime, endTime) exit() for vol in vol_list[1]: if vol['name'] == volume1['name']: iops_volid = vol.get('id') iops_volname = vol.get('name') iopsgroup_id = vol.get('groupid') iops_vol_iqn = vol.get('iqnname') logging.info('Got IopsVolume ID = "%s" and Group ID = "%s" of "%s"', \ iops_volid, iopsgroup_id, iops_volname) result = assign_iniator_gp_to_LUN(stdurl, iops_volid, accId, 'ALL') verify_add_auth_gp(result) logging.debug('getting iqn for volume %s', iops_volname) iqn = discover_iscsi_lun(tsm_ip, iops_vol_iqn) iqn = verify_iqn(iqn) logging.debug('iqn for discovered iSCSI LUN... %s', iqn) login_result = iscsi_login_logout(iqn, tsm_ip, 'login') verify_iscsi_login(login_result, iops_volname) time.sleep(5) mountpoint = accName + iops_volname result = getDiskAllocatedToISCSI(tsm_ip, mountpoint) device = verify_getDiskAllocatedToISCSI(result, mountpoint) mkfs_result = execute_mkfs(device, 'ext3') verify_execute_mkfs(mkfs_result) mount_result = mount_iscsi(device, iops_volname) verify_mount(mount_result) ##executing vd bench mount_dir = {'name': iops_volname, 'mountPoint': iops_volname} logging.info('...executing vdbench....')