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

Openstack volume state not updated after VM removal #8045

Closed
GiovanniPaoloGibilisco opened this issue Aug 8, 2016 · 2 comments · Fixed by #8172
Closed

Openstack volume state not updated after VM removal #8045

GiovanniPaoloGibilisco opened this issue Aug 8, 2016 · 2 comments · Fixed by #8172
Labels

Comments

@GiovanniPaoloGibilisco
Copy link
Contributor

GiovanniPaoloGibilisco commented Aug 8, 2016

Description

If a VM with external volumes is created and then destroyed, leaving the volumes intact, the state of the volumes is not updated after the vm deletion until a refresh is performed.

Terraform Version

$ terraform -v
Terraform v0.7.0

Affected Resource(s)

The issue affects these resources:

  • openstack_blockstorage_volume_v1
  • openstack_compute_instance_v2

Terraform Configuration Files

This issue occurs after modifying the configuration file. The initial configuration is the following

resource "openstack_blockstorage_volume_v1" "root_volume_1" {
  name = "root_volume_1"
  size = 10
  image_id = "90ee49d8-1c18-45ca-8a72-14ffd120521e"
}

resource "openstack_blockstorage_volume_v1" "additional_volume_1" {
  name = "additional_volume_1"
  size = 5
}


resource "openstack_compute_instance_v2" "test_name" {
  name = "test_name"
  flavor_id = "3"
  key_pair = "test-keypair"
  security_groups = ["default"]

  block_device {
    uuid = "${openstack_blockstorage_volume_v1.root_volume_1.id}"
    source_type = "volume"
    boot_index = 0
    destination_type = "volume"
    delete_on_termination = false
  }

  volume {
    volume_id = "${openstack_blockstorage_volume_v1.additional_volume_1.id}"
  }

  metadata {
    application = "app1"
  }

  network {
    name = "netwrok"
  }
}

after applying this configuration remove the VM obtaining:

resource "openstack_blockstorage_volume_v1" "root_volume_1" {
  name = "root_volume_1"
  size = 10
  image_id = "90ee49d8-1c18-45ca-8a72-14ffd120521e"
}

resource "openstack_blockstorage_volume_v1" "additional_volume_1" {
  name = "additional_volume_1"
  size = 5
}

Debug Output

The debug output of the terraform apply command that removes the vm is available in this gist
The terraform state file after the execution of this command is available in this gist

The debug output of the terraform refresh command is available in this gist
The (correct) terraform state file after the execution of this command is available in this gist

Expected Behavior

The command terraform show issued after the removal of the vm should show two volumes not attached to any machine. It should be consistent with the output of the same command after the terraform refresh (assuming no other change happened in the mean time)

Actual Behavior

Issuing terraform show after the deletion of the vm shows two volumes still attached to the vm, which does not exist.

After issuing a terraform refresh the terraform show command shows correctly the two volumes not attached.

Steps to Reproduce

  1. create a config.tf file as described above with 2 volumes and 1 vm
  2. terraform apply
  3. remove from the file the specification of the vm
  4. terraform apply
  5. terraform show
  6. terraform refresh
  7. terraform show

References

Might refer to:

@GiovanniPaoloGibilisco
Copy link
Contributor Author

Additional Info

The issue is also there if you put back the VM into the configuration file and perform an apply.
The VM is correctly spawned using the two volumes but the successive terraform show does not show the volumes are attached. Still a terraform refresh fixes the state.

@ghost
Copy link

ghost commented Apr 23, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants