VirtualBox

Changeset 31014 in vbox


Ignore:
Timestamp:
Jul 22, 2010 4:24:56 PM (15 years ago)
Author:
vboxsync
Message:

Python: update for new session API

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r30871 r31014  
    233233    perf = ctx['perf']
    234234    session = mgr.getSessionObject(vb)
    235     uuid = mach.id
    236     progress = vb.openRemoteSession(session, uuid, type, "")
     235    progress = mach.launchVMProcess(session, type, "")
    237236    if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0:
    238237        # we ignore exceptions to allow starting VM even if
     
    492491        vb = ctx['vb']
    493492        session = ctx['mgr'].getSessionObject(vb)
    494         vb.openExistingSession(session, mach.id)
     493        mach.lockForSession(session, True)
    495494    except Exception,e:
    496495        printErr(ctx, "Session to '%s' not open: %s" %(mach.name,str(e)))
     
    498497            traceback.print_exc()
    499498        return
    500     if session.state != ctx['const'].SessionState_Open:
     499    if session.state != ctx['const'].SessionState_Locked:
    501500        print "Session to '%s' in wrong state: %s" %(mach.name, session.state)
    502501        session.close()
     
    536535
    537536def cmdClosedVm(ctx,mach,cmd,args=[],save=True):
    538     session = ctx['global'].openMachineSession(mach.id)
     537    session = ctx['global'].openMachineSession(mach, False)
    539538    mach = session.machine
    540539    try:
     
    551550
    552551def cmdAnyVm(ctx,mach,cmd, args=[],save=False):
    553     session = ctx['global'].openMachineSession(mach.id)
     552    session = ctx['global'].openMachineSession(mach)
    554553    mach = session.machine
    555554    try:
     
    10391038    if mach == None:
    10401039        return 0
    1041     if str(mach.sessionState) != str(ctx['const'].SessionState_Open):
     1040    if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
    10421041        cmdClosedVm(ctx, mach, lambda ctx, mach, a: guestExec (ctx, mach, None, ' '.join(args[2:])))
    10431042    else:
     
    11291128    if mach == None:
    11301129        return 0
    1131     if str(mach.sessionState) != str(ctx['const'].SessionState_Open):
     1130    if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
    11321131        if mach.CPUHotPlugEnabled:
    11331132            cmdClosedVm(ctx, mach, plugcpu, [True, int(args[2])])
     
    11431142    if mach == None:
    11441143        return 0
    1145     if str(mach.sessionState) != str(ctx['const'].SessionState_Open):
     1144    if str(mach.sessionState) != str(ctx['const'].SessionState_Locked):
    11461145        if mach.CPUHotPlugEnabled:
    11471146            cmdClosedVm(ctx, mach, plugcpu, [False, int(args[2])])
     
    13481347    guestPort = int(args[4])
    13491348    proto = "TCP"
    1350     session = ctx['global'].openMachineSession(mach.id)
     1349    session = ctx['global'].openMachineSession(mach)
    13511350    mach = session.machine
    13521351
     
    25332532    if len(cmdargs) > 1:
    25342533        rosession = 0
    2535         session = ctx['global'].openMachineSession(mach.id);
     2534        session = ctx['global'].openMachineSession(mach, False);
    25362535        mach = session.machine;
    25372536
     
    27102709    func = args[3]
    27112710    session = None
    2712     session = ctx['global'].openMachineSession(vm.id)
     2711    session = ctx['global'].openMachineSession(vm)
    27132712    vm = session.machine
    27142713    adapter = vm.getNetworkAdapter(nicnum)
  • trunk/src/VBox/Main/glue/vboxapi.py

    r30825 r31014  
    519519        self.platform.initPerThread()
    520520
    521     def openMachineSession(self, machineId):
     521    def openMachineSession(self, mach, permitSharing = True):
    522522         session = self.mgr.getSessionObject(self.vbox)
    523          try:
    524              self.vbox.openExistingSession(session, machineId)
    525          except:
    526              self.vbox.openSession(session, machineId)
     523         mach.lockForSession(session, permitSharing)
    527524         return session
    528525
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