From 4f284c6776f56e1a76b0fce350e83d37d98d9ca8 Mon Sep 17 00:00:00 2001 From: Bohdan Dobrelia Date: Thu, 8 Feb 2024 13:53:56 +0100 Subject: [PATCH] Ceph: workloads adoption with cinder volume Enable back the cinder volume commands on the source cloud, and resume testing of the ceph-backed volume attached to the test VM. Extend volume/backup/snapshot/attachment commands to wait for the previous step results. Follow the EDPM Post Ceph steps of HCI VA to prepare adopted workloads for using Ceph backend on EDPM. Add Nova discover host command (step 5 of the HCI VA). Add Nova Ceph custom configs to properly configure ceph vms pool for libvirt. Combine nova-ceph related configurations and nova FFU related ones into a single nova-compute-extraconfig service (by design, having two dataplane services for Nova in the same node set is not supported). Note about available choises for libvirt storage backends for Nova Add nova_libvirt_backend to control either to deploy with the local or ceph storage EDPM backends Signed-off-by: Bohdan Dobrelia --- .../assemblies/development_environment.adoc | 26 ++--- .../modules/openstack-dataplane_adoption.adoc | 106 +++++++++++++++++- tests/playbooks/test_rollback_with_ceph.yaml | 1 + tests/playbooks/test_with_ceph.yaml | 1 + tests/playbooks/test_with_ironic.yaml | 1 + .../dataplane_adoption/defaults/main.yaml | 2 + .../roles/dataplane_adoption/tasks/main.yaml | 100 ++++++++++++++++- .../dataplane_adoption/tasks/nova_ffu.yaml | 8 +- .../files/pre_launch.bash | 45 ++++++-- .../development_environment/tasks/main.yaml | 1 + tests/roles/nova_adoption/defaults/main.yaml | 2 + 11 files changed, 260 insertions(+), 33 deletions(-) diff --git a/docs_dev/assemblies/development_environment.adoc b/docs_dev/assemblies/development_environment.adoc index 9a3180fee..735211797 100644 --- a/docs_dev/assemblies/development_environment.adoc +++ b/docs_dev/assemblies/development_environment.adoc @@ -108,6 +108,7 @@ export EDPM_COMPUTE_ADDITIONAL_NETWORKS=$(jq -c . /tmp/addtional_nets.json) export STANDALONE_COMPUTE_DRIVER=ironic export NTP_SERVER=pool.ntp.org # Only necessary if not on the RedHat network ... export EDPM_COMPUTE_CEPH_ENABLED=false # Optional +export EDPM_COMPUTE_CEPH_NOVA=false # Optional export EDPM_COMPUTE_SRIOV_ENABLED=false # Without this the standalone deploy fails when compute driver is ironic. ---- @@ -115,6 +116,8 @@ export EDPM_COMPUTE_SRIOV_ENABLED=false # Without this the standalone deploy fai === If `EDPM_COMPUTE_CEPH_ENABLED=false` is set, TripleO configures `Glance` with `Swift` as a backend. +If `EDPM_COMPUTE_CEPH_NOVA=false` is set, TripleO configures `Nova/Libvirt` with +a local storage backend. === ''' @@ -293,19 +296,20 @@ ping -c 4 $(openstack server show baremetal-test -f json -c addresses | jq -r .a ==== Virtual Machine Steps +Create a test VM instance with a test volume attachement: + [,bash] ---- cd ~/data-plane-adoption bash tests/roles/development_environment/files/pre_launch.bash ---- +This also creates a test Cinder volume, a backup from it, and a snapshot of it. + ''' ==== Ceph Storage Steps -Make sure a cinder-volume backend is properly configured, or skip below steps -to create a test workload without volume attachments. - Confirm the image UUID can be seen in Ceph's images pool. [,bash] @@ -318,22 +322,6 @@ Create a Barbican secret openstack secret store --name testSecret --payload 'TestPayload' ``` -Create a Cinder volume, a backup from it, and snapshot it. - -[,bash] ----- -openstack volume create --image cirros --bootable --size 1 disk -openstack volume backup create --name backup disk -openstack volume snapshot create --volume disk snapshot ----- - -Add volume to the test VM - -[,bash] ----- -openstack server add volume test disk ----- - == Performing the Data Plane Adoption The development environment is now set up, you can go to the https://openstack-k8s-operators.github.io/data-plane-adoption/[Adoption diff --git a/docs_user/modules/openstack-dataplane_adoption.adoc b/docs_user/modules/openstack-dataplane_adoption.adoc index 63858afcf..a41f07ec0 100644 --- a/docs_user/modules/openstack-dataplane_adoption.adoc +++ b/docs_user/modules/openstack-dataplane_adoption.adoc @@ -10,6 +10,7 @@ * Previous Adoption steps completed. * Remaining source cloud xref:stopping-infrastructure-management-and-compute-services_{context}[Stopping infrastructure management and Compute services] on Compute hosts. +* Ceph backend for Nova/Libvirt is configured xref:configuring-a-ceph-backend_{context}[Configuring a Ceph backend]. ____ *WARNING* This step is a "point of no return" in the data plane adoption @@ -27,6 +28,7 @@ The values are just illustrative, use values that are correct for your environme ---- PODIFIED_DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d) +CEPH_FSID=$(oc get secret ceph-conf-files -o json | jq -r '.data."ceph.conf"' | base64 -d | grep fsid | sed -e 's/fsid = //' alias openstack="oc exec -t openstackclient -- openstack" FIP=192.168.122.20 @@ -178,7 +180,7 @@ rm -f id* cd - ---- -* Create a Nova Compute Extra Config service +* Create a Nova Compute Extra Config service (no ceph backend in use) + [source,yaml] ---- @@ -213,6 +215,61 @@ The secret `nova-cell-compute-config` is auto-generated for each `cell`. That secret, alongside `nova-migration-ssh-key`, should always be specified for each custom `OpenStackDataPlaneService` related to Nova. +That service removes pre-FFU workarounds and configures Nova compute +services for local storage backend. + +* Create a Nova Compute Extra Config service (with ceph backend) ++ +[source,yaml] +---- +oc apply -f - <antelope FFU +- name: run Nova DB online migrations to complete FFU ansible.builtin.shell: | {{ shell_header }} {{ oc_header }} @@ -124,3 +124,9 @@ until: nova_exec_result is success retries: 10 delay: 6 + +- name: ask Nova to discover all compute hosts + ansible.builtin.shell: | + {{ shell_header }} + {{ oc_header }} + oc rsh nova-cell0-conductor-0 nova-manage cell_v2 discover_hosts --verbose diff --git a/tests/roles/development_environment/files/pre_launch.bash b/tests/roles/development_environment/files/pre_launch.bash index a605f4691..9b82e95ef 100644 --- a/tests/roles/development_environment/files/pre_launch.bash +++ b/tests/roles/development_environment/files/pre_launch.bash @@ -1,5 +1,20 @@ set -e +function wait_for_status() { + local time=0 + local msg="Waiting for $2" + local status="${3:-available}" + local result + while [ $time -le 30 ] ; do + result=$(${BASH_ALIASES[openstack]} $1 -f json) + echo $result | jq -r ".status" | grep -q $status && break + echo "result=$result" + echo "$msg" + time=$(( time + 5 )) + sleep 5 + done +} + # Create Image IMG=cirros-0.5.2-x86_64-disk.img URL=http://download.cirros-cloud.net/0.5.2/$IMG @@ -50,15 +65,23 @@ export FIP=192.168.122.20 # check connectivity via FIP ping -c4 ${FIP} -# FIXME: Invalid volume: Volume xxx status must be available, but current status is: backing-up -# Create a Cinder volume, a backup from it, and snapshot it. -#${BASH_ALIASES[openstack]} volume show disk || \ -# ${BASH_ALIASES[openstack]} volume create --image cirros --bootable --size 1 disk -#${BASH_ALIASES[openstack]} volume backup show backup || \ -# ${BASH_ALIASES[openstack]} volume backup create --name backup disk -#${BASH_ALIASES[openstack]} volume snapshot show snapshot || \ -# ${BASH_ALIASES[openstack]} volume snapshot create --volume disk snapshot +if ! ${BASH_ALIASES[openstack]} volume show disk ; then + ${BASH_ALIASES[openstack]} volume create --image cirros --bootable --size 1 disk + wait_for_status "volume show disk" "test volume 'disk' creation" +fi + +if ! ${BASH_ALIASES[openstack]} volume backup show backup; then + ${BASH_ALIASES[openstack]} volume backup create --name backup disk + wait_for_status "volume backup show backup" "test volume 'disk' backup completion" +fi + +if ! ${BASH_ALIASES[openstack]} volume snapshot show snapshot ; then + ${BASH_ALIASES[openstack]} volume snapshot create --volume disk snapshot + wait_for_status "volume snapshot show snapshot" "test volume 'disk' backup snapshot availability" +fi + +# Add volume to the test VM +if ${BASH_ALIASES[openstack]} volume show disk -f json | jq -r '.status' | grep -q available ; then + ${BASH_ALIASES[openstack]} server add volume test disk +fi -# TODO: Add volume to the test VM, after tripleo wallaby (osp 17) isolnet network adoption implemented for storage networks -#${BASH_ALIASES[openstack]} volume show disk -f json | jq -r '.status' | grep -q available && \ -# ${BASH_ALIASES[openstack]} server add volume test disk diff --git a/tests/roles/development_environment/tasks/main.yaml b/tests/roles/development_environment/tasks/main.yaml index b226c218c..4b2f47a8a 100644 --- a/tests/roles/development_environment/tasks/main.yaml +++ b/tests/roles/development_environment/tasks/main.yaml @@ -6,5 +6,6 @@ EDPM_PRIVATEKEY_PATH: "{{ edpm_privatekey_path }}" ansible.builtin.shell: cmd: | + {{ shell_header }} alias openstack="ssh -i {{ edpm_privatekey_path }} root@{{ edpm_node_ip }} OS_CLOUD=standalone openstack" {{ lookup('ansible.builtin.file', prelaunch_test_instance_script) }} diff --git a/tests/roles/nova_adoption/defaults/main.yaml b/tests/roles/nova_adoption/defaults/main.yaml index 4f5d459c7..0206c677f 100644 --- a/tests/roles/nova_adoption/defaults/main.yaml +++ b/tests/roles/nova_adoption/defaults/main.yaml @@ -1 +1,3 @@ ironic_adoption: false +# Libvirt backends: ceph or local +nova_libvirt_backend: local