Nova resize fails if user is not an admin

Bug #1085071 reported by Dan Prince
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Dan Prince

Bug Description

Using Nova Grizzly:

I'm seeing the following stack trace in Nova's compute.log file when I try to resize an instance as a non-admin user:

ad174253 9fe672da65304d6e9012df57eff036e2 33f9f37945bc444389e8102a274a33cc] [instance: 09cfc1eb-34bc-43fd-a443-aada4193e858] Error: ['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1815, in prep_resize\n reservations, request_spec, filter_properties, node)\n', ' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1782, in _prep_resize\n with rt.resize_claim(context, instance, instance_type, limits=limits) \\\n', ' File "/usr/lib/python2.7/site-packages/nova/openstack/common/lockutils.py", line 228, in inner\n retval = f(*args, **kwargs)\n', ' File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 149, in resize_claim\n self._update(context, self.compute_node)\n', ' File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 349, in _update\n self.compute_node[\'id\'], values, prune_stats)\n', ' File "/usr/lib/python2.7/site-packages/nova/db/api.py", line 203, in compute_node_update\n return IMPL.compute_node_update(context, compute_id, values, prune_stats)\n', ' File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 107, in wrapper\n raise exception.AdminRequired()\n', 'AdminRequired: User does not have admin privileges\n']

Dan Prince (dan-prince)
Changed in nova:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → High
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/17204

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/17204
Committed: http://github.com/openstack/nova/commit/e74c4da3d1dafa878fe3f5e7bc29c580b7db2632
Submitter: Jenkins
Branch: master

commit e74c4da3d1dafa878fe3f5e7bc29c580b7db2632
Author: Dan Prince <email address hidden>
Date: Fri Nov 30 10:12:48 2012 -0500

    Use elevated cxtx in resource_tracker.resize_claim

    Updates the resize_claim function in compute/resource_tracker
    so that it uses an elevated context for the db.compute_node_update
    call.

    This fixes an issue where resizes from non-admin users would fail
    to complete.

    Fixes LP Bug #1085071.

    Change-Id: I356e564228603834073c2b878b09cc35b88edf1e

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Dan Prince (dan-prince) wrote :

I did a bit more digging on this and it looks like the root cause of this is this commit where we stopped sending the admin context across RPC for the resize_confirm/revert functions:

https://github.com/openstack/nova/commit/14e2ed3ace769c4deaca3c48a2fa59863f637a5f

This seems to effect users of Nova's FlatDHCPNetwork manager at the moment (in Grizzly).

Changed in nova:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/17300

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/17300
Committed: http://github.com/openstack/nova/commit/2c84191d93fed209d6ae68cf80f52bbdca7646d7
Submitter: Jenkins
Branch: master

commit 2c84191d93fed209d6ae68cf80f52bbdca7646d7
Author: Dan Prince <email address hidden>
Date: Sat Dec 1 21:25:30 2012 -0500

    network managers: Pass elevated cxtx to update_dhcp

    Updates the Nova FlatDHCPManager and VlanManager network
    managers so they pass an elevated context to update_dhcp.
    In some cases (linux_net) the network driver may make use of
    DB calls which require an admin context.

    This fixes an issue where resize operations (confirm, revert)
    would fail if the user was not an admin.

    This is more fallout from 14e2ed3 where we stopped passing admin
    contexts for resize across RPC.

    Fixes LP Bug #1085071
    Change-Id: I718c40f0df0b2955626033cf3b6f78323527e9cf

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-2 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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