From 6210189b0481abda1d9b55454b7a248863f13994 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Thu, 21 Mar 2019 12:56:31 -0500 Subject: [PATCH] Make BMC optional When using pre-deployed servers, you may want all of the networking setup of OVB but don't actually need to control the instances via IPMI. While this could already be done, it left a useless BMC instance lying around. This change allows the BMC to be disabled completely to clean up such environments. Change-Id: Icd6936977684d178277ebb721a7fbb3ffad51d9a --- doc/source/deploy/environment-index.rst | 10 ++ environments/disable-bmc.yaml | 13 ++ openstack_virtual_baremetal/deploy.py | 4 +- sample-env-generator/environments.yaml | 11 +- templates/bmc-none.yaml | 10 ++ templates/bmc.yaml | 155 ++++++++++++++++++++++++ templates/quintupleo.yaml | 10 -- templates/resource-registry.yaml | 1 + templates/virtual-baremetal.yaml | 132 +------------------- 9 files changed, 206 insertions(+), 140 deletions(-) create mode 100644 environments/disable-bmc.yaml create mode 100644 templates/bmc-none.yaml create mode 100644 templates/bmc.yaml diff --git a/doc/source/deploy/environment-index.rst b/doc/source/deploy/environment-index.rst index f43a8ea..645f7b7 100644 --- a/doc/source/deploy/environment-index.rst +++ b/doc/source/deploy/environment-index.rst @@ -105,6 +105,16 @@ Create a Private Network existing one. +Disable BMC +----------- + +**File:** environments/disable-bmc.yaml + +**Description:** Deploy a stack without a BMC. This will obviously make it impossible to +control the instances via IPMI. It will also prevent use of +ovb-build-nodes-json because there will be no BMC addresses. + + Public Network External Router ------------------------------ diff --git a/environments/disable-bmc.yaml b/environments/disable-bmc.yaml new file mode 100644 index 0000000..d31bcee --- /dev/null +++ b/environments/disable-bmc.yaml @@ -0,0 +1,13 @@ +# ******************************************************************* +# 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: Disable BMC +# description: | +# Deploy a stack without a BMC. This will obviously make it impossible to +# control the instances via IPMI. It will also prevent use of +# ovb-build-nodes-json because there will be no BMC addresses. +resource_registry: + OS::OVB::BMC: ../templates/bmc-none.yaml diff --git a/openstack_virtual_baremetal/deploy.py b/openstack_virtual_baremetal/deploy.py index 91aa69d..1ff8b3c 100755 --- a/openstack_virtual_baremetal/deploy.py +++ b/openstack_virtual_baremetal/deploy.py @@ -219,6 +219,8 @@ def _deploy(stack_name, stack_template, env_paths, poll): all_files = {} all_files.update(template_files) all_files.update(env_files) + # NOTE(bnemec): Unfortunately, we can't pass this in as parameter_default + # because the Heat API doesn't accept parameter_defaults. parameters = {'cloud_data': auth._cloud_json()} hclient.stacks.create(stack_name=stack_name, @@ -303,7 +305,7 @@ def _process_role(role_file, base_envs, stack_name, args): 'overcloud_tenant_net', ] allowed_registry_keys = ['OS::OVB::BaremetalPorts', 'OS::OVB::BMCPort', - 'OS::OVB::UndercloudNetworks', + 'OS::OVB::UndercloudNetworks', 'OS::OVB::BMC', ] # NOTE(bnemec): Not sure what purpose this serves. Can probably be removed. role_env = role_data diff --git a/sample-env-generator/environments.yaml b/sample-env-generator/environments.yaml index 16c07aa..36a53e0 100644 --- a/sample-env-generator/environments.yaml +++ b/sample-env-generator/environments.yaml @@ -185,7 +185,7 @@ environments: the host cloud, but at the cost of potential inconsistency if the state of a baremetal instance is changed without using the BMC. files: - templates/virtual-baremetal.yaml: + templates/bmc.yaml: parameters: - bmc_use_cache sample_values: @@ -254,4 +254,13 @@ environments: traffic through the undercloud. resource_registry: OS::OVB::UndercloudNetworks: ../templates/undercloud-networks-public-router.yaml + - + name: disable-bmc + title: Disable BMC + description: | + Deploy a stack without a BMC. This will obviously make it impossible to + control the instances via IPMI. It will also prevent use of + ovb-build-nodes-json because there will be no BMC addresses. + resource_registry: + OS::OVB::BMC: ../templates/bmc-none.yaml diff --git a/templates/bmc-none.yaml b/templates/bmc-none.yaml new file mode 100644 index 0000000..ff25ca2 --- /dev/null +++ b/templates/bmc-none.yaml @@ -0,0 +1,10 @@ +heat_template_version: newton + +parameters: + cloud_data: + type: string + hidden: true + +resources: + bmc: + type: OS::Heat::None diff --git a/templates/bmc.yaml b/templates/bmc.yaml new file mode 100644 index 0000000..d2bb34f --- /dev/null +++ b/templates/bmc.yaml @@ -0,0 +1,155 @@ +heat_template_version: newton + +parameters: + bmc_flavor: + type: string + default: m1.small + description: The Nova flavor to use for the bmc instance + + bmc_image: + type: string + default: CentOS-7-x86_64-GenericCloud + description: | + The base image for the bmc instance. A CentOS 7 image is currently the + only one supported. + + bmc_use_cache: + type: boolean + default: false + description: | + Enable instance status caching on the BMC. This can reduce load on the + host cloud, but if an instance's status is changed outside the BMC it may + become out of sync. + + key_name: + type: string + default: default + description: Nova keypair to inject into the undercloud and bmc + + private_net: + type: string + default: private + description: Name of a private network which can have floating ips associated with it + + bmc_prefix: + type: string + default: bmc + description: Prefix for the name of the bmc instance + + os_user: + type: string + default: admin + description: | + The user on the host cloud that will be used to provision the + environment + + os_password: + type: string + default: password + hidden: true + description: The password for os_user + + os_tenant: + type: string + default: admin + description: The tenant for os_user + + os_auth_url: + type: string + default: http://127.0.0.1:5000/v2.0 + description: The Keystone auth_url of the host cloud + + os_project: + type: string + default: '' + description: | + The project for os_user. Required for Keystone v3, should be left + blank for Keystone v2. + + os_user_domain: + type: string + default: '' + description: | + The user domain for os_user. Required for Keystone v3, should be left + blank for Keystone v2. + + os_project_domain: + type: string + default: '' + description: | + The project domain for os_user. Required for Keystone v3, should be left + blank for Keystone v2. + + cloud_data: + type: string + hidden: true + + baremetal_prefix: + type: string + default: baremetal + description: Prefix for the name of the baremetal instances + + node_count: + type: number + description: Number of baremetal nodes to deploy + +resources: + bmc_port: + type: OS::OVB::BMCPort + properties: + bmc_prefix: {get_param: bmc_prefix} + private_net: {get_param: private_net} + + bmc_other_ports: + type: OS::Heat::ResourceGroup + properties: + count: {get_param: node_count} + resource_def: + type: OS::Neutron::Port + properties: + name: + list_join: + - '' + - - {get_param: bmc_prefix} + - _%index% + network: {get_param: private_net} + + bmc_handle: + type: OS::Heat::WaitConditionHandle + + bmc_wait_condition: + type: OS::Heat::WaitCondition + properties: + handle: {get_resource: bmc_handle} + timeout: 600 + + bmc_server: + type: OS::Nova::Server + depends_on: [bmc_other_ports, bmc_port] + properties: + flavor: {get_param: bmc_flavor} + image: {get_param: bmc_image} + key_name: {get_param: key_name} + networks: {get_attr: [bmc_port, port]} + name: {get_param: bmc_prefix} + user_data_format: RAW + user_data: + str_replace: + params: + $os_user: {get_param: os_user} + $os_password: {get_param: os_password} + $os_tenant: {get_param: os_tenant} + $os_auth_url: {get_param: os_auth_url} + $os_project: {get_param: os_project} + $os__user_domain: {get_param: os_user_domain} + $os__project_domain: {get_param: os_project_domain} + $bm_node_count: {get_param: node_count} + $bmc_prefix: {get_param: bmc_prefix} + $bmc_utility: {get_attr: [bmc_port, ip_address]} + $bmc_use_cache: {get_param: bmc_use_cache} + $bm_prefix: {get_param: baremetal_prefix} + $private_net: {get_param: private_net} + $openstackbmc_script: {get_file: ../bin/openstackbmc} + $cloud_data: {get_param: cloud_data} + $signal_command: {get_attr: [bmc_handle, curl_cli]} + template: {get_file: ../bin/install_openstackbmc.sh} diff --git a/templates/quintupleo.yaml b/templates/quintupleo.yaml index 340d8ad..01d869f 100644 --- a/templates/quintupleo.yaml +++ b/templates/quintupleo.yaml @@ -183,17 +183,7 @@ resources: node_count: {get_param: node_count} private_net: {get_attr: [private_network, private_net]} networks: {get_attr: [undercloud_networks, networks]} - bmc_flavor: {get_param: bmc_flavor} - bmc_prefix: {get_param: bmc_prefix} - bmc_image: {get_param: bmc_image} baremetal_prefix: {get_param: baremetal_prefix} - os_user: {get_param: os_user} - os_password: {get_param: os_password} - os_tenant: {get_param: os_tenant} - os_auth_url: {get_param: os_auth_url} - os_project: {get_param: os_project} - os_user_domain: {get_param: os_user_domain} - os_project_domain: {get_param: os_project_domain} cloud_data: {get_param: cloud_data} dhcp_ips: {get_param: dhcp_ips} diff --git a/templates/resource-registry.yaml b/templates/resource-registry.yaml index 021acc5..08e8dc0 100644 --- a/templates/resource-registry.yaml +++ b/templates/resource-registry.yaml @@ -6,6 +6,7 @@ resource_registry: OS::OVB::PrivateNetwork: private-net-existing.yaml OS::OVB::BaremetalNetworks: baremetal-networks-none.yaml OS::OVB::BaremetalPorts: baremetal-ports-default.yaml + OS::OVB::BMC: bmc.yaml OS::OVB::BMCPort: bmc-port.yaml OS::OVB::UndercloudPorts: undercloud-ports.yaml OS::OVB::UndercloudNetworks: undercloud-networks.yaml diff --git a/templates/virtual-baremetal.yaml b/templates/virtual-baremetal.yaml index 1b3ae16..36f112b 100644 --- a/templates/virtual-baremetal.yaml +++ b/templates/virtual-baremetal.yaml @@ -5,26 +5,6 @@ description: Template for deploying OpenStack BMC nodes. Can be wrapped in a Re # Ensure force_config_drive is _not_ set in nova.conf parameters: - bmc_flavor: - type: string - default: m1.small - description: The Nova flavor to use for the bmc instance - - bmc_image: - type: string - default: CentOS-7-x86_64-GenericCloud - description: | - The base image for the bmc instance. A CentOS 7 image is currently the - only one supported. - - bmc_use_cache: - type: boolean - default: false - description: | - Enable instance status caching on the BMC. This can reduce load on the - host cloud, but if an instance's status is changed outside the BMC it may - become out of sync. - baremetal_flavor: type: string default: baremetal @@ -55,11 +35,6 @@ parameters: default: {"private": "private", "provision": "provision"} description: A map of networks to their names. - bmc_prefix: - type: string - default: bmc - description: Prefix for the name of the bmc instance - baremetal_prefix: type: string default: baremetal @@ -73,53 +48,8 @@ parameters: The value should usually include '%index%' to differentiate multiple instances. For example: 'my-custom-name-%index%' - os_user: - type: string - default: admin - description: | - The user on the host cloud that will be used to provision the - environment - - os_password: - type: string - default: password - hidden: true - description: The password for os_user - - os_tenant: - type: string - default: admin - description: The tenant for os_user - - os_auth_url: - type: string - default: http://127.0.0.1:5000/v2.0 - description: The Keystone auth_url of the host cloud - - os_project: - type: string - default: '' - description: | - The project for os_user. Required for Keystone v3, should be left - blank for Keystone v2. - - os_user_domain: - type: string - default: '' - description: | - The user domain for os_user. Required for Keystone v3, should be left - blank for Keystone v2. - - os_project_domain: - type: string - default: '' - description: | - The project domain for os_user. Required for Keystone v3, should be left - blank for Keystone v2. - cloud_data: type: string - default: '{}' hidden: true dhcp_ips: @@ -159,65 +89,11 @@ conditions: - '' resources: - bmc_port: - type: OS::OVB::BMCPort + bmc: + type: OS::OVB::BMC + depends_on: openstack_baremetal_servers properties: - bmc_prefix: {get_param: bmc_prefix} - private_net: {get_param: private_net} - - bmc_other_ports: - type: OS::Heat::ResourceGroup - properties: - count: {get_param: node_count} - resource_def: - type: OS::Neutron::Port - properties: - name: - list_join: - - '' - - - {get_param: bmc_prefix} - - _%index% - network: {get_param: private_net} - - bmc_handle: - type: OS::Heat::WaitConditionHandle - - bmc_wait_condition: - type: OS::Heat::WaitCondition - properties: - handle: {get_resource: bmc_handle} - timeout: 600 - - bmc_server: - type: OS::Nova::Server - depends_on: [openstack_baremetal_servers, bmc_other_ports, bmc_port] - properties: - flavor: {get_param: bmc_flavor} - image: {get_param: bmc_image} - key_name: {get_param: key_name} - networks: {get_attr: [bmc_port, port]} - name: {get_param: bmc_prefix} - user_data_format: RAW - user_data: - str_replace: - params: - $os_user: {get_param: os_user} - $os_password: {get_param: os_password} - $os_tenant: {get_param: os_tenant} - $os_auth_url: {get_param: os_auth_url} - $os_project: {get_param: os_project} - $os__user_domain: {get_param: os_user_domain} - $os__project_domain: {get_param: os_project_domain} - $bm_node_count: {get_param: node_count} - $bmc_prefix: {get_param: bmc_prefix} - $bmc_utility: {get_attr: [bmc_port, ip_address]} - $bmc_use_cache: {get_param: bmc_use_cache} - $bm_prefix: {get_param: baremetal_prefix} - $private_net: {get_param: private_net} - $openstackbmc_script: {get_file: ../bin/openstackbmc} - $cloud_data: {get_param: cloud_data} - $signal_command: {get_attr: [bmc_handle, curl_cli]} - template: {get_file: ../bin/install_openstackbmc.sh} + cloud_data: {get_param: cloud_data} baremetal_networks: type: OS::OVB::BaremetalNetworks