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

Unable to delete a Guacamole User Resource if it is in the 'stopped' state #4135

Open
dram1964 opened this issue Nov 13, 2024 · 5 comments · Fixed by #4203
Open

Unable to delete a Guacamole User Resource if it is in the 'stopped' state #4135

dram1964 opened this issue Nov 13, 2024 · 5 comments · Fixed by #4203
Labels
bug Something isn't working

Comments

@dram1964
Copy link

Deleting a VM from the Guacamole service fails if the VM is in a stopped state

Attempting to delete a 'Stopped' VM, results in a 'deleting_failed' status and displays the following error:

compute.VirtualMachinesClient#
PowerOff: Failure sending request: StatusCode=0 -- 
Original Error: autorest/azure: Service returned an error. 
Status=<nil> 
Code="OperationNotAllowed" 
Message="Operation 'powerOff' is not allowed on VM 'linuxvm4fae' since the VM is either deallocated or marked to be deallocated.

Seems that the deletion request fails because it is trying to stop the VM, when it is already stopped. If I 'Enable' the resource, 'Start' it, then 'Disable' it, the resource can be deleted successfully.

Steps to reproduce

  1. Login to the TRE UI (as TRE Administrator)
  2. Connect to a Workspace
  3. Connect to the Virtual Desktops (Guacamole) service
  4. Select 'Actions > Stop' from either a linux or windows VM
  5. Select 'Disable' for the same resource
  6. Select 'Delete' for the same resource

Although I'm currently seeing this error from a Custom Workspace and a Custom Guacamole User-Resource, I did also encounter this problem when using the tre-base-workspace (1.5.7) and the tre-service-guacamole-linuxvm (1.0.3)

Azure TRE release version (e.g. v0.19.1):

Deployed Azure TRE components: tre-service-guacamole (0.10.9), tre-service-guacamole-linuxvm (1.0.3)

@dram1964 dram1964 added the bug Something isn't working label Nov 13, 2024
@tim-p-allen
Copy link
Collaborator

Hi @dram1964 sounds like there's a logic error in the code for this, its been added to the backlog to look into a fix

@marrobi
Copy link
Member

marrobi commented Nov 15, 2024

Think it's worth validating this via the API first, then the UI.

It could be the UI has an issue, as I don't think "Delete" which triggers uninstall attempts a stop. I might be incorrect.

@marrobi
Copy link
Member

marrobi commented Dec 5, 2024

The manual workaround would be to delete the resource from cosmos and from Azure, but hope we can find a better solution and fix the issue.

@marrobi
Copy link
Member

marrobi commented Dec 17, 2024

It's actually a terraform issue: hashicorp/terraform-provider-azurerm#28218

we need to add this to all the Guacamole VM templates:

provider "azurerm" {
  features {
    virtual_machine {
      skip_shutdown_and_force_delete = true
    }
  }
}

marrobi added a commit that referenced this issue Dec 17, 2024
Fixes #4135

Add `skip_shutdown_and_force_delete` configuration to Guacamole VM templates to fix deletion issue.

* Modify `main.tf` files in `templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm/terraform`, `guacamole-azure-import-reviewvm/terraform`, `guacamole-azure-linuxvm/terraform`, and `guacamole-azure-windowsvm/terraform` to include `skip_shutdown_and_force_delete = true` under the `virtual_machine` block in the `features` section.
* Update `porter.yaml` files in `templates/workspace_services/guacamole/user_resources/guacamole-azure-export-reviewvm`, `guacamole-azure-import-reviewvm`, `guacamole-azure-windowsvm`, and `guacamole-azure-linuxvm` to increment the version numbers.
* Update `CHANGELOG.md` to include the fix for the deletion issue.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/AzureTRE/issues/4135?shareId=XXXX-XXXX-XXXX-XXXX).
@github-project-automation github-project-automation bot moved this from Up Next to Done in Azure TRE - Engineering Dec 17, 2024
@marrobi marrobi reopened this Dec 26, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in Azure TRE - Engineering Dec 26, 2024
@marrobi
Copy link
Member

marrobi commented Dec 26, 2024

@tamirkamara got any other ideas for this then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants