Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API calls for doing a disk import? #145

Open
justinclift opened this issue Apr 29, 2024 · 5 comments
Open

API calls for doing a disk import? #145

justinclift opened this issue Apr 29, 2024 · 5 comments

Comments

@justinclift
Copy link

justinclift commented Apr 29, 2024

Trying to do a disk import, as would be done using qm disk import, but remotely using the API:

# qm disk import 100 /path/to/some/disk.qcow2 local-zfs

Not really seeing anything obviously correct for this, and nothing suitable is showing up in the official API viewer either as I look through it.

Anyone have suggestions? 😄

@justinclift
Copy link
Author

Hmmm, this might be the correct API call:

https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/storage/{storage}/content

Will probably try that out later on today. 😄

@justinclift
Copy link
Author

That API end point can indeed create new VM disk/volume definitions:

# pvesh create /nodes/somenode/storage/local-zfs/content --filename "vm-100-disk-4" --size 1G --vmid 100

That creates the new ZFS volume in the local-zfs storage, and also creates the matching (empty) ZFS volume in the backend ZFS pool.

I'm not (yet) seeing how to fill that volume with actual disk data though. If the Go code was running on the server then it could just directly write into the disk device.

But how to do it remotely? That's the next needed step.

@justinclift
Copy link
Author

justinclift commented Apr 30, 2024

Looking at the qm source code, it seems like the loading of data into the newly created volume is done by qemu-img running on the node itself and writing directly into the destination device:

That may mean there's no mechanism in place (yet) for uploading disk images remotely via the API. Well, data other than ISO images and templates.

Will probably need to ask on the Proxmox forum somewhere, or pve-devel mailing list. 😄

@justinclift
Copy link
Author

Looks like this isn't yet possible. 😦

https://forum.proxmox.com/threads/proxmox-api-import-disk.68171/

@luthermonson
Copy link
Owner

well that's a bummer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants