[feature] New power type: Proxmox

Bug #1805799 reported by Wojtek Rakoniewski on 2018-11-29
52
This bug affects 9 people
Affects Status Importance Assigned to Milestone
MAAS
Wishlist
Lee Trager
2.9
Wishlist
Lee Trager

Bug Description

Please add new power type: Proxmox
Proxmox it is very popular open source virtualization environment similar to VMware. Please add basic functionality for using Proxmox like IPMI BMC (start, stop, restart machine, power status).
Unfortunately Proxmox is not based on virsh so it is not possible to use existing virsh power type.

Proxmox have api that allows manage:
https://pve.proxmox.com/wiki/Proxmox_VE_API
There are also python libraries that can be used when implementing in MAAS so implementations should not be difficult.

We are using Proxmox as our basic virtualization environment ans MAAS as tool to deploy operating systems on virtual machines. Currently it needs configure power type as "Manual" and manually start or restarts host in proper moment in Proxmox gui. Implementation of Proxmox power type will automate work a lot.

Regards,
Wojtek

Related branches

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Woktek,

We currently have no plans to supporting proxmox as it is not something we currently use nor are looking to use. However, if the community is using it, we will be happy to take contributions if someone is willing to write a power driver for it.

summary: - New power type: Proxmox
+ [feature] New power type: Proxmox
Changed in maas:
status: New → Triaged
milestone: none → next
Revision history for this message
Wojtek Rakoniewski (enter2608) wrote :

Hi Andres,
No problem, I wrote one, please find attached file.
It is not diff file, but it can be copied to provisioningserver/drivers/power and just register driver in registry.py. It works for me. Tested on MAAS 2.5.0rc1 and Proxmox VE 5.2 but should work with any Proxmox version. It requires python library proxmoxer.
It will be nice if you commit it to MAAS source and use it in future versions of MAAS

--
Regards,
Wojtek

Revision history for this message
Wojtek Rakoniewski (enter2608) wrote :

Attachment to previous comment

Revision history for this message
Matthias (matthiashuether) wrote :

I also be interested in integrating proxmox power type. Thanks for your work Wojtek. Did it work with proxmox-container too? Or only vm ?

Revision history for this message
Matthias (matthiashuether) wrote :

Okay I think, only vm's work with pxe-boot... so we don't need support for container here.

Revision history for this message
Matthias (matthiashuether) wrote :

Thank you very much, it work for me!

Revision history for this message
Andres Rodriguez (andreserl) wrote : Re: [Bug 1805799] Re: [feature] New power type: Proxmox

Hi Wojtek,

Thanks for the changes, however the procedure to accept new changes is by
creating a new pull request agains the git [1] repository (master branch)
of MAAS with unit tests. You also will need to sign the Canonical’s
contributors agreement [2].

Thank you!

[1]:
https://code.launchpad.net/~maas-committers/maas/+git/maas
[2]:
https://www.ubuntu.com/legal/contributors

On Sat, Dec 1, 2018 at 2:10 PM Wojtek Rakoniewski <
<email address hidden>> wrote:

> Attachment to previous comment
>
> ** Attachment removed: "proxmox.py"
>
> https://bugs.launchpad.net/maas/+bug/1805799/+attachment/5217996/+files/proxmox.py
>
> ** Attachment added: "Proxmox power driver for MAAS"
>
> https://bugs.launchpad.net/maas/+bug/1805799/+attachment/5218010/+files/proxmox.py
>
> --
> You received this bug notification because you are subscribed to MAAS.
> https://bugs.launchpad.net/bugs/1805799
>
> Title:
> [feature] New power type: Proxmox
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/maas/+bug/1805799/+subscriptions
>
> Launchpad-Notification-Type: bug
> Launchpad-Bug: product=maas; milestone=next; status=Triaged;
> importance=Undecided; assignee=None;
> Launchpad-Bug-Tags: feature
> Launchpad-Bug-Information-Type: Public
> Launchpad-Bug-Private: no
> Launchpad-Bug-Security-Vulnerability: no
> Launchpad-Bug-Commenters: andreserl enter2608
> Launchpad-Bug-Reporter: Wojtek Rakoniewski (enter2608)
> Launchpad-Bug-Modifier: Wojtek Rakoniewski (enter2608)
> Launchpad-Message-Rationale: Subscriber (MAAS)
> Launchpad-Message-For: andreserl
>
--
Andres Rodriguez (RoAkSoAx)
Ubuntu Server Developer
MSc. Telecom & Networking
Systems Engineer

Revision history for this message
Laurent Dumont (baconpackets) wrote :

Anyone has a handy guide for integrating the provided script to a brand new MAAS install? I'll see what I can do on my side.

Revision history for this message
Tim S (timss) wrote :

Wojtek (#2): Thanks for sharing your Proxmox power driver, it works great! Would very much like to see it contributed or committed upstream, instead of having to patch my own installation.

---

Laurent (#8): Sure, here's how I did it on 19.04 with MAAS 2.5.0 (7442-gdf68e30a5-0ubuntu1) installed using `apt`:

1. Install the Proxmox API library; `apt install python3-proxmoxer`
2. Put the attached `proxmox.py` in `/usr/lib/python3/dist-packages/provisioningserver/drivers/power/`
3. Register the driver in `/usr/lib/python3/dist-packages/provisioningserver/drivers/power/registry.py`:

from provisioningserver.drivers.power.proxmox import ProxmoxPowerDriver

power_drivers = [
    ProxmoxPowerDriver(),
    ...
]

4. Create/use an user in Proxmox with "VM.PowerMgmt" and "VM.Audit" privileges
5. Configure the power driver for a machine in MAAS (no automatic detection)

Revision history for this message
Laurent Dumont (baconpackets) wrote :

Hey Tim,

Long delay but I was able to make it work right before you posted it. I used an admin user in Proxmox but I'll switch over to your method.

Thanks a lot!

Revision history for this message
Laurent Dumont (baconpackets) wrote :

(it would still be nice to have this native in MaaS as a package update seems to clear custom files)

Revision history for this message
Donny Davis (donny-g) wrote :

This driver works great for me on proxmox 6

Revision history for this message
Mr. Jester (mrjester) wrote :

Instructions for the Snap version MaaS 2.8 build 7328. I have no idea how to submit this for inclusion.

snap stop maas.supervisor
umount /snap/maas/7328
unsquashfs /var/lib/snapd/snaps/maas_7328.snap
cp proxmox.py squashfs-root/usr/lib/python3/dist-packages/provisioningserver/drivers/power/
vi squashfs-root/usr/lib/python3/dist-packages/provisioningserver/drivers/power/registry.py

## Add this to the import headers
from provisioningserver.drivers.power.proxmox import ProxmoxPowerDriver

## The ProxmoxPowerDriver is the entry to be added
power_drivers = [
     ProxmoxPowerDriver(),
     ...
 ]

mksquashfs squashfs-root maas_7328.snap
mv /var/lib/snapd/snaps/maas_7328.snap /var/lib/snapd/snaps/maas_7328.snap-orig
mv maas_7328.snap /var/lib/snapd/snaps/
reboot (changes were not recognized until I restarted the server. Mounting and starting the snap was not sufficient)

Revision history for this message
Rainer Kulow (rkulow) wrote :

Instructions for the Snap version MaaS 2.8 build 7808 are the same as described by @mrjester,
only the path to the power drivers has changed:
Instead of 'squashfs-root/usr/lib/python3/dist-packages/provisioningserver/drivers/power/' it's now
'squashfs-root/lib/python3.6/site-packages/provisioningserver/drivers/power/'

Revision history for this message
Miki Vazquez (mikivazquez) wrote :

Hello I do it for Maas build 8980 I change the path.. but in web interface I can see:

Error:'python3-proxmoxer' package(s) are not installed

I suppose that i have to install the python3-proxmoxer package inside the snap volume, but I have no idea how to do it.

I have installed it in s.o., but it seems that it is not enough.

Can someone help me, thanks !!

Revision history for this message
David (davemcbrave) wrote :

Hello,
thank you all for the efforts. However, I am experiencing the same problem as mikivazquez. Has someone had luck installing proxmoxer in the snap? Sadly, I haven't had any. The feature would be really apreciated.

Revision history for this message
Alireza Nasri (sysnasri) wrote :

@davemcbrave, I could install it. do #13 for the new version.

Revision history for this message
Seetharaman Krishnamoorthy (seekrish) wrote :

In MAAS 2.9 I am getting errors when I try to use proxmox driver. I followed the procedure given above and copied the files and installed the python module. For some reason maas is giving me this error.

No driver found for power type 'proxmox'

Please let me know how to fix this error.

Revision history for this message
Dmytro Samoylenko (vsys-host) wrote :

Hello,

To use this with MAAS 2.9 modify /usr/lib/python3/dist-packages/provisioningserver/drivers/power/proxmox.py:

class ProxmoxPowerDriver(PowerDriver):

    name = 'proxmox'
    chassis = True
    can_probe = False # <-------- add this line

Revision history for this message
Travis Glenn Hansen (travisghansen) wrote :

If running from a 20.04 host and installing 2.9 with snaps you can do the following (running as root):

snap stop maas.supervisor
umount /snap/maas/10851
unsquashfs /var/lib/snapd/snaps/maas_10851.snap

apt-get install python3-pip

cd squashfs-root
pip3 install --root ${PWD} --prefix . proxmoxer

# vi lib/python3.8/site-packages/provisioningserver/drivers/power/registry.py
# add lines below as appropriate
from provisioningserver.drivers.power.proxmox import ProxmoxPowerDriver
ProxmoxPowerDriver(),

# vi lib/python3.8/site-packages/provisioningserver/drivers/power/proxmox.py
# make sure to add the can_probe attribute as appropriate
<driver content>

mv /var/lib/snapd/snaps/maas_10851.snap /var/lib/snapd/snaps/maas_10851.snap.orig
mv maas_10851.snap /var/lib/snapd/snaps/maas_10851.snap

chmod 600 /var/lib/snapd/snaps/maas_10851.snap
reboot

Lee Trager (ltrager) on 2021-01-07
Changed in maas:
assignee: nobody → Lee Trager (ltrager)
importance: Undecided → Wishlist
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Revision history for this message
David (davemcbrave) wrote :

When is this going to be available in the snap?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers