vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

Help! OVA export function #705

Closed srg1177 closed 2 years ago

srg1177 commented 2 years ago

Is your feature request related to a problem? Please describe.

Need a script for OVA export, currently can find a only for OVF.

Describe the solution you'd like

Functionally to be able to export an OVA from Vsphere.

Describe alternatives you've considered

No response

Additional context

No response

pgbidkar commented 2 years ago

Hi @srg1177 , Please can you check this https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/deploy_ova.py ? Does this fit your requirement?

srg1177 commented 2 years ago

Hey @pgbidkar, thanks for your reply, if Im not mistaken this method id importing OVA in to the datastore. I need the opposite one, for exporting a VM as a OVA.

prziborowski commented 2 years ago

Hi @srg1177, I noticed your message in #532. OVA is just a packaging of the ovf file along with signature and other files (e.g. disks). You could do it inside python itself (leveraging tarfile), or just calling some other binary (e.g. tar).

https://stackoverflow.com/questions/21118311/ordering-files-inside-tar-created-from-bash has some details on that. For proper streaming support, it should be ordered (ovf, mf, followed by the order the files are in the ovf file).

As for exporting the VM, there is an export_vm.py sample.

srg1177 commented 2 years ago

Hey @prziborowski, much appreciate your response.