Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mjdorma/d134f437c16df1871fcd to your computer and use it in GitHub Desktop.
Save mjdorma/d134f437c16df1871fcd to your computer and use it in GitHub Desktop.
pyvbox: setup appliance description and import_machines.
"""pyvbox: setup appliance description and import_machines.
"""
import virtualbox
vbox = virtualbox.VirtualBox()
# Create new IAppliance and read the exported machine
# called 'ubuntu'.
appliance = vbox.create_appliance()
appliance.read("~/Documents/ubuntu.ova")
# Extract the IVirtualSystemDescription object
# for 'ubuntu' and set its name to 'foobar' and cpu '2'.
desc = appliance.find_description('ubuntu')
desc.set_name('foobar')
desc.set_cpu('2')
# perform import
p = appliance.import_machines()
p.wait_for_completion()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment