[Yahoo-eng-team] [Bug 1537626] Re: `glance location-update` deletes locations and backend images
** Changed in: glance/liberty Status: New => Invalid -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1537626 Title: `glance location-update` deletes locations and backend images Status in Glance: Fix Released Status in Glance liberty series: Invalid Status in Glance Client: Fix Released Bug description: Hi all, I am having trouble using `glance location-update --url --metadata ` to update the metadata of a location. When I try run the command, the locations become a blank list and the image is deleted from my backend (swift+https). I have traced it down to the following: When doing a location-update, glanceclient actually sends two patch commands: [{'op': 'replace', 'path': '/locations', 'value': []}, {'op': 'replace', 'path': '/locations', 'value': [{u'metadata': {u'key': 'value'}, {u'url': u'swift+https://image1'}]}] This is due to a note in python- glanceclient/glanceclient/v2/images.py, update_location(): # NOTE: The server (as of now) doesn't support modifying individual # location entries. So we must: # 1. Empty existing list of locations. # 2. Send another request to set 'locations' to the new list # of locations. However, at the server end, the _do_replace_locations() function which handles this call, actually deletes the locations and images when it gets the first call with the empty values (glance/glance/api/v2/images.py) ??? def _do_replace_locations(self, image, value): if len(image.locations) > 0 and len(value) > 0: msg = _("Cannot replace locations from a non-empty " "list to a non-empty list.") raise webob.exc.HTTPBadRequest(explanation=msg) if len(value) == 0: # NOTE(zhiyan): this actually deletes the location # from the backend store. del image.locations[:] if image.status == 'active': image.status = 'queued' This seems to result in the first call deleting all the locations from the backend store, and the second call throwing an error because there is no location any more. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1537626/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1537626] Re: `glance location-update` deletes locations and backend images
Reviewed: https://review.openstack.org/280789 Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=8b6dbb2065c5e12d150f15572df3dc0e269e7a81 Submitter: Jenkins Branch:master commit 8b6dbb2065c5e12d150f15572df3dc0e269e7a81 Author: Fei Long Wang Date: Mon Feb 15 16:39:03 2016 +1300 Fix location update After commit Ieb03aaba887492819f9c58aa67f7acfcea81720e, the command location-update is totally broken now. This patch removes the updating for an image from non-empty to empty since it's not supported now. And also removing the default value of metadata for location-update cli command because now the only purpose of location-update is updating the location's metadata, so it doesn't make sense to give it a default value which may update existing metadata by mistake. Closes-Bug: #1537626 Change-Id: I9ce98e6c63996bbfdbc56761055e37a871f9d3e2 ** Changed in: python-glanceclient Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1537626 Title: `glance location-update` deletes locations and backend images Status in Glance: Fix Released Status in Glance liberty series: New Status in python-glanceclient: Fix Released Bug description: Hi all, I am having trouble using `glance location-update --url --metadata ` to update the metadata of a location. When I try run the command, the locations become a blank list and the image is deleted from my backend (swift+https). I have traced it down to the following: When doing a location-update, glanceclient actually sends two patch commands: [{'op': 'replace', 'path': '/locations', 'value': []}, {'op': 'replace', 'path': '/locations', 'value': [{u'metadata': {u'key': 'value'}, {u'url': u'swift+https://image1'}]}] This is due to a note in python- glanceclient/glanceclient/v2/images.py, update_location(): # NOTE: The server (as of now) doesn't support modifying individual # location entries. So we must: # 1. Empty existing list of locations. # 2. Send another request to set 'locations' to the new list # of locations. However, at the server end, the _do_replace_locations() function which handles this call, actually deletes the locations and images when it gets the first call with the empty values (glance/glance/api/v2/images.py) ??? def _do_replace_locations(self, image, value): if len(image.locations) > 0 and len(value) > 0: msg = _("Cannot replace locations from a non-empty " "list to a non-empty list.") raise webob.exc.HTTPBadRequest(explanation=msg) if len(value) == 0: # NOTE(zhiyan): this actually deletes the location # from the backend store. del image.locations[:] if image.status == 'active': image.status = 'queued' This seems to result in the first call deleting all the locations from the backend store, and the second call throwing an error because there is no location any more. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1537626/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1537626] Re: `glance location-update` deletes locations and backend images
Reviewed: https://review.openstack.org/280786 Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=9aa0debabff6fb20ea3bc46e1e467e893b05801c Submitter: Jenkins Branch:master commit 9aa0debabff6fb20ea3bc46e1e467e893b05801c Author: Fei Long Wang Date: Tue Feb 9 16:40:34 2016 +1300 Fix location update After commit Ieb03aaba887492819f9c58aa67f7acfcea81720e, the command location-update is totally broken now. This patch fixes the issue and a test case is added. Besides, with this change, location add/remove/update can't be executed if the show_multiple_locations is False. APIImpact DocImpact Closes-Bug: #1537626 Change-Id: I7284dee828bc8ca00747bc7668b37fa7176afc85 ** Changed in: glance Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1537626 Title: `glance location-update` deletes locations and backend images Status in Glance: Fix Released Status in Glance liberty series: New Status in python-glanceclient: In Progress Bug description: Hi all, I am having trouble using `glance location-update --url --metadata ` to update the metadata of a location. When I try run the command, the locations become a blank list and the image is deleted from my backend (swift+https). I have traced it down to the following: When doing a location-update, glanceclient actually sends two patch commands: [{'op': 'replace', 'path': '/locations', 'value': []}, {'op': 'replace', 'path': '/locations', 'value': [{u'metadata': {u'key': 'value'}, {u'url': u'swift+https://image1'}]}] This is due to a note in python- glanceclient/glanceclient/v2/images.py, update_location(): # NOTE: The server (as of now) doesn't support modifying individual # location entries. So we must: # 1. Empty existing list of locations. # 2. Send another request to set 'locations' to the new list # of locations. However, at the server end, the _do_replace_locations() function which handles this call, actually deletes the locations and images when it gets the first call with the empty values (glance/glance/api/v2/images.py) ??? def _do_replace_locations(self, image, value): if len(image.locations) > 0 and len(value) > 0: msg = _("Cannot replace locations from a non-empty " "list to a non-empty list.") raise webob.exc.HTTPBadRequest(explanation=msg) if len(value) == 0: # NOTE(zhiyan): this actually deletes the location # from the backend store. del image.locations[:] if image.status == 'active': image.status = 'queued' This seems to result in the first call deleting all the locations from the backend store, and the second call throwing an error because there is no location any more. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1537626/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1537626] Re: `glance location-update` deletes locations and backend images
** Also affects: glance/liberty Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1537626 Title: `glance location-update` deletes locations and backend images Status in Glance: In Progress Status in Glance liberty series: New Status in python-glanceclient: In Progress Bug description: Hi all, I am having trouble using `glance location-update --url --metadata ` to update the metadata of a location. When I try run the command, the locations become a blank list and the image is deleted from my backend (swift+https). I have traced it down to the following: When doing a location-update, glanceclient actually sends two patch commands: [{'op': 'replace', 'path': '/locations', 'value': []}, {'op': 'replace', 'path': '/locations', 'value': [{u'metadata': {u'key': 'value'}, {u'url': u'swift+https://image1'}]}] This is due to a note in python- glanceclient/glanceclient/v2/images.py, update_location(): # NOTE: The server (as of now) doesn't support modifying individual # location entries. So we must: # 1. Empty existing list of locations. # 2. Send another request to set 'locations' to the new list # of locations. However, at the server end, the _do_replace_locations() function which handles this call, actually deletes the locations and images when it gets the first call with the empty values (glance/glance/api/v2/images.py) ??? def _do_replace_locations(self, image, value): if len(image.locations) > 0 and len(value) > 0: msg = _("Cannot replace locations from a non-empty " "list to a non-empty list.") raise webob.exc.HTTPBadRequest(explanation=msg) if len(value) == 0: # NOTE(zhiyan): this actually deletes the location # from the backend store. del image.locations[:] if image.status == 'active': image.status = 'queued' This seems to result in the first call deleting all the locations from the backend store, and the second call throwing an error because there is no location any more. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1537626/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp
[Yahoo-eng-team] [Bug 1537626] Re: `glance location-update` deletes locations and backend images
https://review.openstack.org/#/c/35134/14 here is the original patch ** Project changed: python-glanceclient => glance ** Also affects: python-glanceclient Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1537626 Title: `glance location-update` deletes locations and backend images Status in Glance: New Status in python-glanceclient: New Bug description: Hi all, I am having trouble using `glance location-update --url --metadata ` to update the metadata of a location. When I try run the command, the locations become a blank list and the image is deleted from my backend (swift+https). I have traced it down to the following: When doing a location-update, glanceclient actually sends two patch commands: [{'op': 'replace', 'path': '/locations', 'value': []}, {'op': 'replace', 'path': '/locations', 'value': [{u'metadata': {u'key': 'value'}, {u'url': u'swift+https://image1'}]}] This is due to a note in python- glanceclient/glanceclient/v2/images.py, update_location(): # NOTE: The server (as of now) doesn't support modifying individual # location entries. So we must: # 1. Empty existing list of locations. # 2. Send another request to set 'locations' to the new list # of locations. However, at the server end, the _do_replace_locations() function which handles this call, actually deletes the locations and images when it gets the first call with the empty values (glance/glance/api/v2/images.py) ??? def _do_replace_locations(self, image, value): if len(image.locations) > 0 and len(value) > 0: msg = _("Cannot replace locations from a non-empty " "list to a non-empty list.") raise webob.exc.HTTPBadRequest(explanation=msg) if len(value) == 0: # NOTE(zhiyan): this actually deletes the location # from the backend store. del image.locations[:] if image.status == 'active': image.status = 'queued' This seems to result in the first call deleting all the locations from the backend store, and the second call throwing an error because there is no location any more. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1537626/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp