def main(args): if len(args) != 1: print('Usage: ./assignfiletoallvm.py [file]') exit(-1) filename = sys.argv[1] manager = VMManager() vms = manager.getRunningVMNames() filteredVms = [vm for vm in vms if vm.startswith(VM_PREFIX)] if not filteredVms: print("No VMs exist with 'aos' prefix. Exiting...") exit(-1) TestLib.copyFiles(filename,filteredVms)
#!/usr/bin/python from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vm import VMManager from testLibrary import TestLib VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(VM_PREFIX) pinLists = [0, -1] nextPinList = 0 for vmname in vms: manager.pinVCpuToPCpu(vmname, 0, pinLists[nextPinList]) nextPinList = (nextPinList + 1) % 2 ips = TestLib.getIps(vms) ipsAndVals = {ip: 100000 for ip in ips} TestLib.startTestCase("~/cpu/testcases/2/iambusy {}", ipsAndVals)
#!/usr/bin/python from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vm import VMManager from testLibrary import TestLib VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() manager.setAllVmsMemoryWithFilter(VM_PREFIX, 512) vms = manager.getRunningVMNames(VM_PREFIX) print('Start testcase 3') ips = TestLib.getIps(vms) ipsAndVals = dict() tmp = 0 for ip in ips: if tmp == 0 or tmp == 1: ipsAndVals[ip] = "A" else: ipsAndVals[ip] = "B" tmp += 1 TestLib.startTestCase("~/testcases/3/run {}", ipsAndVals)
#!/usr/bin/python from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vm import VMManager from testLibrary import TestLib VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(VM_PREFIX) ips = TestLib.getIps(vms) ipsAndVals = {ip: [] for ip in ips} TestLib.startTestCase("killall iambusy", ipsAndVals)
#!/usr/bin/python from __future__ import print_function from vm import VMManager MAX_MEMORY = 2 * 1024 VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() manager.setAllVmsMaxMemoryWithFilter(VM_PREFIX, MAX_MEMORY)
#!/usr/bin/python from __future__ import print_function from vm import VMManager import time VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(filterPrefix=VM_PREFIX) for vmname in vms: manager.shutdownVM(vmname) time.sleep(5)
#!/usr/bin/python from __future__ import print_function from vm import VMManager import time VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getFilteredVms(VM_PREFIX) for vmname in vms: manager.startVM(vmname) time.sleep(5)
parser = argparse.ArgumentParser() parser.add_argument("-m", "--machine", action="store_true", help="outputs a machine parseable format") parser.add_argument( "-d", "--dynamic", action="store_true", help="enables dynamic observation of VM addition/deletion") args = parser.parse_args() machineParseable = args.machine dynamic = args.dynamic s = sched.scheduler(time.time, time.sleep) manager = VMManager() if dynamic: vminfoDict = {} s.enter(1, 1, run_dynamic, ( s, manager, vminfoDict, machineParseable, )) else: vmlist = manager.getRunningVMNames(VM_PREFIX) vmobjlist = [manager.getVmObject(name) for name in vmlist] vminfolist = [None] * len(vmobjlist) numpcpu = manager.getPhysicalCpus() s.enter(1, 1, run, (
#!/usr/bin/python from __future__ import print_function from vm import VMManager import time VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(filterPrefix=VM_PREFIX) for vm in vms: manager.destroyVM(vm) time.sleep(5)
else: print("Memory (VM: {}) Actual [{}], Unused: [{}]".format( vm.name(), stats['actual'] / 1024.0, stats['unused'] / 1024.0)) i += 1 sc.enter(2, 1, run, (sc, vmobjlist, machineParseable)) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("-m", "--machine", action="store_true", help="outputs a machine parseable format") args = parser.parse_args() machineParseable = args.machine s = sched.scheduler(time.time, time.sleep) manager = VMManager() vmlist = manager.getRunningVMNames(VM_PREFIX) vmobjlist = [manager.getVmObject(name) for name in vmlist] for vm in vmobjlist: vm.setMemoryStatsPeriod(1) s.enter(2, 1, run, ( s, vmobjlist, machineParseable, )) s.run()
#!/usr/bin/python from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vm import VMManager from testLibrary import TestLib VM_PREFIX = "aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(VM_PREFIX) rounds = manager.getPhysicalCpus() i = 0 for vmname in vms: manager.pinVCpuToPCpu(vmname, 0, i) i = (i + 1) % rounds ips = TestLib.getIps(vms) ipsAndVals = {ip: [100000] for ip in ips} TestLib.startTestCase("~/cpu/testcases/3/iambusy {}", ipsAndVals)
#!/usr/bin/python from __future__ import print_function import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vm import VMManager from testLibrary import TestLib VM_PREFIX="aos" if __name__ == '__main__': manager = VMManager() vms = manager.getRunningVMNames(VM_PREFIX) for vmname in vms: manager.upinVCpu(vmname,0) ips = TestLib.getIps(vms) ipsAndVals = { ip : [100000] for ip in ips } TestLib.startTestCase("~/cpu/testcases/4/iambusy {}",ipsAndVals)