)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"220c1dae7ad56ac35e96e62fd1236535b71d0a5f","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Glance will return None if the image is not found.  Trigger the"},{"line_number":10,"context_line":"retry logic in cinder when glance returns None so a later access"},{"line_number":11,"context_line":"of the call function doen\u0027t reference a variable with None.  This"},{"line_number":12,"context_line":"can result in a stack backtrace in the download function because"},{"line_number":13,"context_line":"the result of call is used as an iterable."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"1a122d0e_e64c50ca","line":11,"range":{"start_line":11,"start_character":21,"end_line":11,"end_character":25},"updated":"2016-04-19 11:46:51.000000000","message":"typo","commit_id":"48ad0426c18c4deafa170a96c681d2d2ae5bdfdc"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"220c1dae7ad56ac35e96e62fd1236535b71d0a5f","unresolved":false,"context_lines":[{"line_number":17,"context_line":"and issue the command to the image service using getattr."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Frankly, this might not be such a hot idea, the initial fix"},{"line_number":20,"context_line":"proposed by sdake is good fro handling fetch related calls,"},{"line_number":21,"context_line":"however there are a few methods we call here that return None"},{"line_number":22,"context_line":"as an expected result."},{"line_number":23,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"1a122d0e_06ceac2d","line":20,"range":{"start_line":20,"start_character":26,"end_line":20,"end_character":29},"updated":"2016-04-19 11:46:51.000000000","message":"typo","commit_id":"48ad0426c18c4deafa170a96c681d2d2ae5bdfdc"},{"author":{"_account_id":17130,"name":"melissaml","email":"ma.lei@99cloud.net","username":"malei"},"change_message_id":"55026900cbdb2ae1149e41a127ac1c39e2c229ee","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Glance will return None if the image is not found.  Trigger the"},{"line_number":10,"context_line":"retry logic in cinder when glance returns None so a later access"},{"line_number":11,"context_line":"of the call function doen\u0027t reference a variable with None.  This"},{"line_number":12,"context_line":"can result in a stack backtrace in the download function because"},{"line_number":13,"context_line":"the result of call is used as an iterable."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"bacf61ea_9ec2c6e7","line":11,"range":{"start_line":11,"start_character":21,"end_line":11,"end_character":27},"updated":"2016-07-31 14:28:47.000000000","message":"I think it maybe doesn\u0027t?   s/doen\u0027t/doesn\u0027t/g","commit_id":"954f495fcccb03e03e1d31d73b7f6e98e65220ee"}],"cinder/image/glance.py":[{"author":{"_account_id":2834,"name":"Steven Dake","email":"steven.dake@gmail.com","username":"sdake"},"change_message_id":"a8dc05c7d6a30e7b8e4629e159f675521759fd35","unresolved":false,"context_lines":[{"line_number":203,"context_line":"                                     kwargs.pop(\u0027controller\u0027, \u0027images\u0027))"},{"line_number":204,"context_line":"                ret \u003d getattr(controller, method)(*args, **kwargs)"},{"line_number":205,"context_line":"                if ret is None:"},{"line_number":206,"context_line":"                   raise"},{"line_number":207,"context_line":"                return ret"},{"line_number":208,"context_line":"            except retry_excs as e:"},{"line_number":209,"context_line":"                netloc \u003d self.netloc"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a122d0e_79579602","line":206,"updated":"2016-04-16 15:28:32.000000000","message":"I know this is a naked raise - looking for suggestions here on a proper raise.","commit_id":"5341f8e044cee2b5f57acc81e0975f1f63c1f8fe"},{"author":{"_account_id":16308,"name":"Sheel Rana","email":"ranasheel2000@gmail.com","username":"sheel.rana"},"change_message_id":"cd758e19069901e1e483d72235888da4070935af","unresolved":false,"context_lines":[{"line_number":203,"context_line":"                                     kwargs.pop(\u0027controller\u0027, \u0027images\u0027))"},{"line_number":204,"context_line":"                ret \u003d getattr(controller, method)(*args, **kwargs)"},{"line_number":205,"context_line":"                if ret is None:"},{"line_number":206,"context_line":"                   raise"},{"line_number":207,"context_line":"                return ret"},{"line_number":208,"context_line":"            except retry_excs as e:"},{"line_number":209,"context_line":"                netloc \u003d self.netloc"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a122d0e_394a3e84","line":206,"range":{"start_line":206,"start_character":19,"end_line":206,"end_character":24},"updated":"2016-04-16 17:05:43.000000000","message":"Though i have not tested, but in case image is not found, I think glance will raise \"glanceclient.exc.NotFound\" exception.\nMay be handling can be done accordingly if you can confirm by testing it.\n\nTake reference from image delete function in this file.\nReference Code snippet:\n--------------------------------------------------------\n\n   except glanceclient.exc.NotFound:\n       raise exception.ImageNotFound(image_id\u003dimage_id)\n\n--------------------------------------------------------","commit_id":"77ff42d11827e177faf07e7218b88e347f1936e5"},{"author":{"_account_id":16308,"name":"Sheel Rana","email":"ranasheel2000@gmail.com","username":"sheel.rana"},"change_message_id":"369fb490aec2c9141dd8b772348d84af8077b512","unresolved":false,"context_lines":[{"line_number":203,"context_line":"                                     kwargs.pop(\u0027controller\u0027, \u0027images\u0027))"},{"line_number":204,"context_line":"                ret \u003d getattr(controller, method)(*args, **kwargs)"},{"line_number":205,"context_line":"                if ret is None:"},{"line_number":206,"context_line":"                   raise"},{"line_number":207,"context_line":"                return ret"},{"line_number":208,"context_line":"            except retry_excs as e:"},{"line_number":209,"context_line":"                netloc \u003d self.netloc"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a122d0e_d9550a1e","line":206,"range":{"start_line":206,"start_character":19,"end_line":206,"end_character":24},"in_reply_to":"1a122d0e_394a3e84","updated":"2016-04-16 17:10:58.000000000","message":"Also exception.ImageNotFound can be used as you asked which exception to raise instead of naked raise....","commit_id":"77ff42d11827e177faf07e7218b88e347f1936e5"},{"author":{"_account_id":2834,"name":"Steven Dake","email":"steven.dake@gmail.com","username":"sdake"},"change_message_id":"e148a85ff4ba31de1da5c50ed6858232127d2948","unresolved":false,"context_lines":[{"line_number":203,"context_line":"                                     kwargs.pop(\u0027controller\u0027, \u0027images\u0027))"},{"line_number":204,"context_line":"                ret \u003d getattr(controller, method)(*args, **kwargs)"},{"line_number":205,"context_line":"                if ret is None:"},{"line_number":206,"context_line":"                   raise"},{"line_number":207,"context_line":"                return ret"},{"line_number":208,"context_line":"            except retry_excs as e:"},{"line_number":209,"context_line":"                netloc \u003d self.netloc"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a122d0e_6f5d08e9","line":206,"range":{"start_line":206,"start_character":19,"end_line":206,"end_character":24},"in_reply_to":"1a122d0e_394a3e84","updated":"2016-04-16 20:42:13.000000000","message":"if the image is not found during download in the current master code, no exception is raised.  Instead none is returned by the call function.  If an exception was raised, this patch wouldn\u0027t be needed at all as the except on line 208 would catch it and trigger the retry logic.\n\nI guess this is more to workaround a bug in glance, or the expectation that cinder has that glance will raise an exception when the image is not found.\n\nThe logs show a no-content error return code from glance client.  Reference the glanceclient code where no exception is raised, but instead None is returned:\n\nhttps://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/images.py#L197","commit_id":"77ff42d11827e177faf07e7218b88e347f1936e5"},{"author":{"_account_id":2834,"name":"Steven Dake","email":"steven.dake@gmail.com","username":"sdake"},"change_message_id":"6ed9fc4616a890d6ff514c31d9795a80db016a84","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                # are methods like delete, upload and data that we actually"},{"line_number":210,"context_line":"                # expect None in the return and we shouldn\u0027t raise in these"},{"line_number":211,"context_line":"                # cases, but instead they will raise NotFound for us."},{"line_number":212,"context_line":"                if ret is None and method not in [\u0027delete\u0027, \u0027upload\u0027, \u0027data\u0027]:"},{"line_number":213,"context_line":"                    raise exception.ImageNotFound(image_id\u003dargs[0])"},{"line_number":214,"context_line":"                return ret"},{"line_number":215,"context_line":"            except retry_excs as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_e36e4cc8","line":212,"updated":"2016-04-17 22:44:57.000000000","message":"the reason this doesn\u0027t work is data is \"download\" and that is where the backtrace occurs:\n\nReference:\nhttps://github.com/openstack/cinder/blob/master/cinder/image/glance.py#L343\n\nI am unclear how data raises NotFound unless that has something to do with getattr.\n\nThe glanceclient is created here:\nhttps://github.com/openstack/cinder/blob/master/cinder/image/glance.py#L103\n\nWhich references:\nhttps://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/images.py#L197\n\nLooking at the class definition here:\nhttps://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/images.py#L34\n\nNo getattr override is specified in this class that I can find.\n\nOrthogonally, I think all this checking is basically wrong.  For example I don\u0027t see where this exception would ever be raised in the call path:\nhttps://github.com/openstack/cinder/blob/master/cinder/image/glance.py#L400\n\nPerhaps there was some base class used prior that raised an exception and cinder has been refactored?","commit_id":"548cbc91d793625903b8b6607d171adfcb710866"}]}
