Passing Variables from Proxmox Server to Windows and Linux Guest VM's Running on Same

ajm

Member
Dec 13, 2020
6
0
6
61
I am experimenting with proxmox and virtualization and this is my first post. But I am a relatively experienced networking, windows, macos and linux engineer, with some programming experience. If my experiments are successful I intend to run proxmox on 2+ x 32 core AMD EPYC workstations, configured with 22 x 12TB HDD, 16 x 4TB SSD, 512GB of RAM, 2 x Quadro RTX 4000 and used for 4K video editing and storage by 2 users simultaneously.

The proxmox host runs samba, along with VM's. I am attempting to pass variables (e.g. proxmox server hostname and VM guest hostname) from a proxmox server to windows and/or linux 10 VM's running on the same host, without manually setting these parameters or variables in the guest VM after boot.

I want to do this for many reasons including; automating logon and drive mapping scripts in the guest VM referring to the proxmox samba host (great for single host single VM installations such as a notebook), being able to use/change the proxmox VM name as the guest host name without needing to change it in the VM itself (great for inexperienced users running a clone vm on a single host when the primary vm on that host has failed, again handy for notebook installations of proxmox), etc. I will then reuse these scripts for any new proxmox installation.

It seems to me that many others would want to do similar things, but in my searches I have not found any simple solutions to the problem without manually setting the proxmox host name and the VM's host name in VM scripts.

Any ideas of how to pass user defined variables or parameters from the Proxmox server to any guest VM the server hosting the VM and then how to access those variables or parameters in the guest VM would be greatly appreciated. I would prefer bash scripts, or windows powershell scripts for access of the information passed.

I have experimented with qemu-guest-agent but it appears to only allow specific information defined by qemu-guest-agent, rather than user-defined information, but as I said, I am inexperienced in these matters.

Thanks in advance.

Regards

ajm
 
What's with a shared storage?
Can be just a gigabyte in size, but you have access to it, from all vm's and the host.

Didn't seen or looked explicitly if this exists in proxmox, but hyperv has that option.
 
If that doesn't exist in proxmox, well, the other idea i think of, is adding a dummy nic and changing the mac address on it, then grepping that inside your vm :D
 
Hi Ramalama

I need a solution that is self-contained within the proxmox host or the vm's on the host. In some cases I do pass through all of the proxmox host's USB ports (for keyboard/mouse, and attached USB items like extra video via USB etc), so I suppose that I could pass the data through that way with a fixed drive allocation for a USB stick on the VM. But that makes it available to only one VM. Not very elegant.

I do make storage available from the host to the VM via samba, but that requires knowing the proxmox server hostname, therefore back to the same problem. I suppose I could provide an alias for the proxmox smb server name (i.e. local), and then map drives via //local/share/. That would work on every server consistently without having to change my scripts. More elegant than the first solution.

I am not sure what you mean by your second idea. Perhaps if you could provide an example of it, and how that gives me the variables I need without knowing the proxmox server hostname, or ip address of the dummy nic, mac of the dummy nic, etc. If I need to know any of those, then I am better off using samba as above.

ajm
 
You can use ansible to set environment/path variables.

But in that case it's better to use ansible for everything.
 
Hi Ramalama

I need a solution that is self-contained within the proxmox host or the vm's on the host. In some cases I do pass through all of the proxmox host's USB ports (for keyboard/mouse, and attached USB items like extra video via USB etc), so I suppose that I could pass the data through that way with a fixed drive allocation for a USB stick on the VM. But that makes it available to only one VM. Not very elegant.

I do make storage available from the host to the VM via samba, but that requires knowing the proxmox server hostname, therefore back to the same problem. I suppose I could provide an alias for the proxmox smb server name (i.e. local), and then map drives via //local/share/. That would work on every server consistently without having to change my scripts. More elegant than the first solution.

I am not sure what you mean by your second idea. Perhaps if you could provide an example of it, and how that gives me the variables I need without knowing the proxmox server hostname, or ip address of the dummy nic, mac of the dummy nic, etc. If I need to know any of those, then I am better off using samba as above.

ajm
Sure samba is the way.

The second idea is to change the nic macadress on the host, it will change it then on the client either.
The idea is stupid, but a way without network
It's more of a proof of concept.

However, i know that hyperv has shared storage options, where you can pass a volume to multiple vm's.
But proxmox doesn't. And i sadly doesn't have any other ideas how to pass anything to multiple vm's without network...

With network there are a lot of options...
Iscsi / samba / nfs / ssh / etc....

Without having the host reachable, there are options either with firewall or a sync to something that has access to both networks etc...
Or a proxy on that device, simplest way is portforward samba...

However, without network it seems like there is no way :D

Cheers
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!