maas-cli node new/update power_parameters format for virsh is inconsistent

Bug #1235404 reported by Peter Petrakis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Won't Fix
Low
Unassigned

Bug Description

ref: https://maas.ubuntu.com/docs/man/maas-cli.8.html

According to the maas docs you can provision a node like so:

  new architecture=<value> mac_addresses=<value> [parameters]

and update the configuration like so:

maas-cli maas node update <system_id> \
  power_type="ipmi" \
  power_parameters_power_address=192.168.22.33 \
  power_parameters_power_user=root \
  power_parameters_power_pass=ubuntu;

So it stands to reason that you should be able to combine all of that
from "new", and you can.

maas-cli maas nodes new architecture="amd64/generic" hostname="fringe" mac_addresses="52:54:00:05:2f:c0" power_type="virsh" power_parameters_power_address="qemu+tcp://10.193.36.101/system" ...

*but* if you try add the additional power params to it's logical conclusion, using the example, it won't work.

maas-cli doesn't acknowledge power_user for the virsh power_type. Also from the example, I'm led to believe
that the power driver field should be "power_driver", nope it's just driver.

After some searching, I found the culprit, src/maasserver/power_parameters.py

    POWER_TYPE.VIRSH:
        DictCharField(
            [
                ('driver', forms.CharField(label="Driver", required=False)),
                (
                    'username',
                    forms.CharField(label="Username", required=False)),
                (
                    'power_address',
                    forms.CharField(label="Address", required=False)),
                (
                    'power_id',
                    forms.CharField(label="Power ID", required=False)),
            ],
            required=False,
            skip_check=True),

It doesn't line up with the power handling code, which users power_user and power_driver
throughout.

Everything else in power_parameters.py follows the power_ pattern.

    POWER_TYPE.IPMI:
        DictCharField(
            [
                (
                    'power_driver',
                    forms.ChoiceField(
                        label="Driver", required=False,
                        choices=IPMI_DRIVER_CHOICES,
                        initial=IPMI_DRIVER.DEFAULT)
                ),
                (
                    'power_address',
                    forms.CharField(label="IP Address or Hostname",
                        required=False)),
                (
                    'power_user',
                    forms.CharField(label="Username", required=False)),
                (
                    'power_pass',
                    forms.CharField(label="Password", required=False)),
            ],

So lets normalize the interface, see attached branch, tested in place.

ubuntu@pluton:~$ maas-cli maas nodes new architecture="amd64/generic" hostname="fringe" mac_addresses="52:54:00:05:2f:c0" power_type="virsh" power_parameters_power_driver="kvm" power_parameters_power_address="qemu+tcp://10.193.36.101/system" power_parameters_power_user="ubuntu" power_parameters_power_id="fringe"
{
    "status": 1,
    "macaddress_set": [
        {
            "resource_uri": "/MAAS/api/1.0/nodes/node-eccf979e-2d23-11e3-9b02-525400052fb9/macs/52:54:00:05:2f:c0/",
            "mac_address": "52:54:00:05:2f:c0"
        }
    ],
    "netboot": true,
    "hostname": "fringe",
    "power_type": "virsh",
    "system_id": "node-eccf979e-2d23-11e3-9b02-525400052fb9",
    "architecture": "amd64/generic",
    "tag_names": [],
    "resource_uri": "/MAAS/api/1.0/nodes/node-eccf979e-2d23-11e3-9b02-525400052fb9/"
}

A check of the web interface confirms that all the values were populated and the VM
is commissioned successfully.

Tags: power

Related branches

Raphaël Badin (rvb)
Changed in maas:
importance: Undecided → Low
status: New → Triaged
tags: added: power
Changed in maas:
status: Triaged → Won't Fix
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.