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 builder hangs when using use_blockstorage_volume if volume size is too small #6957

Closed
puetzk opened this issue Nov 5, 2018 · 11 comments
Labels
bug builder/openstack community-supported-plugin denotes requests for plugins that are supported by the community, not by HashiCorp engineers good first issue remote-plugin/openstack

Comments

@puetzk
Copy link
Contributor

puetzk commented Nov 5, 2018

From #6956 (comment)

If the value determined by GetVolumeSize is actually too low, perhaps an image with no value set for MinDiskGigabytes, in a format (e.g. qcow2) where the file is considerably smaller than the minimum volume that can unpack it, the volume is created but the status shown in cinder list becomes "error". WaitForVolume doesn't seem to recognize this case, and just keeps looping (and waiting) indefinitely), since volumes.Get is succeeding (the GUID does exist and has a status to read), and "error" != "available".

@puetzk
Copy link
Contributor Author

puetzk commented Nov 5, 2018

Note by hangs, I just mean that it reports:

Waiting for volume packer_<...> (volume id: <...) to become available...

and then keeps polling it indefinitely (for hours at least). If I manually remove the status="error" volume, it notices the polling failure and exits. So it's not really 'hung' so much as just failing to make progress or give up.

==> openstack: Error waiting for volume: Resource not found
Build 'openstack' errored: Error waiting for volume: Resource not found

==> Some builds didn't complete successfully and had errors:
[focus-cloud-esf | ubuntu-xenial] --> openstack: Error waiting for volume: Resource not found

@jo
Copy link
Contributor

jo commented Dec 17, 2018

Hi, we also have the problem - is there a possibility to set the size of the volume? Or another workaround?

@SwampDragons
Copy link
Contributor

I don't believe we currently have that feature, but PRs are always welcome :)

@jo
Copy link
Contributor

jo commented Dec 18, 2018

Hi @SwampDragons, sadly I don't have Go skills yet :)

This problem makes it impossible to create an image other than the default RAW, which results in very large volumes (25GB in our case vs ~500MB for QCOW2).

This is our build definition:

{
  "builders": [{
    "type": "openstack",
    "ssh_username": "root",
    "image_name": "poc-symphony-api-server",
    "source_image_name": "ubuntu-16.04-server-cloudimg-amd64",
    "image_disk_format": "qcow2",
    "use_blockstorage_volume": true,
    "flavor": "m1.small",
    "networks": ["03d67faf-be0d-4d27-9044-a544a42c217d"],
    "security_groups": ["ssh"]
  }]
}

When we run it:

==> openstack: Loading flavor: m1.small
    openstack: Verified flavor. ID: f885c36d-d5d2-4421-a1f4-b0a68716ede7
==> openstack: Creating temporary keypair: packer_5c18d1de-d57f-9027-7772-cd93d33cfca1 ...
==> openstack: Created temporary keypair: packer_5c18d1de-d57f-9027-7772-cd93d33cfca1
    openstack: Found Image ID: 07fc4691-ee35-4394-887a-4850f5ba1300
==> openstack: Creating volume...
==> openstack: Waiting for volume packer_5c18d1de-f16a-becd-f126-62d32c79244e (volume id: 15602ad4-5420-451b-8998-738e43742a77) to become available...

now it hangs. OpenStack console shows for the volume:

Name: packer_5c18d1de-f16a-becd-f126-62d32c79244e
ID: 15602ad4-5420-451b-8998-738e43742a77
Status: Error 
Size: 1 GiB

Any hints of how we can create different volumes than RAW would be highly appreciated.

@SwampDragons SwampDragons added community-supported-plugin denotes requests for plugins that are supported by the community, not by HashiCorp engineers good first issue labels Dec 18, 2018
@SwampDragons
Copy link
Contributor

This is a community-supported plugin, which means HashiCorp's devs aren't going to prioritize adding new features to it, but a size option should be fairly straightforward to add; if you add a VolumeSize field to the step here: https://github.com/hashicorp/packer/blob/master/builder/openstack/step_create_volume.go then you can do a check for whether VolumeSize is > 0 and put the GetVolumeSize code into a conditional.

I'm happy to review PRs for this.

jo added a commit to jo/packer that referenced this issue Dec 18, 2018
if present. Otherwise fallback to to source image min disk value (if
set) or calculated from the source image bytes size.

Note that in some cases this needs to be specified, if
`use_blockstorage_volume` is true. See hashicorp#6957 for the discussion.
@jo
Copy link
Contributor

jo commented Dec 18, 2018

Thank you @SwampDragons, you really helped me getting started!

I made the pull request, it works for me and fixes our problem. I'd be happy if you could have a look.

@rickard-von-essen
Copy link
Collaborator

rickard-von-essen commented Dec 22, 2018

Fixed in #7130

@puetzk
Copy link
Contributor Author

puetzk commented Dec 22, 2018

as far as I can see #7130 doesn't actually fix #6957 (WaitForVolume looks like it would still go into an endless loop if the volume.Status is "error" due to insufficient size and never reaches "available".

It does provide a workaround (since you could now raise volume_size to avoid the condition that hangs), but there were two issues and only #6956 is directly fixed.

@rickard-von-essen
Copy link
Collaborator

@puetzk thanks for the clarification!

@ghost
Copy link

ghost commented Apr 21, 2021

This issue has been automatically migrated to hashicorp/packer-plugin-openstack#20 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-openstack#20.

@ghost ghost closed this as completed Apr 21, 2021
@ghost
Copy link

ghost commented May 22, 2021

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 as resolved and limited conversation to collaborators May 22, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug builder/openstack community-supported-plugin denotes requests for plugins that are supported by the community, not by HashiCorp engineers good first issue remote-plugin/openstack
Projects
None yet
Development

No branches or pull requests

5 participants