2
恢復VM我想在VirtualBox的API以恢復虛擬機,但我得到這個異常:無法在Python API的virtualbox
AttributeError: '<win32com.gen_py.VirtualBox Type Library.IConsole instance at 0x41746480>' object has no attribute 'restoreSnapshot'
我怎樣才能解決呢?
這裏是我的代碼:
import vboxapi
def wait(sth):
sth.waitForCompletion(-1)
class Foo:
mgr=vboxapi.VirtualBoxManager()
vbox=mgr.vbox
vm=vbox.findMachine(const.VM_NAME)
def __init__(self):
self.session=self.mgr.getSessionObject(self.vbox)
wait(self.vm.launchVMProcess(self.session, 'gui', ''))
def restore(self):
console=self.session.console
wait(console.powerDown())
wait(console.restoreSnapshot(self.vm.findSnapshot('test')))
wait(console.powerUp())
foo=Foo()
foo.restore()
我使用Python 3.4下vboxapi 5.0.10。
另外,當我根據VirtualBox SDK Ref將console.restoreSnapshot
更改爲self.vm.restoreSnapshot
時,它說Method Machine::restoreSnapshot is not implemented
。