Skip to content

fix relying on cinder attachment deletion#103

Merged
lbajolet-hashicorp merged 1 commit intohashicorp:mainfrom
felixhuettner:openstack_detach
Jul 5, 2023
Merged

fix relying on cinder attachment deletion#103
lbajolet-hashicorp merged 1 commit intohashicorp:mainfrom
felixhuettner:openstack_detach

Conversation

@felixhuettner
Copy link
Copy Markdown
Contributor

Previously the rough flow of building an image was as follows (if using a volume):

  1. create a volume
  2. create a server
  3. do things on the server
  4. send a detach call for the volume to cinder
  5. upload the volume as an image
  6. delete the server

However in step 4 the volume was never actually detached from the server. Using this call cinder just thought that the volume is now detached. In 1 this functionallity was removed from cinder as a security vulnerability. Now such call can only be made from nova (or if the server is already deleted).

In order for packer to still work we need to actually detach the volume from the server. As it is the root volume this is only possible if we delete the server.

So if we use a blockstorage backend we now delete the server before uploading the volume. If we do not use a blockstorage backend then the logic is not altered.

@felixhuettner felixhuettner requested a review from a team as a code owner June 2, 2023 08:47
@hashicorp-cla
Copy link
Copy Markdown

hashicorp-cla commented Jun 2, 2023

CLA assistant check
All committers have signed the CLA.

@paulojmdias
Copy link
Copy Markdown

Any news on this? We are hitting this issue

@MuriloKomirchuk
Copy link
Copy Markdown

We're also being impacted by this and really need this fix.

Thanks.

Copy link
Copy Markdown
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @felixhuettner,

Sorry for letting this one open for so long, I just reviewed the code, and it looks good to me, thanks for the contribution!

I just left one comment regarding the code to delete the server, since it's functionally equivalent to the code in another step, I believe we can factorise this, but no stress if that's complex, we can merge this as-is I think.

Let me know if you can make it work by factorising this part, and I'll revisit this PR then.

I'm pre-approving this PR in the meantime.

Thanks again!

Previously the rough flow of building an image was as follows (if using
a volume):
1. create a volume
2. create a server
3. do things on the server
4. send a detach call for the volume to cinder
5. upload the volume as an image
6. delete the server

However in step 4 the volume was never actually detached from the
server. Using this call cinder just thought that the volume is now
detached. In [1] this functionallity was removed from cinder as a
security vulnerability. Now such call can only be made from nova (or if
the server is already deleted).

In order for packer to still work we need to actually detach the volume
from the server. As it is the root volume this is only possible if we
delete the server.

So if we use a blockstorage backend we now delete the server before
uploading the volume. If we do not use a blockstorage backend then the
logic is not altered.

[1]: https://review.opendev.org/c/openstack/cinder/+/882835
@lbajolet-hashicorp
Copy link
Copy Markdown
Contributor

Hi @felixhuettner,

Thanks for rerolling this so quickly, much appreciated.

With the factorised code, this looks ripe for merging in my opinion, I'll do this now, thanks again for the PR!

@lbajolet-hashicorp lbajolet-hashicorp merged commit b30391d into hashicorp:main Jul 5, 2023
@felixhuettner felixhuettner deleted the openstack_detach branch July 5, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants