From 5b62504672b9c42ba2f0f8df32ba1b48591aff0a Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 18 Jun 2019 13:56:26 +0200 Subject: [PATCH] Deprecate the Nginx data store This feature is no longer needed since ironic-inspector supports storing data in the database, which is a better supported approach. This patch does not provide any migration and expects the operators to do it using the ironic-inspector tooling. Change-Id: I6f18b3a64d6df9354c3f04a588240f9ae3228d7c --- .../roles/bifrost-ironic-install/README.md | 4 +- .../bifrost-ironic-install/defaults/main.yml | 4 +- .../templates/ironic-inspector.conf.j2 | 2 + .../bifrost-test-inspection/defaults/main.yml | 10 ----- .../bifrost-test-inspection/tasks/main.yml | 38 +++++++++---------- .../notes/store-data-a14351976eda9842.yaml | 13 +++++++ 6 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 releasenotes/notes/store-data-a14351976eda9842.yaml diff --git a/playbooks/roles/bifrost-ironic-install/README.md b/playbooks/roles/bifrost-ironic-install/README.md index 9075a9086..af6c4bd18 100644 --- a/playbooks/roles/bifrost-ironic-install/README.md +++ b/playbooks/roles/bifrost-ironic-install/README.md @@ -224,13 +224,15 @@ inspector_processing_hooks: String value containing a comma-separated list, non-default list of comma-separated processing hooks for inspector. -inspector_store_data_in_nginx: Boolean value, default true. If true, this +inspector_store_data_in_nginx: Boolean value, default false. If true, this enables data gathered during introspection to be stored in the local Nginx web server. In this mode, Nginx masquerades as an unauthenticated 'Swift' object storage service. Nginx is configured to only allow the required operations on the 'ironic-inspector' object container. + DEPRECATED: introspection data is stored in the + database by default. ### Virtual Environment Install diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index fd4426c1d..d3e414a2d 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -194,8 +194,8 @@ inspector_keep_ports: "present" #inspector_processing_hooks: # Whether to store introspection data using the local Nginx web server as an -# object storage service. -inspector_store_data_in_nginx: true +# object storage service. DEPRECATED, the data can be stored in the database. +inspector_store_data_in_nginx: false # When inspector_store_data_in_nginx is true, this is the URL of the Nginx # 'Swift' API endpoint. diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 index ee61425ed..934a966bc 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 @@ -72,6 +72,8 @@ processing_hooks = {{ inspector_processing_hooks }} {% endif %} {% if inspector_store_data_in_nginx | bool %} store_data = swift +{% else %} +store_data = database {% endif %} {% if inspector.discovery.enabled == true %} node_not_found_hook = enroll diff --git a/playbooks/roles/bifrost-test-inspection/defaults/main.yml b/playbooks/roles/bifrost-test-inspection/defaults/main.yml index d2ab55ace..091a04945 100644 --- a/playbooks/roles/bifrost-test-inspection/defaults/main.yml +++ b/playbooks/roles/bifrost-test-inspection/defaults/main.yml @@ -1,12 +1,2 @@ --- # defaults file for bifrost-test-inspection - -file_url_port: "8080" - -# Whether to store introspection data using the local Nginx web server as an -# object storage service. -inspector_store_data_in_nginx: true - -# When inspector_store_data_in_nginx is true, this is the URL of the Nginx -# 'Swift' API endpoint. -inspector_store_data_url: "http://localhost:{{ file_url_port }}" diff --git a/playbooks/roles/bifrost-test-inspection/tasks/main.yml b/playbooks/roles/bifrost-test-inspection/tasks/main.yml index 603fec9d9..c58f38641 100644 --- a/playbooks/roles/bifrost-test-inspection/tasks/main.yml +++ b/playbooks/roles/bifrost-test-inspection/tasks/main.yml @@ -12,24 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -- block: - - name: Check node hardware inspection data - command: "openstack baremetal introspection data save {{ uuid }}" - register: inspection_data - environment: - OS_CLOUD: "{% if enable_keystone | default(false) | bool %}bifrost{% else %}bifrost-inspector{% endif %}" +- name: Check node hardware inspection data + command: "openstack baremetal introspection data save {{ uuid }}" + register: inspection_data + environment: + OS_CLOUD: "{% if enable_keystone | default(false) | bool %}bifrost{% else %}bifrost-inspector{% endif %}" - # TODO(mgoddard): More validation of data format and contents. - - name: Validate the inspection data format - assert: - that: - - "'inventory' in data" - - "'memory' in inventory" - - "'cpu' in inventory" - - "'bmc_address' in inventory" - - "'interfaces' in inventory" - - "'disks' in inventory" - vars: - data: "{{ inspection_data.stdout | from_json }}" - inventory: "{{ data.inventory }}" - when: inspector_store_data_in_nginx | bool +# TODO(mgoddard): More validation of data format and contents. +- name: Validate the inspection data format + assert: + that: + - "'inventory' in data" + - "'memory' in inventory" + - "'cpu' in inventory" + - "'bmc_address' in inventory" + - "'interfaces' in inventory" + - "'disks' in inventory" + vars: + data: "{{ inspection_data.stdout | from_json }}" + inventory: "{{ data.inventory }}" diff --git a/releasenotes/notes/store-data-a14351976eda9842.yaml b/releasenotes/notes/store-data-a14351976eda9842.yaml new file mode 100644 index 000000000..03bbefdc3 --- /dev/null +++ b/releasenotes/notes/store-data-a14351976eda9842.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + When inspection support is enabled, introspection data is now stored in + the database by default. You can use the ``ironic-inspector-migrate-data`` + command to move the data from nginx to the database, for example:: + + ironic-inspector-migrate-data --from swift --to database --config-file /etc/ironic-inspector/inspector.conf +deprecations: + - | + The ``inspector_store_data_in_nginx`` configuration option is deprecated + and will be removed in a future release. Introspection data can now be + stored in the database.