3.5.14.2 Python

Importing the Assembly

Importing an assembly into Oracle VM Manager in Python using the SOAP API is straightforward. Obtain the ID for the repository where you wish to import the assembly and then call the repositoryImportAssembly method, providing it with the URL that Oracle VM Manager should use to download the assembly.

assembly_url='http://example.com/assemblys/my_assembly.ovf
job=client.service.repositoryImportAssembly(repo_id,assembly_url)
assembly_id=wait_for_job(client,job.id)
Importing a Virtual Machine From an Assembly

Once the assembly has completed its import, it is possible to query the API to obtain the ID values for virtual machines contained within the assembly. An assembly Vm ID is required to import it as a functional virtual machine within your environment. In this example we import all of the virtual machines in the assembly into our environment:

assembly=client.service.assemblyGetById(assembly_id)
if has_attr(assembly,'assemblyVmIds'):
    for vm in assembly.assemblyVmIds:
        job=client.service.vmCreateFromAssemblyVm(vm)
        wait_for_job(client,job.id)