Last active
June 30, 2019 18:45
-
-
Save mjdorma/d134f437c16df1871fcd to your computer and use it in GitHub Desktop.
pyvbox: setup appliance description and import_machines.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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