Add boot-from-volume support

In some clouds ephemeral storage is much slower than volume storage,
so we want to be able to use volume storage for the performance-
sensitive instances.  This change adds new environments to enable
that and updates build-nodes-json to handle the case where there is
no image associated with an instance.
This commit is contained in:
Ben Nemec 2017-08-17 09:59:38 -05:00
parent 3eea1a0d3a
commit 4d55b7592d
6 changed files with 204 additions and 9 deletions

View File

@ -61,6 +61,15 @@ Base Configuration Options
**Description:** Basic configuration options needed for all OVB environments
Boot Undercloud and Baremetal Instances from Volume
---------------------------------------------------
**File:** environments/boot-from-volume.yaml
**Description:** Boot the undercloud and baremetal instances from Cinder volumes instead of
ephemeral storage.
Create a Private Network
------------------------

View File

@ -0,0 +1,22 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Boot Undercloud and Baremetal Instances from Volume
# description: |
# Boot the undercloud and baremetal instances from Cinder volumes instead of
# ephemeral storage.
parameter_defaults:
# The size of the baremetal instance volumes
# Type: number
baremetal_volume_size: 41
# The size of the volume for the undercloud instance
# Type: number
undercloud_volume_size: 50
resource_registry:
OS::OVB::ServerPair: ../templates/virtual-baremetal-servers-volume.yaml
OS::OVB::UndercloudEnvironment: ../templates/undercloud-volume.yaml

View File

@ -148,16 +148,19 @@ def _build_nodes(nova, glance, bmc_ports, bm_ports, provision_net,
# If a node has uefi firmware ironic needs to be aware of this, in nova
# this is set using a image property called "hw_firmware_type"
if not cache.get(baremetal.image['id']):
cache[baremetal.image['id']] = glance.images.get(baremetal.image['id'])
image = cache.get(baremetal.image['id'])
if image.get('hw_firmware_type') == 'uefi':
node['capabilities'] += ",boot_mode:uefi"
# NOTE(bnemec): Boot from volume does not have an image associated with
# the instance so we can't do this.
if baremetal.image:
if not cache.get(baremetal.image['id']):
cache[baremetal.image['id']] = glance.images.get(baremetal.image['id'])
image = cache.get(baremetal.image['id'])
if image.get('hw_firmware_type') == 'uefi':
node['capabilities'] += ",boot_mode:uefi"
bm_name_end = baremetal.name[len(baremetal_base):]
if '-' in bm_name_end:
profile = bm_name_end[1:].split('_')[0]
node['capabilities'] += ',profile:%s' % profile
bm_name_end = baremetal.name[len(baremetal_base):]
if '-' in bm_name_end:
profile = bm_name_end[1:].split('_')[0]
node['capabilities'] += ',profile:%s' % profile
nodes.append(node)

View File

@ -143,3 +143,19 @@ environments:
- undercloud_floating_ip_id
resource_registry:
OS::OVB::UndercloudFloating: ../templates/undercloud-floating-existing.yaml
-
name: boot-from-volume
title: Boot Undercloud and Baremetal Instances from Volume
description: |
Boot the undercloud and baremetal instances from Cinder volumes instead of
ephemeral storage.
files:
templates/undercloud-volume.yaml:
parameters:
- undercloud_volume_size
templates/virtual-baremetal-servers-volume.yaml:
parameters:
- baremetal_volume_size
resource_registry:
OS::OVB::UndercloudEnvironment: ../templates/undercloud-volume.yaml
OS::OVB::ServerPair: ../templates/virtual-baremetal-servers-volume.yaml

View File

@ -0,0 +1,75 @@
heat_template_version: 2015-04-30
parameters:
undercloud_flavor:
type: string
undercloud_image:
type: string
key_name:
type: string
undercloud_name:
type: string
undercloud_user_data_format:
type: string
undercloud_user_data:
type: string
undercloud_volume_size:
type: number
default: 50
description: The size of the volume for the undercloud instance
private_net:
type: string
provision_net:
type: string
public_net:
type: string
external_net:
type: string
resources:
undercloud_ports:
type: OS::OVB::UndercloudPorts
properties:
undercloud_name: {get_param: undercloud_name}
private_net: {get_param: private_net}
provision_net: {get_param: provision_net}
public_net: {get_param: public_net}
undercloud_volume:
type: OS::Cinder::Volume
properties:
name: {get_param: undercloud_name}
image: {get_param: undercloud_image}
size: {get_param: undercloud_volume_size}
undercloud_server:
type: OS::Nova::Server
depends_on: undercloud_volume
properties:
flavor: {get_param: undercloud_flavor}
key_name: {get_param: key_name}
networks: {get_attr: [undercloud_ports, ports]}
name: {get_param: undercloud_name}
user_data_format: {get_param: undercloud_user_data_format}
user_data: {get_param: undercloud_user_data}
block_device_mapping:
- device_name: vda
volume_id: {get_resource: undercloud_volume}
undercloud_floating_ip:
type: OS::OVB::UndercloudFloating
properties:
external_net: {get_param: external_net}
undercloud_port:
get_attr:
- undercloud_server
- addresses
- {get_param: private_net}
- 0
- port
outputs:
undercloud_host_floating_ip:
description: "floating ip of the undercloud instance"
value:
get_attr: [undercloud_floating_ip, undercloud_host]

View File

@ -0,0 +1,70 @@
heat_template_version: 2014-10-16
parameters:
baremetal_flavor:
type: string
baremetal_image:
type: string
baremetal_volume_size:
type: number
default: 41
description: The size of the baremetal instance volumes
key_name:
type: string
baremetal_prefix:
type: string
provision_net:
type: string
public_net:
type: string
suffix:
type: string
resources:
baremetal_ports:
type: OS::OVB::BaremetalPorts
properties:
suffix: {get_param: suffix}
baremetal_prefix: {get_param: baremetal_prefix}
provision_net: {get_param: provision_net}
public_net: {get_param: public_net}
baremetal_volume:
type: OS::Cinder::Volume
properties:
name:
list_join:
- ''
- - {get_param: baremetal_prefix}
- {get_param: suffix}
image: {get_param: baremetal_image}
size: {get_param: baremetal_volume_size}
baremetal_server:
type: OS::Nova::Server
properties:
flavor: {get_param: baremetal_flavor}
config_drive: false
key_name: {get_param: key_name}
networks: {get_attr: [baremetal_ports, ports]}
block_device_mapping:
- device_name: vda
volume_id: {get_resource: baremetal_volume}
name:
list_join:
- ''
- - {get_param: baremetal_prefix}
- {get_param: suffix}
outputs:
bmc_nic:
value: {port: {get_resource: bmc_port}}