def setUp(self): self.host, self.numClients, self.loopLimit = stressutil.processLoopArgs() si = Connect(self.host) self.vmList = folder.GetAll() vm.PowerOffAllVms(self.vmList) self.setUpArgs()
def GetVmByName(vmname): """ Get a given VM by name """ vmList = folder.GetAll() for vmIter in vmList: if (vmIter.GetName() == vmname): return vmIter return None
def GetVmByName(vmname): vmList = folder.GetAll() print vmList for vmIter in vmList: if (vmIter.GetName() == vmname): return vmIter return None
def main(): # Process command line vmNum = 0 host = "jairam-esx" start = time.time() if len(sys.argv) > 1: host = sys.argv[1] if len(sys.argv) > 2: vmNum = int(sys.argv[2]) # Connect si = Connect(host) atexit.register(Disconnect, si) # Get vms vmList = folder.GetAll() getdata(vmList[vmNum]) print("Total time: %s" % (time.time() - start))
def main(): supportedArgs = [(["h:", "host="], "localhost", "Host name", "host"), (["u:", "user="******"root", "User name", "user"), (["p:", "pwd="], "ca$hc0w", "Password", "pwd"), (["v:", "vmname="], "CreateTest", "Name of the virtual machine", "vmname"), (["i:", "numiter="], "1", "Number of iterations", "iter")] supportedToggles = [ (["usage", "help"], False, "Show usage information", "usage"), (["unregister"], False, "Do an unregister of all registered vms", "unregister") ] args = arguments.Arguments(sys.argv, supportedArgs, supportedToggles) if args.GetKeyValue("usage") == True: args.Usage() sys.exit(0) # Connect si = Connect(host=args.GetKeyValue("host"), user=args.GetKeyValue("user"), pwd=args.GetKeyValue("pwd")) # Process command line vmname = args.GetKeyValue("vmname") numiter = int(args.GetKeyValue("iter")) dounreg = int(args.GetKeyValue("unregister")) # The unregister case if (dounreg): for v in folder.GetAll(): v.Unregister() sys.exit(0) # Create vms for i in range(numiter): clock = StopWatch() folder.Register("[storage1] " + vmname + "_" + str(i) + "/" + vmname + "_" + str(i) + ".vmx") clock.finish("Register done")
if opt in ("-k", "--skip"): skip = arg if opt in ("-s", "--start"): start = arg if host == None: usage() return (1) # Connect si = Connect(host) print "Test started on ", now() vms = folder.GetAll() start_time = time.time() i = 0 if start == None: start = 0 # Get vms while (time.time() - start_time) < (60 * 60 * 2): # 2 hours print "== iteration ", str(i + 1), " time = ", now() skip_next = False for index in range(int(start), len(vms)): if skip != None and skip_next: skip_next = False continue