Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.68k stars 5.1k forks source link

Compute gallery image delete return 409 error #11559

Open yupwei68 opened 4 years ago

yupwei68 commented 4 years ago

We have a compute image, a gallery, a gallery image, and a gallery image version resources. Then we start to delete them.

1. Delete gallery image version: DELETE /subscriptions/.../resourceGroups/acctestRG-201105153850262730/providers/Microsoft.Compute/galleries/acctestsig201105153850262730/images/acctestimg201105153850262730/versions/1234567890.1234567890.1234567890?api-version=2019-12-01 HTTP/1.1

Response: HTTP/2.0 202 Accepted Azure-Asyncoperation: https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?api-version=2019-12-01 Cache-Control: no-cache Date: Thu, 05 Nov 2020 08:24:49 GMT Expires: -1 Location: https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?monitor=true&api-version=2019-12-01 Pragma: no-cache Retry-After: 60 Server: Microsoft-HTTPAPI/2.0 Server: Microsoft-HTTPAPI/2.0 Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Ratelimit-Remaining-Resource: Microsoft.Compute/DeleteGalleryImageVersion3Min;149,Microsoft.Compute/DeleteGalleryImageVersion30Min;999 X-Ms-Ratelimit-Remaining-Subscription-Deletes: 14997 X-Ms-Request-Id: 4bb6cded-9eca-4292-a330-4e5e7807ed7f X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082449Z:11a2ec45-51ff-4cd2-8eb0-ff4003054c3d X-Ms-Served-By: 64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773,64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773 Content-Length: 0

2. Polling version delete succeed: GET /subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?api-version=2019-12-01 HTTP/1.1

Response: HTTP/2.0 200 OK Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Thu, 05 Nov 2020 08:26:50 GMT Expires: -1 Pragma: no-cache Server: Microsoft-HTTPAPI/2.0 Server: Microsoft-HTTPAPI/2.0 Strict-Transport-Security: max-age=31536000; includeSubDomains Vary: Accept-Encoding X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Ratelimit-Remaining-Resource: Microsoft.Compute/GetOperationStatus3Min;1196,Microsoft.Compute/GetOperationStatus30Min;4148 X-Ms-Ratelimit-Remaining-Subscription-Reads: 11957 X-Ms-Request-Id: 0fe8f426-92b9-4150-a8e3-41fd77c044e6 X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082650Z:2f2c6cca-0a9d-4c2e-b56c-cf507c58e0c2 X-Ms-Served-By: 64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773,64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773

{ "startTime": "2020-11-05T08:24:49.3573933+00:00", "endTime": "2020-11-05T08:26:20.5457831+00:00", "status": "Succeeded", "name": "4bb6cded-9eca-4292-a330-4e5e7807ed7f" }

3. Delete gallery image: DELETE /subscriptions/.../resourceGroups/acctestRG-201105153850262730/providers/Microsoft.Compute/galleries/acctestsig201105153850262730/images/acctestimg201105153850262730?api-version=2019-12-01 HTTP/1.1

HTTP/2.0 409 Conflict Content-Length: 114 Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Thu, 05 Nov 2020 08:26:52 GMT Expires: -1 Pragma: no-cache Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Failure-Cause: gateway X-Ms-Request-Id: 633e7bc6-e2ab-4db1-bdb7-b3ceea965b1f X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082652Z:633e7bc6-e2ab-4db1-bdb7-b3ceea965b1f

{"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}}

mybayern1974 commented 4 years ago

This issue could repro. A brief of the symptom is SharedImageVersion returns "delete-succeeded" but SharedImage Deletion complains itself could not be deleted for its nested resource (SharedImageVersion) still exist.

This issue started to appear from some 2nd half of 2020 Oct, per my personal observation.

Below is the log sequence I caught, which indeed is align with what @yupwei68 provided:

2020/11/06 12:50:33 [DEBUG] AzureRM Request: DELETE /subscriptions/.../resourceGroups/acctestRG-201106123106293176/providers/Microsoft.Compute/galleries/acctestsig201106123106293176/images/acctest-gallery-image/versions/0.0.1?api-version=2019-12-01 HTTP/1.1

2020/11/06 12:50:34 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/.../resourceGroups/acctestRG-201106123106293176/providers/Microsoft.Compute/galleries/acctestsig201106123106293176/images/acctest-gallery-image/versions/0.0.1?api-version=2019-12-01: HTTP/2.0 **202 Accepted** Azure-Asyncoperation: https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/863f8ec6-f6b9-4d3a-9818-cf1e31b0874c?api-version=2019-12-01

2020/11/06 12:51:35 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/863f8ec6-f6b9-4d3a-9818-cf1e31b0874c?api-version=2019-12-01: HTTP/2.0 **200 OK**

2020/11/06 12:52:35 [DEBUG] AzureRM Request: DELETE /subscriptions/.../resourceGroups/acctestRG-201106123106293176/providers/Microsoft.Compute/galleries/acctestsig201106123106293176/images/acctest-gallery-image?api-version=2019-12-01 HTTP/1.1

2020/11/06 12:52:36 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/.../resourceGroups/acctestRG-201106123106293176/providers/Microsoft.Compute/galleries/acctestsig201106123106293176/images/acctest-gallery-image?api-version=2019-12-01: HTTP/2.0 **409 Conflict**

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @vaibhav-agar.

axayjo commented 3 years ago

Looking into this. @yupwei68 how many regions had you replicated the image version to? And how many replicas were there in reach region before you triggered the delete operation?

mybayern1974 commented 3 years ago

@axayjo , only 1 target region and in that region only contains 1 replica could repro this issue

axayjo commented 3 years ago

Thanks @mybayern1974. The delete operation might still be running in the background and since it's an async operation, the polling operation might have succeeded. @olayemio can you please take a look into this?

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

Issue Details
We have a compute image, a gallery, a gallery image, and a gallery image version resources. Then we start to delete them. **1. Delete gallery image version:** DELETE /subscriptions/.../resourceGroups/acctestRG-201105153850262730/providers/Microsoft.Compute/galleries/acctestsig201105153850262730/images/acctestimg201105153850262730/versions/1234567890.1234567890.1234567890?api-version=2019-12-01 HTTP/1.1 Response: HTTP/2.0 202 Accepted Azure-Asyncoperation: https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?api-version=2019-12-01 Cache-Control: no-cache **Date: Thu, 05 Nov 2020 08:24:49 GMT** Expires: -1 Location: https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?monitor=true&api-version=2019-12-01 Pragma: no-cache Retry-After: 60 Server: Microsoft-HTTPAPI/2.0 Server: Microsoft-HTTPAPI/2.0 Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Ratelimit-Remaining-Resource: Microsoft.Compute/DeleteGalleryImageVersion3Min;149,Microsoft.Compute/DeleteGalleryImageVersion30Min;999 X-Ms-Ratelimit-Remaining-Subscription-Deletes: 14997 X-Ms-Request-Id: 4bb6cded-9eca-4292-a330-4e5e7807ed7f X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082449Z:11a2ec45-51ff-4cd2-8eb0-ff4003054c3d X-Ms-Served-By: 64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773,64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773 Content-Length: 0 **2. Polling version delete succeed:** GET /subscriptions/.../providers/Microsoft.Compute/locations/westeurope/capsOperations/4bb6cded-9eca-4292-a330-4e5e7807ed7f?api-version=2019-12-01 HTTP/1.1 Response: HTTP/2.0 200 OK Cache-Control: no-cache Content-Type: application/json; charset=utf-8 **Date: Thu, 05 Nov 2020 08:26:50 GMT** Expires: -1 Pragma: no-cache Server: Microsoft-HTTPAPI/2.0 Server: Microsoft-HTTPAPI/2.0 Strict-Transport-Security: max-age=31536000; includeSubDomains Vary: Accept-Encoding X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Ratelimit-Remaining-Resource: Microsoft.Compute/GetOperationStatus3Min;1196,Microsoft.Compute/GetOperationStatus30Min;4148 X-Ms-Ratelimit-Remaining-Subscription-Reads: 11957 X-Ms-Request-Id: 0fe8f426-92b9-4150-a8e3-41fd77c044e6 X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082650Z:2f2c6cca-0a9d-4c2e-b56c-cf507c58e0c2 X-Ms-Served-By: 64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773,64061c4a-8d7f-49b0-8597-01e5ba8fa233_132327983772912773 { "startTime": "2020-11-05T08:24:49.3573933+00:00", "endTime": "2020-11-05T08:26:20.5457831+00:00", "status": "Succeeded", "name": "4bb6cded-9eca-4292-a330-4e5e7807ed7f" } **3. Delete gallery image:** DELETE /subscriptions/.../resourceGroups/acctestRG-201105153850262730/providers/Microsoft.Compute/galleries/acctestsig201105153850262730/images/acctestimg201105153850262730?api-version=2019-12-01 HTTP/1.1 HTTP/2.0 409 Conflict Content-Length: 114 Cache-Control: no-cache Content-Type: application/json; charset=utf-8 **Date: Thu, 05 Nov 2020 08:26:52 GMT** Expires: -1 Pragma: no-cache Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: e359a466-e283-5cb0-2e87-907fdaaef911 X-Ms-Failure-Cause: gateway X-Ms-Request-Id: 633e7bc6-e2ab-4db1-bdb7-b3ceea965b1f X-Ms-Routing-Request-Id: SOUTHEASTASIA:20201105T082652Z:633e7bc6-e2ab-4db1-bdb7-b3ceea965b1f {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}}
Author: yupwei68
Assignees: snaheth, olayemio
Labels: `ARM`, `Compute - Images`, `Service Attention`
Milestone: -
amjads1 commented 3 years ago

Per @olayemio , assigned to @snaheth and updated with ARM label.

olayemio commented 3 years ago

Per our team's investigation, this error occurs in ARM because ARM has not updated its cache when the child is deleted.