Lines Matching refs:mach

144                     for mach in getMachines(self.ctx, False, True):
147 word = re.sub("(?<!\\\\) ", "\\ ", str(mach.name))
150 word = str(mach.id)
241 mach = vbox.createMachine("", name, [], kind, "")
242 mach.saveSettings()
243 print "created machine with UUID", mach.id
244 vbox.registerMachine(mach)
248 def removeVm(ctx, mach):
249 uuid = mach.id
250 print "removing machine ", mach.name, "with UUID", uuid
251 cmdClosedVm(ctx, mach, detachVmDevice, ["ALL"])
252 disks = mach.unregister(ctx['global'].constants.CleanupMode_Full)
253 if mach:
254 progress = mach.deleteConfig(disks)
262 def startVm(ctx, mach, vmtype):
266 progress = mach.launchVMProcess(session, vmtype, "")
272 perf.setup(['*'], [mach], 10, 15)
280 def __init__(self, mach):
281 if mach.accessible:
282 self.name = mach.name
285 self.id = mach.id
289 for mach in lst:
290 elem = CachedMach(mach)
322 def perfStats(ctx, mach):
325 for metric in ctx['perf'].query(["*"], [mach]):
354 print "machine state event: mach=%s state=%s" % (scev.machineId, scev.state)
358 print "snapshot taken event: mach=%s snap=%s" % (stev.machineId, stev.snapshotId)
694 def cmdExistingVm(ctx, mach, cmd, args):
699 mach.lockMachine(session, ctx['global'].constants.LockType_Shared)
701 printErr(ctx, "Session to '%s' not open: %s" % (mach.name, str(e)))
706 print "Session to '%s' in wrong state: %s" % (mach.name, session.state)
720 'stats': lambda: perfStats(ctx, mach),
721 'guest': lambda: guestExec(ctx, mach, console, args),
723 'guestlambda': lambda: args[0](ctx, mach, console, args[1:]),
744 def cmdClosedVm(ctx, mach, cmd, args=[], save=True):
745 session = ctx['global'].openMachineSession(mach, True)
746 mach = session.machine
748 cmd(ctx, mach, args)
756 mach.saveSettings()
764 def cmdAnyVm(ctx, mach, cmd, args=[], save=False):
765 session = ctx['global'].openMachineSession(mach)
766 mach = session.machine
768 cmd(ctx, mach, session.console, args)
775 mach.saveSettings()
780 mach = ctx['vb'].getMachine(uuid)
782 mach = ctx['vb'].findMachine(uuid)
783 return mach
858 def __init__(self, parent, mach):
859 XPathNodeHolder.__init__(self, parent, mach, 'nics', XPathNodeVM, 'nics')
904 mach = machById(ctx, uuid)
905 if mach == None:
907 return mach
944 for mach in getMachines(ctx, True):
946 if mach.teleporterEnabled:
950 print "%sMachine '%s' [%s], machineState=%s, sessionState=%s" % (tele, colVm(ctx, mach.name), mach.id, asEnumElem(ctx, "MachineState", mach.state), asEnumElem(ctx, "SessionState", mach.sessionState))
961 mach = argsToMach(ctx, args)
962 if mach == None:
964 vmos = ctx['vb'].getGuestOSType(mach.OSTypeId)
965 print " One can use setvar <mach> <var> <value> to change variable, using name in []."
966 print " Name [name]: %s" % (colVm(ctx, mach.name))
967 print " Description [description]: %s" % (mach.description)
968 print " ID [n/a]: %s" % (mach.id)
970 print " Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareType), mach.firmwareType)
972 print " CPUs [CPUCount]: %d" % (mach.CPUCount)
973 print " RAM [memorySize]: %dM" % (mach.memorySize)
974 print " VRAM [VRAMSize]: %dM" % (mach.VRAMSize)
975 print " Monitors [monitorCount]: %d" % (mach.monitorCount)
976 print " Chipset [chipsetType]: %s (%s)" % (asEnumElem(ctx, "ChipsetType", mach.chipsetType), mach.chipsetType)
978 print " Clipboard mode [clipboardMode]: %s (%s)" % (asEnumElem(ctx, "ClipboardMode", mach.clipboardMode), mach.clipboardMode)
979 print " Machine status [n/a]: %s (%s)" % (asEnumElem(ctx, "SessionState", mach.sessionState), mach.sessionState)
981 if mach.teleporterEnabled:
982 print " Teleport target on port %d (%s)" % (mach.teleporterPort, mach.teleporterPassword)
984 bios = mach.BIOSSettings
987 hwVirtEnabled = mach.getHWVirtExProperty(ctx['global'].constants.HWVirtExPropertyType_Enabled)
989 hwVirtVPID = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_VPID)
991 hwVirtNestedPaging = mach.getHWVirtExProperty(ctx['const'].HWVirtExPropertyType_NestedPaging)
994 print " Hardware 3d acceleration [accelerate3DEnabled]: " + asState(mach.accelerate3DEnabled)
995 print " Hardware 2d video acceleration [accelerate2DVideoEnabled]: " + asState(mach.accelerate2DVideoEnabled)
997 print " Use universal time [RTCUseUTC]: %s" % (asState(mach.RTCUseUTC))
998 print " HPET [HPETEnabled]: %s" % (asState(mach.HPETEnabled))
999 if mach.audioAdapter.enabled:
1000 print " Audio [via audioAdapter]: chip %s; host driver %s" % (asEnumElem(ctx, "AudioControllerType", mach.audioAdapter.audioController), asEnumElem(ctx, "AudioDriverType", mach.audioAdapter.audioDriver))
1001 print " CPU hotplugging [CPUHotPlugEnabled]: %s" % (asState(mach.CPUHotPlugEnabled))
1003 print " Keyboard [keyboardHIDType]: %s (%s)" % (asEnumElem(ctx, "KeyboardHIDType", mach.keyboardHIDType), mach.keyboardHIDType)
1004 print " Pointing device [pointingHIDType]: %s (%s)" % (asEnumElem(ctx, "PointingHIDType", mach.pointingHIDType), mach.pointingHIDType)
1005 print " Last changed [n/a]: " + time.asctime(time.localtime(long(mach.lastStateChange)/1000))
1008 print " VRDE server [VRDEServer.enabled]: %s" % (asState(mach.VRDEServer.enabled))
1014 for oUsbCtrl in ctx['global'].getArray(mach, 'USBControllers'):
1020 print " Cache enabled [IOCacheEnabled]: %s" % (asState(mach.IOCacheEnabled))
1021 print " Cache size [IOCacheSize]: %dM" % (mach.IOCacheSize)
1023 controllers = ctx['global'].getArray(mach, 'storageControllers')
1030 attaches = ctx['global'].getArray(mach, 'mediumAttachments')
1070 for sf in ctx['global'].getArray(mach, 'sharedFolders'):
1079 mach = argsToMach(ctx, args)
1080 if mach == None:
1086 startVm(ctx, mach, vmtype)
1107 mach = argsToMach(ctx, args)
1108 if mach == None:
1110 cmdExistingVm(ctx, mach, 'ginfo', '')
1208 mach = argsToMach(ctx, args)
1209 if mach == None:
1214 gargs.insert(0, lambda ctx, mach, console, args: execInGuest(ctx, console, args, env, user, passwd, 10000))
1215 cmdExistingVm(ctx, mach, 'guestlambda', gargs)
1222 mach = argsToMach(ctx, args)
1223 if mach == None:
1227 gargs.insert(0, lambda ctx, mach, console, args: copyToGuest(ctx, console, args, user, passwd))
1228 cmdExistingVm(ctx, mach, 'guestlambda', gargs)
1241 mach = argsToMach(ctx, args)
1242 if mach == None:
1251 gargs.insert(0, lambda ctx, mach, console, args: execInGuest(ctx, console, args, env, user, passwd, 10000, lambda ctx:readCmdPipe(ctx, hcmd)))
1252 cmdExistingVm(ctx, mach, 'guestlambda', gargs)
1262 mach = argsToMach(ctx, args)
1263 if mach == None:
1265 removeVm(ctx, mach)
1269 mach = argsToMach(ctx, args)
1270 if mach == None:
1272 cmdExistingVm(ctx, mach, 'pause', '')
1276 mach = argsToMach(ctx, args)
1277 if mach == None:
1279 cmdExistingVm(ctx, mach, 'powerdown', '')
1283 mach = argsToMach(ctx, args)
1284 if mach == None:
1286 cmdExistingVm(ctx, mach, 'powerbutton', '')
1290 mach = argsToMach(ctx, args)
1291 if mach == None:
1293 cmdExistingVm(ctx, mach, 'resume', '')
1297 mach = argsToMach(ctx, args)
1298 if mach == None:
1300 cmdExistingVm(ctx, mach, 'save', '')
1304 mach = argsToMach(ctx, args)
1305 if mach == None:
1307 cmdExistingVm(ctx, mach, 'stats', '')
1314 mach = argsToMach(ctx, args)
1315 if mach == None:
1317 if mach.state != ctx['const'].MachineState_Running:
1318 cmdClosedVm(ctx, mach, lambda ctx, mach, a: guestExec (ctx, mach, None, ' '.join(args[2:])))
1320 cmdExistingVm(ctx, mach, 'guest', ' '.join(args[2:]))
1327 mach = argsToMach(ctx, args)
1328 if mach == None:
1330 cmdExistingVm(ctx, mach, 'screenshot', args[2:])
1337 mach = argsToMach(ctx, args)
1338 if mach == None:
1340 cmdExistingVm(ctx, mach, 'teleport', args[2:])
1343 def portalsettings(_ctx, mach, args):
1345 mach.teleporterEnabled = enabled
1349 mach.teleporterPort = port
1350 mach.teleporterPassword = passwd
1356 mach = argsToMach(ctx, args)
1357 if mach == None:
1364 if not mach.teleporterEnabled or mach.teleporterPort != port or passwd:
1365 cmdClosedVm(ctx, mach, portalsettings, [True, port, passwd])
1366 startVm(ctx, mach, "gui")
1373 mach = argsToMach(ctx, args)
1374 if mach == None:
1376 if mach.teleporterEnabled:
1377 cmdClosedVm(ctx, mach, portalsettings, [False])
1384 mach = argsToMach(ctx, args)
1385 if mach == None:
1387 cmdExistingVm(ctx, mach, 'gueststats', args[2:])
1390 def plugcpu(_ctx, mach, args):
1395 mach.hotPlugCPU(cpu)
1398 mach.hotUnplugCPU(cpu)
1404 mach = argsToMach(ctx, args)
1405 if mach == None:
1407 if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
1408 if mach.CPUHotPlugEnabled:
1409 cmdClosedVm(ctx, mach, plugcpu, [True, int(args[2])])
1411 cmdExistingVm(ctx, mach, 'plugcpu', args[2])
1418 mach = argsToMach(ctx, args)
1419 if mach == None:
1421 if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
1422 if mach.CPUHotPlugEnabled:
1423 cmdClosedVm(ctx, mach, plugcpu, [False, int(args[2])])
1425 cmdExistingVm(ctx, mach, 'unplugcpu', args[2])
1429 expr = 'mach.'+args[0]+' = '+args[1]
1437 mach = argsToMach(ctx, args)
1438 if mach == None:
1440 cmdClosedVm(ctx, mach, setvar, args[2:])
1443 def setvmextra(_ctx, mach, args):
1446 print "%s: setting %s to %s" % (mach.name, key, value)
1447 mach.setExtraData(key, value)
1462 mach = argsToMach(ctx, args)
1463 if mach == None:
1465 cmdClosedVm(ctx, mach, setvmextra, [key, value])
1580 mach = argsToMach(ctx, args)
1581 if mach == None:
1587 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: monitorSource(ctx, console.eventSource, active, dur)])
1594 mach = argsToMach(ctx, args)
1595 if mach == None:
1601 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: monitorSource(ctx, console.keyboard.eventSource, active, dur)])
1608 mach = argsToMach(ctx, args)
1609 if mach == None:
1615 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: monitorSource(ctx, console.mouse.eventSource, active, dur)])
1622 mach = argsToMach(ctx, args)
1623 if mach == None:
1629 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: monitorSource(ctx, console.mouse.eventSource, active, dur)])
1664 mach = argsToMach(ctx, args)
1665 if mach == None:
1671 session = ctx['global'].openMachineSession(mach)
1672 mach = session.machine
1674 adapter = mach.getNetworkAdapter(adapterNum)
1681 mach.setExtraData(config + "/Protocol", proto)
1682 mach.setExtraData(config + "/HostPort", str(hostPort))
1683 mach.setExtraData(config + "/GuestPort", str(guestPort))
1685 mach.saveSettings()
1695 mach = argsToMach(ctx, args)
1696 if mach == None:
1705 data = mach.readLog(log, uOffset, 4096)
1718 mach = argsToMach(ctx, args)
1719 if mach == None:
1730 data = mach.readLog(log, uOffset, 512*1024)
1749 mach = argsToMach(ctx, args)
1750 if mach == None:
1763 data = mach.readLog(log, uOffset, 512*1024)
1933 mach = argsToMach(ctx, args)
1934 if mach is None:
1947 desc = mach.export(app)
2129 mach = argsToMach(ctx, args)
2130 if mach is None:
2140 gargs = [lambda ctx, mach, console, args: typeInGuest(console, text, delay)]
2141 cmdExistingVm(ctx, mach, 'guestlambda', gargs)
2196 def findDevOfType(ctx, mach, devtype):
2197 atts = ctx['global'].getArray(mach, 'mediumAttachments')
2241 def controldevice(ctx, mach, args):
2243 mach.attachDevice(ctr, port, slot, devtype, uuid)
2250 mach = argsToMach(ctx, args)
2251 if mach is None:
2264 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_HardDisk)
2266 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_HardDisk, hdd.id))
2269 def detachVmDevice(ctx, mach, args):
2270 atts = ctx['global'].getArray(mach, 'mediumAttachments')
2275 mach.detachDevice(a.controller, a.port, a.device)
2285 mach = argsToMach(ctx, args)
2286 if mach is None:
2296 detachMedium(ctx, mach.id, hdd)
2319 for mach in machs:
2320 print "Trying to detach from %s" % (mach)
2321 detachMedium(ctx, mach, hdd)
2400 mach = argsToMach(ctx, args)
2401 if mach is None:
2414 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
2415 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD, dvd))
2423 mach = argsToMach(ctx, args)
2424 if mach is None:
2434 detachMedium(ctx, mach.id, dvd)
2442 mach = argsToMach(ctx, args)
2443 if mach is None:
2458 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
2460 cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, dvd, True])
2469 mach = argsToMach(ctx, args)
2470 if mach is None:
2479 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
2481 cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, None, True])
2485 def attachCtr(ctx, mach, args):
2487 ctr = mach.addStorageController(name, bus)
2504 mach = argsToMach(ctx, args)
2505 if mach is None:
2512 cmdClosedVm(ctx, mach, attachCtr, [name, bus, ctrltype])
2520 mach = argsToMach(ctx, args)
2521 if mach is None:
2524 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.removeStorageController(ctr))
2527 def usbctr(ctx, mach, console, args):
2538 mach = argsToMach(ctx, args)
2539 if mach is None:
2542 cmdExistingVm(ctx, mach, 'guestlambda', [usbctr, True, dev])
2550 mach = argsToMach(ctx, args)
2551 if mach is None:
2554 cmdExistingVm(ctx, mach, 'guestlambda', [usbctr, False, dev])
2578 mach = argsToMach(ctx, args)
2579 if mach is None:
2592 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.createSharedFolder(name, path, writable), [])
2594 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: console.createSharedFolder(name, path, writable)])
2602 mach = argsToMach(ctx, args)
2603 if mach is None:
2607 for sf in ctx['global'].getArray(mach, 'sharedFolders'):
2609 cmdClosedVm(ctx, mach, lambda ctx, mach, args: mach.removeSharedFolder(name), [])
2613 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: console.removeSharedFolder(name)])
2624 mach = argsToMach(ctx, args)
2625 if mach is None:
2637 cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.takeSnapshot(name, desc, true)))
2645 snap = mach.findSnapshot(name)
2646 cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.restoreSnapshot(snap)))
2653 snap = mach.currentSnapshot()
2654 cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.restoreSnapshot(snap)))
2662 snap = mach.findSnapshot(name)
2663 cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.deleteSnapshot(snap.id)))
2669 def natAlias(ctx, mach, nicnum, nat, args=[]):
2707 def natSettings(ctx, mach, nicnum, nat, args):
2741 def natDns(ctx, mach, nicnum, nat, args):
2758 def natTftp(ctx, mach, nicnum, nat, args):
2781 bootfile = '%s.pxe' % (mach.name)
2799 def natPortForwarding(ctx, mach, nicnum, nat, args):
2845 def natNetwork(ctx, mach, nicnum, nat, args):
2889 mach = ctx['argsToMach'](args)
2890 if mach == None:
2893 if len(args) < 3 or not args[2].isdigit() or int(args[2]) not in range(0, ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType)):
2894 print 'please specify adapter num %d isn\'t in range [0-%d]' % (args[2], ctx['vb'].systemProperties.getMaxNetworkAdapters(mach.chipsetType))
2908 session = ctx['global'].openMachineSession(mach, False)
2909 mach = session.machine
2911 adapter = mach.getNetworkAdapter(nicnum)
2913 (rc, report) = natcommands[func](ctx, mach, nicnum, natEngine, cmdargs)
2916 mach.saveSettings()
2920 msg ='%s nic%d %s: %s' % (mach.name, nicnum, func, r)
3129 for mach in getMachines(ctx):
3130 cmdargs[1] = mach.id
3138 mach = argsToMach(ctx, args)
3139 if mach == None:
3145 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: recordDemo(ctx, console, filename, dur)])
3152 mach = argsToMach(ctx, args)
3153 if mach == None:
3159 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: playbackDemo(ctx, console, filename, dur)])
3193 mach = argsToMach(ctx, args)
3194 if mach == None:
3196 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx, mach, console, args: lspci(ctx, console)])
3203 mach = argsToMach(ctx, args)
3204 if mach == None:
3218 cmdClosedVm(ctx, mach, lambda ctx, mach, a: mach.attachHostPCIDevice(hostaddr, guestaddr, True))
3225 mach = argsToMach(ctx, args)
3226 if mach == None:
3233 cmdClosedVm(ctx, mach, lambda ctx, mach, a: mach.detachHostPCIDevice(hostaddr))
3495 mach = machById(ctx, uuid)
3496 if mach == None:
3499 cmdExistingVm(ctx, mach, 'guestlambda', args)