예제 #1
0
 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()
예제 #2
0
def GetVmByName(vmname):
    """ Get a given VM by name """
    vmList = folder.GetAll()
    for vmIter in vmList:
        if (vmIter.GetName() == vmname):
            return vmIter       
    return None
예제 #3
0
def GetVmByName(vmname):
    vmList = folder.GetAll()
    print vmList
    for vmIter in vmList:
        if (vmIter.GetName() == vmname):
            return vmIter

    return None
예제 #4
0
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))
예제 #5
0
파일: registervm.py 프로젝트: free-Zen/pvc
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")
예제 #6
0
        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