maas crashes because of a missing power_type, even though I provided one

Bug #1305061 reported by Tycho Andersen on 2014-04-09
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Critical
Julian Edwards
1.5
Critical
Julian Edwards
maas (Ubuntu)
Undecided
Unassigned
Trusty
Undecided
Unassigned

Bug Description

I get:

ERROR 2014-04-09 07:56:07,314 maasserver ################################ Exception: u'power_type' ################################
ERROR 2014-04-09 07:56:07,315 maasserver Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 167, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 165, in __call__
    result = meth(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api_support.py", line 189, in dispatch
    return function(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 626, in new
    node = create_node(request)
  File "/usr/lib/python2.7/dist-packages/maasserver/api.py", line 541, in create_node
    if form.is_valid():
  File "/usr/lib/python2.7/dist-packages/maasserver/forms.py", line 553, in is_valid
    valid = super(WithMACAddressesMixin, self).is_valid()
  File "/usr/lib/python2.7/dist-packages/maasserver/forms.py", line 249, in is_valid
    is_valid = super(NodeForm, self).is_valid()
  File "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 129, in is_valid
    return self.is_bound and not bool(self.errors)
  File "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 121, in errors
    self.full_clean()
  File "/usr/lib/python2.7/dist-packages/maasserver/forms.py", line 138, in full_clean
    super(APIEditMixin, self).full_clean()
  File "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 274, in full_clean
    self._clean_form()
  File "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 300, in _clean_form
    self.cleaned_data = self.clean()
  File "/usr/lib/python2.7/dist-packages/maasserver/forms.py", line 427, in clean
    no_power_type = cleaned_data['power_type'] == ''
KeyError: u'power_type'

When I do the following:

        node_data = {
            'architecture': 'amd64',
            'mac_addresses': [os_mac],
            'power_type': 'amt',
            'power_parameters_power_pass': 'Password1+',
            'power_parameters_mac_address': os_mac,
            # TODO: use cluster_id when maas changes land
            'nodegroup': '',
        }
        resp = client.post('nodes/', 'new', **node_data)

This used to work in the r1977 maas that was in trusty (and lots of previous maases), but does not work in the 2227 maas that is there now, so I suppose it is a regression.

[Impact]
 * Fix regression of raised error when power_type not properly checked for existence

[Testcase]
 * included testcase test_POST_new_when_no_RPC_to_cluster_defaults_empty_power

[Regression Potential]
 * Minimal, will allow power_type to be properly detected as existent or not, whether key is available or not.

Related branches

lp:~julian-edwards/maas/add-node-crash-bug-1305061
Merged into lp:maas at revision 2317
Raphaël Badin (community): Approve on 2014-05-14
lp:~julian-edwards/maas/1.5-add-node-crash-bug-1305061
Merged into lp:maas/1.5 at revision 2270
Julian Edwards (community): Approve on 2014-05-14
Tycho Andersen (tycho-s) wrote :

copy of pserv.log as per irc: http://paste.ubuntu.com/7226244/

Gavin Panella (allenap) wrote :

Nothing in pserv.yaml that makes me suspicious. The RPC stuff appears to be connected okay.

Tycho Andersen (tycho-s) wrote :

So I think it did have something to do with that. I was hitting https://bugs.launchpad.net/maas/+bug/1302772 again, but didn't realize it (this was with an out of the box package install of r2227 maas, we really need to get another upload that's not totally broken). Once I fixed the problem and restarted pserv, all was happy.

Still, I think I should get a better error message than the stack trace above.

Raphaël Badin (rvb) wrote :

> Still, I think I should get a better error message than the stack trace above.

Definitely. Marking this as Critical since this is, after all, a crash.

Changed in maas:
importance: Undecided → Critical
status: New → Triaged
Jeroen T. Vermeulen (jtv) wrote :

What *is* the situation that needs a better error message? It looks like people diagnosed this crash on IRC, but forgot to update the bug.

Changed in maas:
status: Triaged → Incomplete
Tycho Andersen (tycho-s) wrote :

Hi, sorry, missed this somehow. This happens when there are no power types, which happens in the new model when the cluster controller hasn't talked to the region yet (or talks to it and has no supported power types, presumably).

Changed in maas:
status: Incomplete → Triaged
Changed in maas:
assignee: nobody → Julian Edwards (julian-edwards)
status: Triaged → In Progress
milestone: none → 14.10
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: 1.6.0 → none
Changed in maas:
status: Fix Committed → Fix Released
Greg Lutostanski (lutostag) wrote :

branch which fixes this and other 1.5.2 release bugs for SRU is linked to bug #1325038

description: updated
Changed in maas (Ubuntu):
status: New → Fix Released

Hello Tycho, or anyone else affected,

Accepted maas into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/maas/1.5.2+bzr2282-0ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in maas (Ubuntu Trusty):
status: New → Fix Committed
tags: added: verification-needed
Stéphane Graber (stgraber) wrote :

Hello Tycho, or anyone else affected,

Accepted maas into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/maas/1.5.2+bzr2282-0ubuntu0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Greg Lutostanski (lutostag) wrote :

Verified with included testcase in an lxc container, and edited a node's power type with the cluster controller (in a separate container) offline.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package maas - 1.5.2+bzr2282-0ubuntu0.2

---------------
maas (1.5.2+bzr2282-0ubuntu0.2) trusty-proposed; urgency=medium

  * debian/control:
   - Add missing dependency in maas-cluster-controller for grub-common
     (LP: #1328231)
   - Move dependency from maas-cluster-controller to maas-provisioningserver
     for python-seamicroclient (LP: #1332532)

maas (1.5.2+bzr2282-0ubuntu0.1) trusty-proposed; urgency=medium

  * New upstream release:
    - Remove workaround for fixed Django bug 1311433 (LP: #1311433)
    - Ensure that validation errors are returned when adding a node over
      the API and its cluster controller is not contactable. (LP: #1305061)
    - Hardware enablement support for PowerKVM (LP: #1325038)
    - Shorten the time taken for a cluster to initially connect to the region
      via RPC to around 2 seconds (LP: #1317682)
    - Faster DHCP leases parser (LP: #1305102)
    - Documentation fixed explaining how to enable an ephemeral backdoor
      (LP: #1321696)
    - Use probe-and-enlist-hardware to enlist all virtual machine inside
      a libvirt machine, allow password qemu+ssh connections.
      (LP: #1315155, LP: #1315157)
    - Rename ppc64el boot loader to PowerKVM (LP: #1315154)
    - Fix NodeForm's is_valid() method so that it uses Django's way of setting
      errors on forms instead of putting text in self.errors['architecture']
      (LP: #1301465)
    - Change BootMethods to return their own IReader per-request, update method
      names to reflect new usage. (LP: #1315154)
    - Return early and stop the DHCP server when the list of managed interfaces
      of the nodegroup is empty. (LP: #1324944)
    - Fix invalid attribute references in the VirshSSH class. Added more test
      for the VirshSSH class. (LP: #1324966)
  * debian/control:
    - Add missing dependency in maas-cluster-controller for python-pexpect
      (LP: #1322151)
 -- Greg Lutostanski <email address hidden> Fri, 20 Jun 2014 10:10:47 -0500

Changed in maas (Ubuntu Trusty):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for maas has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

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

Duplicates of this bug

Other bug subscribers