salt icon indicating copy to clipboard operation
salt copied to clipboard

Salt-Cloud Proxmox LXC Update

Open B1ue-W01f opened this issue 6 years ago • 4 comments

Is your feature request related to a problem? Please describe. Currently the LXC implementation includes only a limited subset of the available API endpoints, this means that options such as providing NFS access (somewhat critical) aren't available to be provisioned within salt-cloud.

Describe the solution you'd like Some of the end points are really easy to implement, they just require the handles to be added as options to the proxmox.py script which then knows to use the handles in the POST. Ive implemented this for NFS control already to test (features). I see this as a quite low hanging fruit fix. Such as below:

elif vm_["technology"] == "lxc":
        # LXC related settings, using non-default names:
        newnode["hostname"] = vm_["name"]
        newnode["ostemplate"] = vm_["image"]

        static_props = (
            "cpuunits",
            "cpulimit",
            "rootfs",
            "cores",
            "description",
            **"features",**
            "memory",
            "onboot",
            "net0",
            "password",
            "nameserver",
            "swap",
            "storage",
            "rootfs",
        )

Additional context Im looking to gather any other similar handles for Proxmox LXC (potentially QEMU) that could get wrapped up in this, and then ideally I can offer a fix. I'm pretty noob so can't be anything particularly complex.

B1ue-W01f avatar Apr 14 '20 13:04 B1ue-W01f

I am interested in working on this. I have a few pet peeves like the "ip_address" dependency when creating a container that has a net0 item with a static IP specified, or the lack of support for changing the rootfs disk size

Phuzzy112 avatar Oct 14 '20 09:10 Phuzzy112

I have done a bit of work and have a few things working on my end. To be honest, I am pretty new to this process so don't know how best to proceed.

Its all up here: https://github.com/Phuzzy112/salt/blob/proxmox-lxc-enhancements/salt/cloud/clouds/proxmox.py

Should I get some more testing, or just go ahead and try a pull request?

Phuzzy112 avatar Oct 16 '20 12:10 Phuzzy112

I'm starting to think that most of the code currently in proxmox.py regarding static_props is completely superfluous.

  1. _get_properties can be passed an optional extra list of properties (usually static_props)
  2. It then checks the API for properties that can be set
  3. It then chucks out any params on the extra list that don't appear in the API
  4. The remaining params are returned

But why bother with the extra list if its members already have to be in the list returned by the API or they're ignored?

This feature request isn't necessary anyway because any additional params will be passed as-is to the API so the feature is already implemented, the docs just imply that they aren't.

So:

  • The docs need mention that the parameters are passed as-is to the API and the API is the real reference for what can be passed.
  • The code needs to be cleaned up to remove the static_props and its associated code in _get_properties

mthibaut avatar May 06 '23 00:05 mthibaut

Closing in favor of https://github.com/salt-extensions/saltext-proxmox/issues/8

The Promxmox driver in the Salt core will be deprecated, and the Extension in the linked repo will be the place for new features and bug fixes.

nicholasmhughes avatar May 11 '23 01:05 nicholasmhughes