Changeset 28637 in vbox
- Timestamp:
- Apr 23, 2010 12:14:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r28631 r28637 225 225 p.waitForCompletion(wait) 226 226 ctx['global'].waitForEvents(0) 227 return 0227 return 1 228 228 except KeyboardInterrupt: 229 229 print "Interrupted." … … 231 231 print "Canceling task..." 232 232 p.cancel() 233 return 1 234 235 236 237 def reportError(ctx,session,rc): 238 if not ctx['remote']: 239 print session.QueryErrorObject(rc) 240 233 return 0 234 235 def reportError(ctx,progress): 236 print progress.errorInfo 241 237 242 238 def createVm(ctx,name,kind,base): … … 269 265 uuid = mach.id 270 266 progress = vb.openRemoteSession(session, uuid, type, "") 271 progressBar(ctx, progress, 100) 272 completed = progress.completed 273 rc = int(progress.resultCode) 274 print "Completed:", completed, "rc:",hex(rc&0xffffffff) 275 if rc == 0: 267 if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0: 276 268 # we ignore exceptions to allow starting VM even if 277 269 # perf collector cannot be started … … 286 278 session.close() 287 279 else: 288 reportError(ctx, session,rc)280 reportError(ctx,progress) 289 281 290 282 def getMachines(ctx, invalidate = False): … … 398 390 print "Teleporting to %s:%d..." %(host,port) 399 391 progress = console.teleport(host, port, passwd, maxDowntime) 400 progressBar(ctx, progress, 100) 401 completed = progress.completed 402 rc = int(progress.resultCode) 403 if rc == 0: 392 if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0: 404 393 print "Success!" 405 394 else: 406 reportError(ctx, session,rc)395 reportError(ctx,progress) 407 396 408 397 … … 758 747 print "executing %s with %s" %(args[0], args[1:]) 759 748 (progress, pid) = console.guest.executeProcess(args[0], 0, args[1:], [], "", "", "", user, passwd, tmo) 760 print "executed with pid %d" %(pid) 749 if progressBar(ctx,progress, 10): 750 print "executed with pid %d" %(pid) 751 else: 752 reportError(ctx, progress) 761 753 762 754 def gexecCmd(ctx,args): … … 1301 1293 desc.addDescription(ctx['global'].constants.VirtualSystemDescriptionType_License, license, "") 1302 1294 p = app.write(format, path) 1303 progressBar(ctx, p) 1304 if (p.completed and int(p.resultCode) == 0): 1295 if (progressBar(ctx, p) and int(p.resultCode) == 0): 1305 1296 print "Exported to %s in format %s" %(path, format) 1297 else: 1298 reportError(ctx,p) 1306 1299 return 0 1307 1300 … … 1562 1555 hdd = ctx['vb'].createHardDisk(format, loc) 1563 1556 progress = hdd.createBaseStorage(size, ctx['global'].constants.MediumVariant_Standard) 1564 ctx['progressBar'](progress)1565 1566 if not hdd.id:1557 if progressBar(ctx,progress) and hdd.id: 1558 print "created HDD at %s as %s" %(hdd.location, hdd.id) 1559 else: 1567 1560 print "cannot create disk (file %s exist?)" %(loc) 1568 return 0 1569 1570 print "created HDD at %s as %s" %(hdd.location, hdd.id) 1561 reportError(ctx,progress) 1562 return 0 1571 1563 1572 1564 return 0 … … 1684 1676 1685 1677 progress = hdd.deleteStorage() 1686 ctx['progressBar'](progress)1678 progressBar(ctx,progress) 1687 1679 1688 1680 return 0 … … 1731 1723 1732 1724 progress = dvd.deleteStorage() 1733 ctx['progressBar'](progress) 1734 print "Removed ISO at %s" %(dvd.location) 1735 1725 if progressBar(ctx,progress): 1726 print "Removed ISO at %s" %(dvd.location) 1727 else: 1728 reportError(ctx,progress) 1736 1729 return 0 1737 1730
Note:
See TracChangeset
for help on using the changeset viewer.