maas power type driver for ravello systems

Bug #1544211 reported by Iben Rodriguez
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Invalid
Wishlist
Ionut-Madalin Balutoiu

Bug Description

There are three files we needed to change to add the power type driver function to connect with ravello.

This power type driver offers all three features: On, Off, and Status.

Find the files we changed for maas version 1.8 here:
- https://github.com/opnfv/opnfv-ravello-demo/blob/master/ravello-maas-patch.diff
- https://github.com/opnfv/opnfv-ravello-demo/blob/master/power/ravello-power-cmd.py
- https://github.com/opnfv/opnfv-ravello-demo/blob/master/power/ravello.template

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

Hi Iben,

Can you please create a Merge Proposal for MAAS 2.0 ? 1.8 is no longer supported.

Thanks!

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

Also, please do it against lp:maas!

Changed in maas:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Ionut-Madalin Balutoiu (ionutbalutoiu) wrote :

Hello Andres,

I'll helping Iben and submit the Merge Proposal there.

Thank-you for your answer

Changed in maas:
assignee: nobody → Ionut-Madalin Balutoiu (ionutbalutoiu)
Revision history for this message
Ionut-Madalin Balutoiu (ionutbalutoiu) wrote :

I'll help*

Lee Trager (ltrager)
Changed in maas:
status: Incomplete → In Progress
Revision history for this message
Ionut-Madalin Balutoiu (ionutbalutoiu) wrote :

Andres,

I have a quick question. If the patch has an external dependency, will this get merged ? The code for Ravello power driver uses python ravello-sdk (https://github.com/ravello/python-sdk) which is not in Ubuntu archive (can be installed only via 'pip install'). Guys from #maas IRC channel told me that if an external dependency is not at least in Ubuntu archive, the code will not get merged.

Thank-you,
Ionut

Revision history for this message
David Duffey (dduffey) wrote :

Hi Ionut,

Is there a plan to update the driver to MAAS 1.9/2.0 and make it self-contained?

Revision history for this message
David Duffey (dduffey) wrote :

Hi Ionut,

Here is an example of files I had to modify to add a driver for maas 1.9:
https://code.launchpad.net/~david-duffey/maas/wedge-1.9/+merge/285382/+preview-diff/693210/+files/preview.diff

And here is your Ravello power driver written for MAAS 1.9. I tested it and it works. You will need to modify the other three files but they are super simple, and then decide how to make this all-inclusive of the sdk as well:

root@facebook:/usr/lib/python2.7/dist-packages/provisioningserver/drivers/power# cat ravello.py

"""Ravello Power Driver."""

from __future__ import (
    absolute_import,
    print_function,
    unicode_literals,
    )

str = None

__metaclass__ = type
__all__ = []

import os
import subprocess
import sys

from provisioningserver.drivers.power import (
    PowerDriver,
    PowerError,
    PowerFatalError,
)

from provisioningserver.logger import get_maas_logger
from provisioningserver.utils import shell
from provisioningserver.utils.network import find_ip_via_arp
from provisioningserver.utils.shell import (
    call_and_check,
    ExternalProcessError,
)

class RavelloPowerDriver(PowerDriver):
    name = 'ravello'
    description = "Ravello Power Driver."
    settings = []

    def detect_missing_packages(self):
        # todo this needs the ravello sdk and ravello bmc python script
        return []

    @staticmethod
    def _issue_ravello_power_command(command):
        command = tuple(command) # For consistency when testing.
        try:
            output = call_and_check(command)
        except ExternalProcessError as e:
            raise PowerFatalError(
                "Failed: %s" % (e.output_as_unicode))
        else:
            if 'START' in output:
                return 'on'
            elif 'STOP' in output:
                return 'off'
            else:
                return output

    def _issue_ravello_vm_cmd(self, power_change, ravello_user=None, ravello_password=None, ravello_application=None, ravello_vm=None,**extra):
         ravellopower_command = ["/usr/local/bin/ravello-power-cmd.py","-u",ravello_user,"-p",ravello_password,"-a",ravello_application,"-v",ravello_vm,power_change]
         return self._issue_ravello_power_command(ravellopower_command)

    def power_on(self, system_id, context):
 self._issue_ravello_vm_cmd("on", **context)

    def power_off(self, system_id, context):
 self._issue_ravello_vm_cmd("off", **context)

    def power_query(self, system_id, context):
 return self._issue_ravello_vm_cmd("status", **context)

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

Hi!

**This is an automated message**

We believe this is may no longer be an issue in the latest MAAS release. Due to the report date of this, we are currently marking it as Invalid. If you believe this bug report still valid against the latest release of MAAS, or if you are still interested in this, please re-open this bug report.

Thanks

Changed in maas:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.