diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance index e99a651981..9c4bc20e92 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance @@ -204,17 +204,23 @@ def _upload_tarball(staging_path, image_id, glance_host, glance_port, "Response Status: %i, Response body: %s" % (url, resp.status, resp.read())) - if resp.status == httplib.UNAUTHORIZED: - # NOTE(johngarbutt): little point in retrying when token invalid - raise PluginError("Unauthorized error while uploading " - "image [%s] " - "to glance host [%s:%s]" - % (image_id, glance_host, glance_port)) + if resp.status in (httplib.UNAUTHORIZED, + httplib.REQUEST_ENTITY_TOO_LARGE, + httplib.PRECONDITION_FAILED, + httplib.CONFLICT, + httplib.FORBIDDEN): + # No point in retrying for these conditions + raise PluginError("Got Error response [%i] while uploading " + "image [%s] " + "to glance host [%s:%s]" + % (resp.status, image_id, + glance_host, glance_port)) else: raise RetryableError("Unexpected response [%i] while uploading " - "image [%s] " - "to glance host [%s:%s]" - % (resp.status, image_id, glance_host, glance_port)) + "image [%s] " + "to glance host [%s:%s]" + % (resp.status, image_id, + glance_host, glance_port)) finally: conn.close()