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 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]
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} 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) nodeIP = tsmList[1][0].get('controlleripaddress') passwd = "test" command = 'cat /var/log/devd.log | grep %s | grep -w mount' \ %(volume['mountPoint']) logs = getControllerInfoAppend(nodeIP, passwd, command, "results/result.csv") logging.debug('Mount alerts from devd.log is: %s', logs) print logs
NODE2_IP = get_node2_ip(NODE1_IP, STDURL) volumeDict = {'name': 'ungrceHANFS1', 'tsmid': tsm_id, 'datasetid': \ dataset_id, 'protocoltype': 'NFS', '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, account_id, mnt_point = get_vol_id(volumes, volumeDict['name']) logging.debug('volume_id: %s, aacount_id: %s, and mountpoint: %s', vol_id, \ account_id, mnt_point) volume_dir = {'mountPoint': mnt_point, 'TSMIPAddress': VSM_IP, 'name': \ volumeDict['name']} add_client_result = addNFSclient(STDURL, vol_id, 'ALL') verify_ddNFSclient(add_client_result, 'ALL', volumeDict['name']) mount_result = mountNFS(volume_dir) verify_mountNFS(mount_result, volume_dir) mount_dir = 'mount/%s' %(mnt_point) mount_dir2 = {'name': volumeDict['name'], 'mountPoint': volumeDict['name']} logging.info('...executing vdbench....') executeVdbenchFile(mount_dir2, 'filesystem_nfs') time.sleep(20) logging.info('verifying the IOPS before Node goes to reset...') iops_datapath = poolName+'/'+accName+tsm_name+'/'+volumeDict['name'] verify_IOPS(NODE1_IP, PASSWD, iops_datapath) logging.debug('going to move node to reset...') getControllerInfo(NODE1_IP, PASSWD, 'reboot', 'reboot.txt') logging.debug('verifying pool import at peer Node: %s', NODE2_IP) verify_pool_import(poolName, NODE2_IP, PASSWD) logging.debug('before verifying IOPS after reset the Node, sleeping for 10secs')
elif result_addnfs[0] == 'FAILED': logging.info(" Failed to add NFS clients %s " % result_addnfs) endTime = ctime() resultCollection(' Failed to add NFS clients', \ ['BLOCKED', ''], startTime, endTime) print("Adding NFS client FAILED %s " % result_addnfs) # mount and umount nfs volumes volume = { 'name': volume['name'], 'mountPoint': mount_p, 'TSMIPAddress': Tsm_ip } logging.info("Mounting Nfs volumes") result_mount = mountNFS(volume) if result_mount == 'PASSED': logging.info("volume mounted sucessfully %s" % result_mount) elif result_mount == 'FAILED': logging.error("Failed to mount volumes %s so ending the script" % result_mount) endTime = ctime() resultCollection('Umounting volume test case is', \ ['BLOCKED', result_mount], startTime, endTime) logging.info("Started umounting volumes") result_umount = umountVolume(volume) print result_umount if result_umount == 'PASSED': logging.info('volume umounted succesfull') endTime = ctime()