I need to create (export) a virtual machine (VirtualBox) to a OVA/OVF appliance.
I tried to use the IMachine.export_to()
method (through pyvbox wrapper) like this:
import virtualbox
from virtualbox.library import ExportOptions
vbox = virtualbox.VirtualBox()
vm = vbox.find_machine(VM_NAME)
appliance = vbox.create_appliance()
p = appliance.write('ovf-2.0',
[ExportOptions.create_manifest],
'~/tmp/test5.ovf')
desc = slredmine.export_to(appliance, '~/tmp/test5.ovf')
The above code doesn't do what I want: no ova/ovf is created.
UPDATE
The instructions order was wrong. See my answer written below.
Solved
import virtualbox
from virtualbox.library import ExportOptions
VM_NAME = 'foovmname'
vbox = virtualbox.VirtualBox()
vm = vbox.find_machine(VM_NAME)
appliance = vbox.create_appliance()
desc = slredmine.export_to(appliance, VM_NAME)
p = appliance.write('ovf-2.0',
[ExportOptions.create_manifest],
'~/tmp/test5.ovf')