VirtualBox

Changeset 31959 in vbox for trunk


Ignore:
Timestamp:
Aug 25, 2010 1:30:40 PM (14 years ago)
Author:
vboxsync
Message:

vboxshell: gracefull handling of unavailable VMs, better treatment of closed VM commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r31783 r31959  
    257257    result = []
    258258    for m in list:
    259         elem = CachedMach(m)
    260         result.append(elem)
     259        try:
     260            elem = CachedMach(m)
     261            result.append(elem)
     262        except:
     263            pass
    261264    return result
    262265
     
    561564
    562565def cmdClosedVm(ctx,mach,cmd,args=[],save=True):
    563     session = ctx['global'].openMachineSession(mach, False)
     566    session = ctx['global'].openMachineSession(mach, True)
    564567    mach = session.machine
    565568    try:
     
    571574            traceback.print_exc()
    572575    if save:
    573          mach.saveSettings()
     576        try:
     577            mach.saveSettings()
     578        except Exception, e:
     579            printErr(ctx,e)
     580            if g_verbose:
     581                traceback.print_exc()
    574582    ctx['global'].closeMachineSession(session)
    575583
     
    764772def listCmd(ctx, args):
    765773    for m in getMachines(ctx, True):
    766         if m.teleporterEnabled:
    767             tele = "[T] "
    768         else:
    769             tele = "    "
    770         print "%sMachine '%s' [%s], machineState=%s, sessionState=%s" %(tele,colVm(ctx,m.name),m.id,asEnumElem(ctx, "MachineState", m.state), asEnumElem(ctx,"SessionState", m.sessionState))
     774        try:
     775            if m.teleporterEnabled:
     776                tele = "[T] "
     777            else:
     778                tele = "    "
     779                print "%sMachine '%s' [%s], machineState=%s, sessionState=%s" %(tele,colVm(ctx,m.name),m.id,asEnumElem(ctx, "MachineState", m.state), asEnumElem(ctx,"SessionState", m.sessionState))
     780        except Exception, e:
     781            printErr(ctx,e)
     782            if g_verbose:
     783                traceback.print_exc()
    771784    return 0
    772785
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette