VirtualBox

Changeset 67049 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 23, 2017 5:48:32 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115695
Message:

Main/glue/vboxapi.py: clean up, remove vbox attribute, eliminate unnecessary parameter of getSessionObject (it is a completely ignored parameter with a default parameter to make life a little simpler for API clients in Python to deal with the previous version still)
Frontends/VBoxShell: adapt to the cleanup, reduce the unnecessary variations in the code dealing with sessions
ValidationKit etc.: adapt to the cleanup

File:
1 edited

Legend:

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

    r63231 r67049  
    267267    vbox = ctx['vb']
    268268    perf = ctx['perf']
    269     session = ctx['global'].getSessionObject(vbox)
     269    session = ctx['global'].getSessionObject()
    270270    progress = mach.launchVMProcess(session, vmtype, "")
    271271    if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0:
     
    700700    try:
    701701        vbox = ctx['vb']
    702         session = ctx['global'].getSessionObject(vbox)
    703         mach.lockMachine(session, ctx['global'].constants.LockType_Shared)
     702        session = ctx['global'].openMachineSession(mach, fPermitSharing=True)
    704703    except Exception as e:
    705704        printErr(ctx, "Session to '%s' not open: %s" % (mach.name, str(e)))
     
    747746
    748747def cmdClosedVm(ctx, mach, cmd, args=[], save=True):
    749     session = ctx['global'].openMachineSession(mach, True)
     748    session = ctx['global'].openMachineSession(mach, fPermitSharing=True)
    750749    mach = session.machine
    751750    try:
     
    767766
    768767def cmdAnyVm(ctx, mach, cmd, args=[], save=False):
    769     session = ctx['global'].openMachineSession(mach)
     768    session = ctx['global'].openMachineSession(mach, fPermitSharing=True)
    770769    mach = session.machine
    771770    try:
     
    16701669    guestPort = int(args[4])
    16711670    proto = "TCP"
    1672     session = ctx['global'].openMachineSession(mach)
     1671    session = ctx['global'].openMachineSession(mach, fPermitSharing=True)
    16731672    mach = session.machine
    16741673
     
    18791878
    18801879    ctx['wsinfo'] = [url, user, passwd]
    1881     vbox = ctx['global'].platform.connect(url, user, passwd)
    1882     ctx['vb'] = vbox
     1880    ctx['vb'] = ctx['global'].platform.connect(url, user, passwd)
    18831881    try:
    1884         print("Running VirtualBox version %s" % (vbox.version))
     1882        print("Running VirtualBox version %s" % (ctx['vb'].version))
    18851883    except Exception as e:
    18861884        printErr(ctx, e)
     
    19261924        if g_fVerbose:
    19271925            traceback.print_exc()
     1926    ctx['perf'] = ctx['global'].getPerfCollector(ctx['vb'])
    19281927    return 0
    19291928
     
    29062905    if len(cmdargs) > 1:
    29072906        rosession = 0
    2908         session = ctx['global'].openMachineSession(mach, False)
     2907        session = ctx['global'].openMachineSession(mach, fPermitSharing=False)
    29092908        mach = session.machine
    29102909
     
    30843083    func = args[3]
    30853084    session = None
    3086     session = ctx['global'].openMachineSession(vm)
     3085    session = ctx['global'].openMachineSession(vm, fPermitSharing=True)
    30873086    vm = session.machine
    30883087    adapter = vm.getNetworkAdapter(nicnum)
     
    35403539        asLocations = [ os.getcwd(), ]
    35413540        try:    sScriptDir = os.path.dirname(os.path.abspath(__file__))
    3542         except: pass; # In case __file__ isn't there.
     3541        except: pass # In case __file__ isn't there.
    35433542        else:
    35443543            if platform.system() in [ 'SunOS', ]:
     
    35843583    ctx = {
    35853584        'global':       oVBoxMgr,
    3586         'vb':           oVBoxMgr.vbox,
     3585        'vb':           oVBoxMgr.getVirtualBox(),
    35873586        'const':        oVBoxMgr.constants,
    35883587        'remote':       oVBoxMgr.remote,
     
    36053604    #
    36063605    for sKey in list(ctx.keys()):
    3607         del ctx[sKey];
    3608     ctx = None;
    3609     gc.collect();
     3606        del ctx[sKey]
     3607    ctx = None
     3608    gc.collect()
    36103609
    36113610    oVBoxMgr.deinit()
Note: See TracChangeset for help on using the changeset viewer.

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