[openstack provider] bootable volume - selecting type

803 views
Skip to first unread message

Sean Boran

unread,
Apr 24, 2017, 5:15:12 AM4/24/17
to Terraform
Hi,

The boot device can be made to be a volume as follows

resource "openstack_compute_instance_v2" "myvm" {
..
block_device {
    uuid                  = "${lookup(var.image, var.region)}"
    source_type           = "image"
    volume_size           = 8
    boot_index            = 0
    destination_type      = "volume" 
    delete_on_termination = true
  }

However, how does one specify the volume_type (i..e on what storage it be for), or add a description to the volume?

So, tried to create a volume first and then link it in:
resource "openstack_blockstorage_volume_v2" "terravol" {
  name = "${var.vmname}"
  volume_type = "type1"
  size = 8
}
resource "openstack_compute_instance_v2" "terravm" {
...
image_id     = "${lookup(var.image, var.region)}"
 block_device {
    source_type = "volume"
    boot_index = 0
    volume_size = "${openstack_blockstorage_volume_v2.terravol.size}"
    destination_type = "volume"
    delete_on_termination = true
  } 
 
This creates the volume but give "Invalid request due to incorrect syntax or missing required parameters".
Any suggestions on how to achieve this please? 



Joe Topjian

unread,
Apr 24, 2017, 11:23:48 AM4/24/17
to terrafo...@googlegroups.com
Hello,

That's the correct way of specifying a volume type, but looks like you're running into an error of some sort. You might be able to get a better error message by doing the following:

$ OS_DEBUG=1 TF_LOG=DEBUG terraform apply

Depending on the error, it might be a bug in OpenStack provider or it might also be an issue in the OpenStack environment itself.

Thanks,
Joe

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/a4641f9f-577f-4589-a91f-a88128ea53c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sean Boran

unread,
Apr 25, 2017, 5:22:07 AM4/25/17
to Terraform
Hi,

The debugging options help indeed, an extract is below.
It says "Block Device 77c28c69-731f-4ff4-a80b-303f33eb9ab4 is not bootable.", but there is no option in openstack_blockstorage_volume_v2 or block_device for making it bootable?

- snip--
module.ino.openstack_blockstorage_volume_v2.terravol: Still creating... (10s elapsed)
2017/04/25 09:45:20 [DEBUG] plugin: terraform: openstack-provider (internal) 2017/04/25 09:45:20 [DEBUG] OpenStack Request URL: GET https://idcstackbeta2.foo.net:8776/v2/6ead84b6445b41d49b7f9ba828bc9b7f/volumes/77c28c69-731f-4ff4-a80b-303f33eb9ab4
2017/04/25 09:45:20 [DEBUG] plugin: terraform: openstack-provider (internal) 2017/04/25 09:45:20 [DEBUG] OpenStack Response Body: {
2017/04/25 09:45:20 [DEBUG] plugin: terraform:   "volume": {
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "attachments": [],
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "availability_zone": "nova",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "bootable": "false",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "consistencygroup_id": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "created_at": "2017-04-25T07:45:08.000000",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "description": "Bootable (ScaleIO) volume",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "encrypted": false,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "id": "77c28c69-731f-4ff4-a80b-303f33eb9ab4",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "links": [
2017/04/25 09:45:20 [DEBUG] plugin: terraform:       {
2017/04/25 09:45:20 [DEBUG] plugin: terraform:         "rel": "self"
2017/04/25 09:45:20 [DEBUG] plugin: terraform:       },
2017/04/25 09:45:20 [DEBUG] plugin: terraform:       {
2017/04/25 09:45:20 [DEBUG] plugin: terraform:         "rel": "bookmark"
2017/04/25 09:45:20 [DEBUG] plugin: terraform:       }
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     ],
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "metadata": {},
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "migration_status": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "multiattach": false,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "name": "terratest-Sean",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "os-vol-host-attr:host": "node-64.foo.ch@scaleio#pdo:pool-10k",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "os-vol-mig-status-attr:migstat": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "os-vol-mig-status-attr:name_id": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "os-vol-tenant-attr:tenant_id": "6ead84b6445b41d49b7f9ba828bc9b7f",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "replication_status": "disabled",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "size": 8,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "snapshot_id": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "source_volid": null,
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "status": "available",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "updated_at": "2017-04-25T07:45:09.000000",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "user_id": "5dfcdcd8db6faa1faeb8075fb9a98dd8054861415bfa6c2e00d9a793a313bf28",
2017/04/25 09:45:20 [DEBUG] plugin: terraform:     "volume_type": "ScaleIO-10k"
2017/04/25 09:45:20 [DEBUG] plugin: terraform:   }
2017/04/25 09:45:20 [DEBUG] plugin: terraform: }

[DEBUG] plugin: terraform: openstack-provider (internal) 2017/04/25 09:45:20 [DEBUG] Retrieved volume 77c28c69-731f-4ff4-a80b-303f33eb9ab4: &{ID:77c28c69-731f-4ff4-a80b-303f33eb9ab4 Status:available Size:8 AvailabilityZone:nova CreatedAt:2017-04-25 07:45:08 +0000 UTC UpdatedAt:2017-04-25 07:45:09 +0000 UTC Attachments:[] Name:terratest-Sean Description:Bootable (ScaleIO) volume VolumeType:ScaleIO-10k SnapshotID: SourceVolID: Metadata:map[] UserID:5dfcdcd8db6faa1faeb8075fb9a98dd8054861415bfa6c2e00d9a793a313bf28 Bootable:false Encrypted:false ReplicationStatus:disabled ConsistencyGroupID: Multiattach:false}

...
2017/04/25 09:45:22 [DEBUG] plugin: terraform: openstack-provider (internal) 2017/04/25 09:45:22 [DEBUG] OpenStack Response Body: {
2017/04/25 09:45:22 [DEBUG] plugin: terraform:   "badRequest": {
2017/04/25 09:45:22 [DEBUG] plugin: terraform:     "code": 400,
2017/04/25 09:45:22 [DEBUG] plugin: terraform:     "message": "Block Device 77c28c69-731f-4ff4-a80b-303f33eb9ab4 is not bootable."
2017/04/25 09:45:22 [DEBUG] plugin: terraform:   }
2017/04/25 09:45:22 [DEBUG] plugin: terraform: }
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalWriteState
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalApplyProvisioners
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalIf
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalWriteState
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalWriteDiff
2017/04/25 09:45:22 [DEBUG] root.ino: eval: *terraform.EvalApplyPost
2017/04/25 09:45:22 [ERROR] root.ino: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* openstack_compute_instance_v2.terravm: Error creating OpenStack server: Invalid request due to incorrect syntax or missing required parameters.
-- snip--

Sean

To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.

Joe Topjian

unread,
Apr 25, 2017, 10:48:27 AM4/25/17
to terrafo...@googlegroups.com
Hello,

OpenStack should automatically make the volume bootable when it's used as the first block device in an instance. Off the top of my head, is there a chance that the volume type you're trying to use doesn't support boot-from-volume? Are you able to use it as a bootable volume outside of Terraform? 

If you can, then this is a bug of some sort (possibly with Terraform or the volume driver being used in your environment). Could you open an issue on Github when you have a chance and ping me (@jtopjian) so we can discuss more?

Thanks,
Joe

To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/a4317a3e-9aa1-4b98-b12d-6377ff784ed7%40googlegroups.com.

Joe Topjian

unread,
Apr 25, 2017, 10:59:32 AM4/25/17
to terrafo...@googlegroups.com
Ah, one thing I just noticed: Can you try setting an image_id in the volume resource? That should trigger the volume to be bootable. 

There's a more complete example of creating a bootable volume this way here:


Let me know if you're still having problems, though :)
Joe

Sean Boran

unread,
Apr 27, 2017, 1:13:25 PM4/27/17
to Terraform
Hi,

Yes, you are right. By adding "image_id in the volume resource", it was possible to create the volume with a specific name and for example set metadata.

Thanks,

Sean
Reply all
Reply to author
Forward
0 new messages