Reputation: 331
I am using pyvmomi to to deploy virtual machine to vCenter using ovf template. By default it takes virtual machine name as specified in .ovf file. I am not able to figure out where in my code (i.e while creating import specifications or in ImportVapp) i can specify the new virtual machine name to override that in .ovf file.
Here is code snippet:
# Create import specifications
ovfManager = self.session.content.ovfManager
specParams = vim.OvfManager.CreateImportSpecParams()
importSpec = ovfManager.CreateImportSpec(
ovfDescriptor, resourcePool, datastore, specParams)
# Create virtual machine
lease = resourcePool.ImportVApp(importSpec.importSpec,
datacenter.vmFolder, host)
Thanks for help.
Upvotes: 1
Views: 1358
Reputation: 331
After a lot of searching in pyvmomi api documentation i found the solution to this: While creating import specification parameters, we need to set 'entityName' attribute.
specParams = vim.OvfManager.CreateImportSpecParams(entityName='new_linux_vm')
Upvotes: 2