Changeset 18123 in vbox
- Timestamp:
- Mar 20, 2009 4:39:48 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 44799
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/sample/shellcommon.py
r17908 r18123 204 204 print metric['name'], metric['values_as_string'] 205 205 206 def cmdExistingVm(ctx,mach,cmd): 206 def guestExec(ctx, machine, console, cmds): 207 exec cmds 208 209 def cmdExistingVm(ctx,mach,cmd,args): 207 210 mgr=ctx['mgr'] 208 211 vb=ctx['vb'] … … 224 227 print 'Trying to use local only functionality, ignored' 225 228 return 226 console=session.console 229 console=session.console 227 230 ops={'pause' : lambda: console.pause(), 228 231 'resume': lambda: console.resume(), 229 232 'powerdown': lambda: console.powerDown(), 230 233 'stats': lambda: guestStats(ctx, mach), 234 'guest': lambda: guestExec(ctx, mach, console, args) 231 235 } 232 ops[cmd]() 236 try: 237 ops[cmd]() 238 except Exception, e: 239 print 'failed: ',e 240 if g_verbose: 241 traceback.print_exc() 242 233 243 session.close() 234 244 … … 340 350 if mach == None: 341 351 return 0 342 cmdExistingVm(ctx, mach, 'pause' )352 cmdExistingVm(ctx, mach, 'pause', '') 343 353 return 0 344 354 … … 347 357 if mach == None: 348 358 return 0 349 cmdExistingVm(ctx, mach, 'powerdown' )359 cmdExistingVm(ctx, mach, 'powerdown', '') 350 360 return 0 351 361 … … 354 364 if mach == None: 355 365 return 0 356 cmdExistingVm(ctx, mach, 'resume' )366 cmdExistingVm(ctx, mach, 'resume', '') 357 367 return 0 358 368 … … 361 371 if mach == None: 362 372 return 0 363 cmdExistingVm(ctx, mach, 'stats') 373 cmdExistingVm(ctx, mach, 'stats', '') 374 return 0 375 376 def guestCmd(ctx, args): 377 if (len(args) < 3): 378 print "usage: guest name commands" 379 return 0 380 mach = argsToMach(ctx,args) 381 if mach == None: 382 return 0 383 cmdExistingVm(ctx, mach, 'guest', ' '.join(args[2:])) 364 384 return 0 365 385 … … 446 466 'eval':['Evaluate arbitrary Python construction: eval for m in getMachines(ctx): print m.name,"has",m.memorySize,"M"', evalCmd], 447 467 'quit':['Exits', quitCmd], 448 'host':['Show host information', hostCmd]} 468 'host':['Show host information', hostCmd], 469 'guest':['Execute command for guest: guest Win32 console.mouse.putMouseEvent(20, 20, 0, 0)', guestCmd], 470 } 449 471 450 472 def runCommand(ctx, cmd):
Note:
See TracChangeset
for help on using the changeset viewer.