[GH-ISSUE #119] Define iso storage on CloudInit #24

Open
opened 2026-03-03 15:29:40 +03:00 by kerem · 8 comments
Owner

Originally created by @SnelsSM on GitHub (Feb 25, 2024).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/119

Hi!
How to define storage for CloudInit function?

I'm trying to use context.WithValue something like

isoStorage, _ := node.StorageISO(context.Background())
ctxISO := context.WithValue(ctx, &isoStorage.Name, "templates")
target.CloudInit(ctxISO, "ide0", vm.CloudInit.UserData, "", "", vm.CloudInit.NetworkData)

but without success.

What am I doing wrong?

Originally created by @SnelsSM on GitHub (Feb 25, 2024). Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/119 Hi! How to define storage for CloudInit function? I'm trying to use context.WithValue something like ``` isoStorage, _ := node.StorageISO(context.Background()) ctxISO := context.WithValue(ctx, &isoStorage.Name, "templates") target.CloudInit(ctxISO, "ide0", vm.CloudInit.UserData, "", "", vm.CloudInit.NetworkData) ``` but without success. What am I doing wrong?
Author
Owner

@luthermonson commented on GitHub (Feb 25, 2024):

the cloud init func takes care of this for you: https://github.com/luthermonson/go-proxmox/blob/main/virtual_machine.go#L143-L146

<!-- gh-comment-id:1963034240 --> @luthermonson commented on GitHub (Feb 25, 2024): the cloud init func takes care of this for you: https://github.com/luthermonson/go-proxmox/blob/main/virtual_machine.go#L143-L146
Author
Owner

@luthermonson commented on GitHub (Feb 25, 2024):

i guess im also confused as to what youre trying to even do, are you naming your iso storage "templates" some how? there is no support for any storage types besides iso,vztmpl,backup,rootdir,images and proxmox wants ISOs in the iso storage so the cloudinit func puts them there.

<!-- gh-comment-id:1963035275 --> @luthermonson commented on GitHub (Feb 25, 2024): i guess im also confused as to what youre trying to even do, are you naming your iso storage "templates" some how? there is no support for any storage types besides `iso,vztmpl,backup,rootdir,images` and proxmox wants ISOs in the iso storage so the cloudinit func puts them there.
Author
Owner

@SnelsSM commented on GitHub (Feb 25, 2024):

@luthermonson
I have several storages that store ISOs. But for cloud-init ISOs, I want to define a storage with a specific name. In my case, this storage is called "templates". But the CloudInit function saves the ISOs in random storage.

<!-- gh-comment-id:1963050189 --> @SnelsSM commented on GitHub (Feb 25, 2024): @luthermonson I have several storages that store ISOs. But for cloud-init ISOs, I want to define a storage with a specific name. In my case, this storage is called "templates". But the CloudInit function saves the ISOs in random storage.
Author
Owner

@luthermonson commented on GitHub (Feb 25, 2024):

can you show me the contents of pvesh get /nodes/{node}/storage ? make sure you anonymize anything that you dont want the world to see

<!-- gh-comment-id:1963063296 --> @luthermonson commented on GitHub (Feb 25, 2024): can you show me the contents of `pvesh get /nodes/{node}/storage` ? make sure you anonymize anything that you dont want the world to see
Author
Owner

@luthermonson commented on GitHub (Feb 25, 2024):

so it's not random by the way, it loops over storage results returned from this endpoint and chooses the first one which is allows the content type of "iso", the logic is here: https://github.com/luthermonson/go-proxmox/blob/main/nodes.go#L202-L211

we could allow for allowing the storage to be passed in or filtered differently... show me the output and let's see what we can work with

<!-- gh-comment-id:1963064088 --> @luthermonson commented on GitHub (Feb 25, 2024): so it's not random by the way, it loops over storage results returned from this endpoint and chooses the first one which is allows the content type of "iso", the logic is here: https://github.com/luthermonson/go-proxmox/blob/main/nodes.go#L202-L211 we could allow for allowing the storage to be passed in or filtered differently... show me the output and let's see what we can work with
Author
Owner

@SnelsSM commented on GitHub (Feb 26, 2024):

can you show me the contents of pvesh get /nodes/{node}/storage ? make sure you anonymize anything that you dont want the world to see

image

The "qnap" and "templates" storages can store iso in my case. But for store cloud-init isos I prefer to use only storage named "templates" because that storage is more reliable than "qnap".
And I have no idea how to do it.

so it's not random by the way, it loops over storage results returned from this endpoint and chooses the first one which is allows the content type of "iso", the logic is here: https://github.com/luthermonson/go-proxmox/blob/main/nodes.go#L202-L211

we could allow for allowing the storage to be passed in or filtered differently... show me the output and let's see what we can work with

Some temporary storages may store the iso for some maintenance/debugging.
In this case, it may happen that the cloud-init iso will be saved in some temporary storage, which will then be deleted.
VMs startup will be broken.

There is another problem here. Sometimes CloudInit tries to use storage "local" or "cephfs", which is disabled.
In this case, an error occurs:

500 storage 'local' is disabled
500 storage 'cephfs' is disabled
<!-- gh-comment-id:1963278298 --> @SnelsSM commented on GitHub (Feb 26, 2024): > can you show me the contents of `pvesh get /nodes/{node}/storage` ? make sure you anonymize anything that you dont want the world to see ![image](https://github.com/luthermonson/go-proxmox/assets/6932851/0e78e663-9a5f-4a97-8286-5b2236d508d5) The "qnap" and "templates" storages can store iso in my case. But for store cloud-init isos I prefer to use only storage named "templates" because that storage is more reliable than "qnap". And I have no idea how to do it. > so it's not random by the way, it loops over storage results returned from this endpoint and chooses the first one which is allows the content type of "iso", the logic is here: https://github.com/luthermonson/go-proxmox/blob/main/nodes.go#L202-L211 > > we could allow for allowing the storage to be passed in or filtered differently... show me the output and let's see what we can work with Some temporary storages may store the iso for some maintenance/debugging. In this case, it may happen that the cloud-init iso will be saved in some temporary storage, which will then be deleted. VMs startup will be broken. There is another problem here. Sometimes CloudInit tries to use storage "local" or "cephfs", which is disabled. In this case, an error occurs: ``` 500 storage 'local' is disabled 500 storage 'cephfs' is disabled ```
Author
Owner

@luthermonson commented on GitHub (Feb 26, 2024):

oh ya i could imagine it might appear random is the proxmox api sometimes return results in different orders. it's only picking storage that CAN have isos and it just so happens you have 2 that are disabled and the one it tries it never gets too... let me think about this for a bit and try and get a local setup that looks similar

<!-- gh-comment-id:1963303695 --> @luthermonson commented on GitHub (Feb 26, 2024): oh ya i could imagine it might appear random is the proxmox api sometimes return results in different orders. it's only picking storage that CAN have isos and it just so happens you have 2 that are disabled and the one it tries it never gets too... let me think about this for a bit and try and get a local setup that looks similar
Author
Owner

@xeor commented on GitHub (Nov 11, 2025):

I think this is still an issue. I'm doing some labbing on proxmox using capi and ionos-cloud/cluster-api-provider-proxmox. I got 2 iso shares, one writable for cloud-init's and one on nfs that is read-only for os images. The vm's fails randomly to load their cloud-inits because it tries to create them on the wrong iso-volume..

<!-- gh-comment-id:3518905663 --> @xeor commented on GitHub (Nov 11, 2025): I think this is still an issue. I'm doing some labbing on proxmox using capi and ionos-cloud/cluster-api-provider-proxmox. I got 2 iso shares, one writable for cloud-init's and one on nfs that is read-only for os images. The vm's fails randomly to load their cloud-inits because it tries to create them on the wrong iso-volume..
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-proxmox#24
No description provided.