From: Andrew Grimberg Date: Thu, 18 Apr 2019 19:56:34 +0000 (-0700) Subject: Enable selection of instance knobs X-Git-Tag: v0.3.0~2^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=56cfce40ad410514264cc892191df332cbfcfec8;p=releng%2Fcommon-packer.git Enable selection of instance knobs We now operate in multiple Openstack clouds (even if from the same provider) and thus need to properly enable selectability of the region, availability zone, instance flavor size, and if a volume needs to be created (and at what size) for builds. We default to our current standard configuration for Vexxhost Montreal. If vm_use_block_storage is set true then vm_volume_size will be used (along with the image_disk_format option which must be "raw"). If it is false (default) then the volume size and format will be ignored. This is needed for building on flavors that do not predefine any attached disk as is the case for all flavors in the SJC cloud for Vexxhost. Change-Id: I358c414adb49bba9349f30a1190c2f8b90f13d14 Signed-off-by: Andrew Grimberg --- diff --git a/templates/builder.json b/templates/builder.json index 9154d6b..2fce543 100644 --- a/templates/builder.json +++ b/templates/builder.json @@ -5,6 +5,10 @@ "base_image": null, "cloud_network": null, "cloud_user_data": null, + "cloud_region": "ca-ymq-1", + "cloud_availability_zone": "ca-ymq-2", + "vm_use_block_storage": false, + "vm_volume_size": "10", "distro": null, "flavor": "v1-standard-1", "ssh_user": null, @@ -17,8 +21,8 @@ "instance_name": "{{user `distro`}}-builder-{{uuid}}", "source_image_name": "{{user `base_image`}}", "type": "openstack", - "region": "ca-ymq-1", - "availability_zone": "ca-ymq-2", + "region": "{{user `cloud_region`}}", + "availability_zone": "{{user `cloud_availability_zone`}}", "networks": [ "{{user `cloud_network`}}" ], @@ -28,7 +32,10 @@ "flavor": "{{user `flavor`}}", "metadata": { "ci_managed": "yes" - } + }, + "use_blockstorage_volume": "{{user `vm_use_block_storage`}}", + "volume_size": "{{user `vm_volume_size`}}", + "image_disk_format": "raw" } ], "provisioners": [ diff --git a/templates/docker.json b/templates/docker.json index c595162..4be948c 100644 --- a/templates/docker.json +++ b/templates/docker.json @@ -5,6 +5,10 @@ "base_image": null, "cloud_network": null, "cloud_user_data": null, + "cloud_region": "ca-ymq-1", + "cloud_availability_zone": "ca-ymq-2", + "vm_use_block_storage": false, + "vm_volume_size": "10", "distro": null, "flavor": "v1-standard-1", "ssh_user": null, @@ -17,8 +21,8 @@ "instance_name": "{{user `distro`}}-docker-{{uuid}}", "source_image_name": "{{user `base_image`}}", "type": "openstack", - "region": "ca-ymq-1", - "availability_zone": "ca-ymq-2", + "region": "{{user `cloud_region`}}", + "availability_zone": "{{user `cloud_availability_zone`}}", "networks": [ "{{user `cloud_network`}}" ], @@ -29,6 +33,9 @@ "metadata": { "ci_managed": "yes" } + "use_blockstorage_volume": "{{user `vm_use_block_storage`}}", + "volume_size": "{{user `vm_volume_size`}}", + "image_disk_format": "raw" } ], "provisioners": [ diff --git a/templates/windows-builder.json b/templates/windows-builder.json index 49eab6e..7fff46d 100644 --- a/templates/windows-builder.json +++ b/templates/windows-builder.json @@ -5,6 +5,10 @@ "base_image": null, "cloud_network": null, "cloud_user_data": null, + "cloud_region": "ca-ymq-1", + "cloud_availability_zone": "ca-ymq-2", + "vm_use_block_storage": false, + "vm_volume_size": "10", "distro": null, "flavor": "v1-standard-4" }, @@ -15,8 +19,8 @@ "instance_name": "{{user `distro`}}-win-builder-{{uuid}}", "source_image_name": "{{user `base_image`}}", "type": "openstack", - "region": "ca-ymq-1", - "availability_zone": "ca-ymq-2", + "region": "{{user `cloud_region`}}", + "availability_zone": "{{user `cloud_availability_zone`}}", "networks": [ "{{user `cloud_network`}}" ],