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_compute_instance_v2 block_device - boot from volume #3206

Closed
lesaux opened this issue Sep 10, 2015 · 8 comments · Fixed by #3232
Closed

openstack_compute_instance_v2 block_device - boot from volume #3206

lesaux opened this issue Sep 10, 2015 · 8 comments · Fixed by #3232

Comments

@lesaux
Copy link

lesaux commented Sep 10, 2015

Hello, I am not understanding how this works and would like some clarifications. (I am using my private openstack cluster "Juno" and not rackspace or similar). Basically I would like to use a volume as a rootfs in an instance.

First, it seems to me that if I was to specify a block_device block in my instance resource, the image_id or image_name should not be required.

From the source_type and destination_type parameters, I am understanding that this should create a volume, but it is not the case.

  block_device {
    uuid = "${var.image_id}"
    source_type = "snapshot"
    volume_size = 8
    boot_index = 0
    destination_type = "volume"
  }

It seems that the block_device stanza never does anything.

Below is the instance information for an instance created with the "boot from image (creates new volume)" option in the horizon interface. Notice how the image parameter is "Attempt to boot from volume - no image supplied", and there is effectively one volume attached, which was used to boot the instance.

+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | AUTO                                                     |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | node-69.domain.tld                                       |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | node-69.domain.tld                                       |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000048                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2015-09-10T15:01:10.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2015-09-10T14:58:14Z                                     |
| flavor                               | t2.small (b9b9cd94-4cfd-41e9-8863-b9ffeab7c9d4)          |
| hostId                               | e64e13e2745fe1bad894eda65b245378b9c6a3f1f8364b8cbe54201f |
| id                                   | 0edf517b-5ada-4242-b933-5e18fda0cfdb                     |
| image                                | Attempt to boot from volume - no image supplied          |
| key_name                             | test                                                     |
| metadata                             | {}                                                       |
| name                                 | test                                                     |
| net04 network                        | 192.168.111.17                                           |
| os-extended-volumes:volumes_attached | [{"id": "d3949ea6-33c4-42f0-b8fa-26e829949606"}]         |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tenant_id                            | c7ca4adfa34342519ba20424d7b18ce3                         |
| updated                              | 2015-09-10T15:01:11Z                                     |
| user_id                              | ba276e7f36f34d2b8830f0e97fd71e93                         |
+--------------------------------------+----------------------------------------------------------+
@jtopjian
Copy link
Contributor

@lesaux Nice catch. You were absolutely right that the block_device stanza wasn't doing anything. I've fixed this in #3225. If you're able to, try compiling Terraform from source with the patch and see if everything now works on your end. If you're unable to, I'm pretty confident it's fixed since everything checks out in a Devstack environment.

Regarding the requirement to still have to specify an Image ID even though you're already specifying it in the block_device section: I agree that this should be removed. However, I don't want to pile on too many changes at once. How about we confirm block_device now works and then I'd be happy to make the Image ID changes?

@jtopjian
Copy link
Contributor

Also, the other reason to hold off on making changes to the Image parts is because I have #3202 in queue. The required changes will conflict with that PR.

Unless I'm mistaken, specifying the image name/id, even though you're booting from a volume, won't cause any issues?

@jtopjian
Copy link
Contributor

I began writing a fix for the part about having to specify an image and ran into a bug with Gophercloud: rackspace/gophercloud#481

I'll continue once that's resolved.

@lesaux
Copy link
Author

lesaux commented Sep 13, 2015

@jtopjian Thanks a lot for this work. I will try #3225 shortly and give you my results.
Having to specify the image_id outside of the block_device is really not a problem - It's just that it confused me as I was trying to understand how the block_device part worked.

I think I found another issue with the attached volumes. It seems they're attached in a random order (I guess depending on how quick the api responds for the volume creation request) which makes it hard to track the device name they will use. I wasn't able to find a way to use the attachement attribute yet. I will investigate this one further before creating a separate issue though.

Thanks again!

@jtopjian
Copy link
Contributor

@lesaux It's most likely Terraform that's causing the random ordering. If you could, open a new issue with any example output or configuration.

@jfchevrette
Copy link

+1 I'm stuck on the same issue where I need to specify an image name or id even though I am booting from volume

@ghost
Copy link

ghost commented Oct 20, 2015

+1 Thanks for fixing this :) i'm going to try to deploy Terraform from source :)

bmcustodio pushed a commit to bmcustodio/terraform that referenced this issue Sep 26, 2017
@ghost
Copy link

ghost commented Apr 30, 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 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants