I never found a complete example of this anywhere and the SDKRef loosely refers to this process without giving an example. Hopefully this makes life easier for others. This example illustrate how to change the memory of a system.
Code: Select all
>>> import vboxapi
>>> vbm = vboxapi.VirtualBoxManager(None, None)
>>> m = vbm.vbox.findMachine("example")
>>> session = vbm.mgr.getSessionObject(vbm.vbox)
>>> m.lockMachine(session, vbm.constants.LockType_Write)
>>> session.machine.memorySize = 1234
>>> session.machine.saveSettings()
>>> session.unlockMachine()Code: Select all
>>> try:
... m.lockMachine(session, vbm.constants.LockType_Write)
... session.machine.memorySize = 1234
... session.machine.saveSettings()
>>> finally:
... session.unlockMachine()