def run_on_each_vol(mg_id): all_vol_data = obj.get_given_parent_obj_info("storage", "volumes") vol_dets = {vol['id']:vol['serial'] for vol in all_vol_data if vol['mediaGrpId'] == mg_id} for vid, vse in vol_dets.iteritems(): print vid, vse vol_ids = obj._dict['mg_details'][mg_id]['vol_ids'] for i in range(len(vol_ids)): vid = vol_ids[i] serial = vol_dets[vid] print "\n\nAssign->Connect->IO's->Disconn->UnAssing vol:%s\n"%serial if obj.assign_object('volumes', vid, ports, []): sys.exit(1) for ip in obj.port_ips: out, err = host_defs.execute_command('nvme connect -s 4420 -t rdma -a %s -n %s'%(ip, serial)) if err: sys.exit(1) if arguments.fs_type and host_defs.create_mount_fs(arguments.fs_type): sys.exit(1) dets = host_defs.perform_ios('write', {}) if not dets['pattern'] : sys.exit(1) if arguments.fail_over and failover.trigger_fo(arguments, obj): sys.exit(1) dets = host_defs.perform_ios('read', dets) if not dets['pattern']: sys.exit(1) if arguments.fs_type and host_defs.umount_objs(): sys.exit(1) if host_defs.disconnect_objs(): sys.exit(1) if obj.unassign_object('volumes',vid): sys.exit(1) print"\n\n>>>>>>>>>>>>>>>>Completed for volume:%s<<<<<<<<<<<<<<<<<<\n\n"%str(i+1)
def validate_on_copy(copy_type, pid, suffix, dets): print "\n>>>>Creating %s, assigning & connect"%copy_type _id = obj.create_copy(pid, copy_type, suffix) if not _id: return None if assign_connect(_id, ports): return None if arguments.fail_over and failover.trigger_fo(arguments, obj): sys.exit(1) _tmp = host_defs.perform_ios('read', dets) if not _tmp['pattern']: return(1) print ">>>>Completed reads, unmount, unassign.." if disconnect_unassign(_id): return None return(_id)
print job, log, "\n" sys.exit(0) print "\nStarting IO in BG" io_t = multiprocessing.Process(target=host_defs.run_io_job, args=(job, log)) io_d.daemon = True io_t.start() time.sleep(30) if arguments.parallel: if parallel.multiple_ops(_api, arguments): sys.exit(1) if arguments.fail_over: st = failover.trigger_fo(arguments, _api) if arguments.ios_enabled: io_t.terminate() io_t.join() st = host_defs.verify_io_log(log) | st if arguments.parallel: po_t.terminate() po_t.join() st = parallel.check_failure(_api.parallel_ops_log) | st if st: print "ERROR! Failure noticed" sys.exit(1) if arguments.ios_enabled: print "\nWaiting for IO Job to complete.." print "is_alive()", io_t.is_alive()
reservation = random.choice([90, 50, 10, 40, 20, 30, 70, 100, 60]) vid = obj.create_volume(mg_id, 100, 'vol_%s_%s'%(str(i),str(v)), reservation) if not vid: sys.exit(1) if assign_connect(vid, ports): sys.exit(1) if arguments.fs_type and host_defs.create_mount_fs(arguments.fs_type): sys.exit(1) dets = host_defs.perform_ios('write', {}) if not dets['pattern'] : sys.exit(1) if arguments.fail_over and failover.trigger_fo(arguments, obj): sys.exit(1) dets = host_defs.perform_ios('read', dets) if not dets['pattern']: sys.exit(1) if disconnect_unassign(vid): sys.exit(1) suffix = "m%s_v%s"%(str(i), str(v)) sid = validate_on_copy('snapshots', vid, suffix, dets) if not sid: sys.exit(1)