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

Define iso storage on CloudInit #119

Open
SnelsSM opened this issue Feb 25, 2024 · 7 comments
Open

Define iso storage on CloudInit #119

SnelsSM opened this issue Feb 25, 2024 · 7 comments

Comments

@SnelsSM
Copy link

SnelsSM commented Feb 25, 2024

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?

@luthermonson
Copy link
Owner

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

@luthermonson
Copy link
Owner

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.

@SnelsSM
Copy link
Author

SnelsSM commented 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.

@luthermonson
Copy link
Owner

luthermonson commented 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

@luthermonson
Copy link
Owner

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

@SnelsSM
Copy link
Author

SnelsSM commented 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

@luthermonson
Copy link
Owner

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

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