the owner of snapshot image from shelved instance should be the same as the instance's.

Bug #1655170 reported by Dehui Peng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Dehui Peng

Bug Description

Description
=============
the owner of snapshot image from shelved instance should be the same as the instance's.

Steps to reproduce
====================

1. assume we have the following:
1) admin user and admin project
2) demo user and demo project

2. login as demo user
1) create an instance (let's call it demo-instance)
2) logout

3. login as admin user
1) go to "Admin->Instance"
2) shelve "demo-instance"
3) go to "Admin->Images"
4) demo-instance's snapshot is now owned by admin project
5) logout

4. login as demo user again.
1) go to "Images"
2) won't see any snapshot for demo-instance.
3) go to "Instances"
4) try to unshelve demo-instance

Expected result
=================
the demo-instance shelved by admin user should be able to be unshelved by demo user.

Actual result
=================
Error.

Environment
=================
liberty

Revision history for this message
Dehui Peng (depeng) wrote :

Here is a fix working for me:

diff --git a/nova/compute/api.py b/nova/compute/api.py
index f76af12..e9cb10b 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -3157,6 +3157,8 @@ class API(base.Base):
             image_meta = self._create_image(context, instance, name,
                     'snapshot')
             image_id = image_meta['id']
+ if context.project_id != instance.project_id:
+ self.image_api.update(context, image_id, {'owner': str(instance.project_id)})
             self.compute_rpcapi.shelve_instance(context, instance=instance,
                     image_id=image_id, clean_shutdown=clean_shutdown)
         else:

Revision history for this message
Dehui Peng (depeng) wrote :
Changed in nova:
assignee: nobody → Dehui Peng (depeng)
Changed in nova:
status: New → In Progress
Dehui Peng (depeng)
description: updated
Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing
the status back to the previous state and unassigning. If
there are active reviews related to this bug, please include
links in comments.

Changed in nova:
status: In Progress → New
assignee: Dehui Peng (depeng) → nobody
Sean Dague (sdague)
Changed in nova:
assignee: nobody → Dehui Peng (depeng)
status: New → In Progress
Revision history for this message
Matt Riedemann (mriedem) wrote :

I've marked this as a duplicate of bug 1675791. This bug was reported first, but bug 1675791 has more details on the problem and possible solution.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.openstack.org/418155

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.