def UseFileInMountPoint(volume): output = getoutput('mount | grep %s | awk \'{print $3}\'' \ %(volume['mountPoint'])) mount_point = output[0].strip('\n') exe_vdb = executeVdbenchFile(volume, VdbFile) time.sleep(20) #sleeping for 30s before trying to umount the volume on which vdbench is running logging.info('Now unmounting the mountPoint which is in use') check_vdbench = is_vdbench_alive(volume['name']) if check_vdbench: umount_output = executeCmd('umount mount/%s' %(volume['mountPoint'])) if umount_output[0] == 'FAILED': print 'expected result : %s' %(umount_output[1]) logging.debug('expected result: %s', umount_output[1]) umountFail = True return ['PASSED', umountFail] else: print 'Unexpected Result: Unmount happened when file in '\ 'mountPoint is in use' kill_process(volume['name']) return ['FAILED', 'Unmount happened when file in mountPoint is in use'] else: return ['FAILED', 'Vdbench stopped, MountPoint not in use']
while True: mountDetails = mountPointDetails('-m', mount_point) Used = mountDetails[2] if int(Used) >= 1000: logging.debug('vdbench has successfully created 1 GB file of the') logging.debug('going to stop vdbench after 10 seconds...') time.sleep(10) break check_vdbench = is_vdbench_alive(volname) if check_vdbench: continue else: logging.debug('vdbench has stopped unexpectedly....') break kill_process(volname) logging.info('waiting for 10s') time.sleep(10) mountDetails = mountPointDetails('-h', mount_point) Used1 = mountDetails[2].strip('G') logging.debug('Before increasing size, used space of iscsi lun is: %s', Used1) logging.info('Increasing space of Iscsi volume') quota = '5G' quota1 = quota.rstrip('G') edit_quota = edit_vol_quota(volid, quota, stdurl) if edit_quota[0] == 'FAILED': logAndresult(testcase, 'FAILED', edit_quota[1], startTime, endTime) logging.debug('Successfully updated quota of volume "%s" from %s to %s'\ ,volname, vol_quota, quota)
else: endTime = ctime() msg = 'Vdbench has stopped running on first dataset' logAndresult(testcase, 'FAILED', msg, startTime, endTime) endTime = ctime() resultCollection("%s, testcase is" %testcase, ['PASSED', ' '], \ startTime, endTime) #resultCollectionNew('"%s" testcase ends....' %testcase, ['', '\n']) logging.debug('%s, testcase PASSED', testcase) logging.info('Checking whether vdbench is still running or not....') check_vdbench = is_vdbench_alive(vol1['name']) if check_vdbench: logging.debug('vdbench is running, going to kill the vdbench process...') kill_process(vol1['name']) time.sleep(2) check_vdbench = is_vdbench_alive(vol2['name']) if check_vdbench: logging.debug('Failed to kill vdbench process, going to kill again...') kill_process(vol2['name']) else: logging.debug('Successfully killed vdbench process') print 'Successfully killed vdbench process' else: logging.debug('Vdbench process has stopped unexpectedly...') print 'Vdbench process has stopped' # clearing the configurations logging.info('Unmounting volume "%s"', vol1['name']) u1 = umount_share(final_result1[0])