Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compute Capacity Reservation Group Delete Fails With no Reservations #18767

Closed
myc2h6o opened this issue Apr 21, 2022 · 10 comments
Closed

compute Capacity Reservation Group Delete Fails With no Reservations #18767

myc2h6o opened this issue Apr 21, 2022 · 10 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute - VM customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@myc2h6o
Copy link

myc2h6o commented Apr 21, 2022

Hi, I'm using On-demand Capacity Reservation feature and have found an issue with Delete: When I tries deleting the Capacity Reservation Group shortly after (in fewer than 5 seconds) I delete all the reservations in it, it throws an error of still having nested resource in it.

Below is what I tested using Invoke-WebRequest PowerShell command to make the REST API requests. Because it happens only within a short range, I invoked the DELETE in a batch and used GET to check the result. As can be seen below: in the second GET response, capacityReservations is already removed from the CapacityReservationGroup, but the subsequent DELETE still cannot delete it. And I'm only able to invoke the DELETE after about 5 seconds.

PS C:\Users\yicma> Write-Host "`nCapacity Reservation Group before deleting the reservation:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "GET" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content
>>
>> Write-Host "`nDeleting Reservations:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test/capacityReservations/reserve-0?api-version=2021-11-01).Content
>>
>> Write-Host "`nCapacity Reservation Group after deleting the reservation:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "GET" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content
>>
>> Write-Host "`nDeleting Capacity Reservation Group:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content 

Capacity Reservation Group before deleting the reservation:

{
  "name": "yicma-cap-test",
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test",
  "type": "Microsoft.Compute/capacityReservationGroups",
  "location": "eastus",
  "tags": {
    "a": "b"
  },
  "properties": {
    "capacityReservations": [
      {
        "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/YICMA-CAP-TEST/capacityReservations/RESERVE-0"
      }
    ]
  }
}

Deleting Reservations:


Capacity Reservation Group after deleting the reservation:

{
  "name": "yicma-cap-test",
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test",
  "type": "Microsoft.Compute/capacityReservationGroups",
  "location": "eastus",
  "tags": {
    "a": "b"
  }
}

Deleting Capacity Reservation Group:

Invoke-WebRequest : {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}}
At line:15 char:2
+ (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Apr 21, 2022
@myc2h6o
Copy link
Author

myc2h6o commented Apr 21, 2022

It looks similar to #18572 and #8137

@JackTn JackTn added Compute - VM Service Attention This issue is responsible by Azure service team. labels May 5, 2022
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label May 5, 2022
@ghost
Copy link

ghost commented May 5, 2022

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

Issue Details

Hi, I'm using On-demand Capacity Reservation feature and have found an issue with Delete: When I tries deleting the Capacity Reservation Group shortly after (in fewer than 5 seconds) I delete all the reservations in it, it throws an error of still having nested resource in it.

Below is what I tested using Invoke-WebRequest PowerShell command to make the REST API requests. Because it happens only within a short range, I invoked the DELETE in a batch and used GET to check the result. As can be seen below: in the second GET response, capacityReservations is already removed from the CapacityReservationGroup, but the subsequent DELETE still cannot delete it. And I'm only able to invoke the DELETE after about 5 seconds.

PS C:\Users\yicma> Write-Host "`nCapacity Reservation Group before deleting the reservation:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "GET" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content                                                                                                                                                                                                          >>                                                                                                                                                                                                                                           >> Write-Host "`nDeleting Reservations:`n"                                                                                                                                                                                                   >>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test/capacityReservations/reserve-0?api-version=2021-11-01).Content
>>
>> Write-Host "`nCapacity Reservation Group after deleting the reservation:`n"
>>
>> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "GET" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content
>>
>> Write-Host "`nDeleting Capacity Reservation Group:`n"                                                                                                                                                                                     >>                                                                                                                                                                                                                                           >> (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE" https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yicma/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test?api-version=2021-11-01).Content 
                                                                                                                                                                              
Capacity Reservation Group before deleting the reservation:

{
  "name": "yicma-cap-test",
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test",
  "type": "Microsoft.Compute/capacityReservationGroups",
  "location": "eastus",
  "tags": {
    "a": "b"
  },
  "properties": {
    "capacityReservations": [
      {
        "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/YICMA-CAP-TEST/capacityReservations/RESERVE-0"
      }
    ]
  }
}

Deleting Reservations:


Capacity Reservation Group after deleting the reservation:

{
  "name": "yicma-cap-test",
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/YICMA/providers/Microsoft.Compute/capacityReservationGroups/yicma-cap-test",
  "type": "Microsoft.Compute/capacityReservationGroups",
  "location": "eastus",
  "tags": {
    "a": "b"
  }
}

Deleting Capacity Reservation Group:

Invoke-WebRequest : {"error":{"code":"CannotDeleteResource","message":"Can not delete resource before nested resources are deleted."}}
At line:15 char:2
+ (Invoke-WebRequest -UseBasicParsing -Headers $headers -Method "DELETE ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Author: myc2h6o
Assignees: -
Labels:

question, Compute - VM, Service Attention, customer-reported, needs-triage

Milestone: -

@avirishuv
Copy link

hi @oriwolman or @TravisCragg-MSFT would you please take a look at this issue?

@TravisCragg-MSFT
Copy link

@myc2h6o Does the deletion succeed after several minutes has passed, or does it continue to fail?

@myc2h6o
Copy link
Author

myc2h6o commented May 6, 2022

Hi @TravisCragg-MSFT the deletion will succeed after a few seconds.

@TravisCragg-MSFT
Copy link

@myc2h6o Have you tried doing the same via PowerShell or CLI to see if the behavior is the same?

@myc2h6o
Copy link
Author

myc2h6o commented Jul 22, 2022

@TravisCragg-MSFT I haven't tried PowerShell or CLI, I only tried REST API.

@TravisCragg-MSFT TravisCragg-MSFT added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Aug 25, 2022
@jaylabell
Copy link

@TravisCragg-MSFT are you still looking into this issue?

@TravisCragg-MSFT
Copy link

I am following up with our team to fix this delay, or update the error message to state a wait period.

@TravisCragg-MSFT
Copy link

@myc2h6o This failure can occur sometimes if the delete of the Capacity Reservations has not fully synced and you call a delete for the group. When calling these programmatically, a small delay between the nested resource delete and the Reservation Group delete should resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute - VM customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants