I want to build a VM image and deploy it to proxmox using the API. Last year I implemented a solution by uploading the VMDK to proxmox via side-channel, then importing that VMDK as the disk - documented here.
Proxmox now has an official way to upload OVA files, so I'd like to get rid of the side-channel. I upload like this:
Now how do I use the API to tell proxmox to make a VM from the OVA? I cannot manually extract it, so there must be an all-in-one endpoint used by the import GUI. I tried stuffing the .ova file into a parameter of the all-mighty qemu endpoint:
But that just gives me "Status code was 500 and not [200]: HTTP Error 500: volume 'nac1.svm_pve_eimfstest_hdd:import/1.10.0.1361-virtual-wt-amd64.ova' - not a QEMU image format 'ova'".
Bonus question: Is there a way to upload a cloud-init config? Or would I need to keep using my side-channel to provide those?
Proxmox now has an official way to upload OVA files, so I'd like to get rid of the side-channel. I upload like this:
Code:
curl -k -H 'Content-Type: multipart/form-data' -s -X POST 'https://proxmox.example.org:8006/api2/json/nodes/proxmox41/storage/nac1.svm_pve_eimfstest_hdd/upload' -H "Authorization: PVEAPIToken=$(cat proxmox-api-token.txt)" -F content=import -F "filename=@1.10.0.1361-virtual-wt-amd64.ova" --verbose
Now how do I use the API to tell proxmox to make a VM from the OVA? I cannot manually extract it, so there must be an all-in-one endpoint used by the import GUI. I tried stuffing the .ova file into a parameter of the all-mighty qemu endpoint:
Code:
url: "https://{{ api_host }}:8006/api2/json/nodes/{{ node }}/qemu"
method: POST
headers:
Authorization: "{{ proxmox_auth_cookie }}"
body:
vmid: "{{ vm_id }}"
name: "{{ vm_name }}"
storage: "{{ vm_storage }}"
cores: 6
cpu: 'host'
memory: 16384
bios: 'ovmf'
sata0: "{{ vm_storage }}:0,import-from={{ ova_upload_storage }}:import/1.10.0.1361-virtual-wt-amd64.ova"
ide2: "{{ vm_storage }}:cloudinit"
efidisk0: "{{ vm_storage }}:1" # 0 to allow import-from
But that just gives me "Status code was 500 and not [200]: HTTP Error 500: volume 'nac1.svm_pve_eimfstest_hdd:import/1.10.0.1361-virtual-wt-amd64.ova' - not a QEMU image format 'ova'".
Bonus question: Is there a way to upload a cloud-init config? Or would I need to keep using my side-channel to provide those?