VirtualBox

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


Ignore:
Timestamp:
Mar 30, 2010 11:46:55 PM (15 years ago)
Author:
vboxsync
Message:

VBoxShell: Make it possible to add/remove a CPU while the VM is powered off

File:
1 edited

Legend:

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

    r27713 r27847  
    818818    if mach == None:
    819819        return 0
    820     cmdExistingVm(ctx, mach, 'plugcpu', args[2])
     820    if str(mach.sessionState) != str(ctx['ifaces'].SessionState_Open):
     821        if mach.CPUHotPlugEnabled:
     822            session = ctx['global'].openMachineSession(mach.id)
     823            mach1 = session.machine
     824            cpu = int(args[2])
     825            print "Adding CPU %d..." %(cpu)
     826            mach1.hotPlugCPU(cpu)
     827            mach1.saveSettings()
     828            session.close()
     829    else:
     830        cmdExistingVm(ctx, mach, 'plugcpu', args[2])
    821831    return 0
    822832
     
    828838    if mach == None:
    829839        return 0
    830     cmdExistingVm(ctx, mach, 'unplugcpu', args[2])
     840    if str(mach.sessionState) != str(ctx['ifaces'].SessionState_Open):
     841        if mach.CPUHotPlugEnabled:
     842            session = ctx['global'].openMachineSession(mach.id)
     843            mach1 = session.machine
     844            cpu = int(args[2])
     845            print "Removing CPU %d..." %(cpu)
     846            mach1.hotUnplugCPU(cpu)
     847            mach1.saveSettings()
     848            session.close()
     849    else:
     850        cmdExistingVm(ctx, mach, 'unplugcpu', args[2])
    831851    return 0
    832852
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