:_mod-docs-content-type: PROCEDURE
[id="performing-a-fast-forward-upgrade-on-compute-services_{context}"]

= Performing a fast-forward upgrade on Compute services

[role="_abstract"]
You must upgrade the Compute services from {rhos_prev_long} {rhos_prev_ver} to {rhos_long} {rhos_curr_ver} on the control plane and data plane by completing the following tasks:

* Update the cell1 Compute data plane services version.
* Remove pre-fast-forward upgrade workarounds from the Compute control plane services and Compute data plane services.
* Run Compute database online migrations to update live data.

.Prerequisites

* Define the shell variables necessary to apply the fast-forward upgrade commands for each {compute_service} cell.

+
----
DEFAULT_CELL_NAME="cell1"
RENAMED_CELLS="$DEFAULT_CELL_NAME"

declare -A PODIFIED_DB_ROOT_PASSWORD
for CELL in $(echo "super $RENAMED_CELLS"); do
  PODIFIED_DB_ROOT_PASSWORD[$CELL]=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
done
----

* Complete the steps in xref:adopting-compute-services-to-the-data-plane_data-plane[Adopting Compute services to the {rhos_acro} data plane].

.Procedure

. Wait for the {compute_service} data plane services version to update for all the cells:
+
----
$ for CELL in $(echo $RENAMED_CELLS); do
$ oc exec openstack-$CELL-galera-0 -c galera -- mysql -rs -uroot -p"${PODIFIED_DB_ROOT_PASSWORD[$CELL]}" \
    -e "select a.version from nova_${CELL}.services a join nova_${CELL}.services b where a.version!=b.version and a.binary='nova-compute' and a.deleted=0;"
done
----
+
[NOTE]
====
The query returns an empty result when the update is completed. No downtime is expected for virtual machine workloads.

Review any errors in the nova Compute agent logs on the data plane, and the `nova-conductor` journal records on the control plane.
====

. Patch the `OpenStackControlPlane` CR to remove the pre-fast-forward upgrade workarounds from the Compute control plane services:
+
----
$ rm -f celltemplates
$ for CELL in $(echo $RENAMED_CELLS); do
$ cat >> celltemplates << EOF
        ${CELL}:
          metadataServiceTemplate:
            customServiceConfig: |
              [workarounds]
              disable_compute_service_check_for_ffu=false
          conductorServiceTemplate:
            customServiceConfig: |
              [workarounds]
              disable_compute_service_check_for_ffu=false
EOF
done

$ cat > oscp-patch.yaml << EOF
spec:
  nova:
    template:
      apiServiceTemplate:
        customServiceConfig: |
          [workarounds]
          disable_compute_service_check_for_ffu=false
      metadataServiceTemplate:
        customServiceConfig: |
          [workarounds]
          disable_compute_service_check_for_ffu=false
      schedulerServiceTemplate:
        customServiceConfig: |
          [workarounds]
          disable_compute_service_check_for_ffu=false
      cellTemplates:
        cell0:
          conductorServiceTemplate:
            customServiceConfig: |
              [workarounds]
              disable_compute_service_check_for_ffu=false
EOF
$ cat celltemplates >> oscp-patch.yaml
----
+
* If you are adopting the {compute_service} with the {bare_metal_first_ref}, append the following `novaComputeTemplates` in the `cell<X>` section of the {compute_service} CR patch:
+
[source,yaml]
----
        cell<X>:
          novaComputeTemplates:
            <hostname>: <1>
              customServiceConfig: |
                [DEFAULT]
                host = <hostname>
                [workarounds]
                disable_compute_service_check_for_ffu=true
              computeDriver: ironic.IronicDriver
        ...
----
+
<1> Replace `<hostname>` with the hostname of the node that is running the `ironic` Compute driver in the source cloud of `cell<X>`.

. Apply the patch file:
+
----
$ oc patch openstackcontrolplane openstack --type=merge --patch-file=oscp-patch.yaml
----

. Wait until the Compute control plane services CRs are ready:
+
----
$ oc wait --for condition=Ready --timeout=300s Nova/nova
----

. Remove the pre-fast-forward upgrade workarounds from the Compute data plane services:
+
----
$ oc patch cm nova-cells-global-config --type=json -p='[{"op": "replace", "path": "/data/99-nova-compute-cells-workarounds.conf", "value": "[workarounds]\n"}]'
$ for CELL in $(echo $RENAMED_CELLS); do
$ oc get Openstackdataplanenodeset openstack-${CELL} || continue
$ oc apply -f - <<EOF
---
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneDeployment
metadata:
  name: openstack-nova-compute-ffu-$CELL
spec:
  nodeSets:
    - openstack-${CELL}
  servicesOverride:
    - nova-${CELL}
backoffLimit: 3
EOF
done
----

. Wait for the Compute data plane services to be ready for all the cells:
+
----
$ oc wait --for condition=Ready openstackdataplanedeployments --all --timeout=5m
----

. Run Compute database online migrations to complete the upgrade:
+
----
$ oc exec -it nova-cell0-conductor-0 -- nova-manage db online_data_migrations
$ for CELL in $(echo $RENAMED_CELLS); do
$ oc exec -it nova-${CELL}-conductor-0 -- nova-manage db online_data_migrations
done
----

. Discover the Compute hosts in the cells:
+
----
$ oc rsh nova-cell0-conductor-0 nova-manage cell_v2 discover_hosts --verbose
----

. Verify if the existing test VM instance is running:
+
----
${BASH_ALIASES[openstack]} server --os-compute-api-version 2.48 show --diagnostics test 2>&1 || echo FAIL
----

. Verify if the Compute services can stop the existing test VM instance:
+
----
${BASH_ALIASES[openstack]} server list -c Name -c Status -f value | grep -qF "test ACTIVE" && ${BASH_ALIASES[openstack]} server stop test || echo PASS
${BASH_ALIASES[openstack]} server list -c Name -c Status -f value | grep -qF "test SHUTOFF" || echo FAIL
${BASH_ALIASES[openstack]} server --os-compute-api-version 2.48 show --diagnostics test 2>&1 || echo PASS
----

. Verify if the Compute services can start the existing test VM instance:
+
----
${BASH_ALIASES[openstack]} server list -c Name -c Status -f value | grep -qF "test SHUTOFF" && ${BASH_ALIASES[openstack]} server start test || echo PASS
${BASH_ALIASES[openstack]} server list -c Name -c Status -f value | grep -qF "test ACTIVE" && \
  ${BASH_ALIASES[openstack]} server --os-compute-api-version 2.48 show --diagnostics test --fit-width -f json | jq -r '.state' | grep running || echo FAIL
----

.Next steps
After the data plane adoption, the Compute hosts continue to run Red Hat Enterprise Linux (RHEL) {rhel_prev_ver}. To take advantage of RHEL {rhel_curr_ver}, perform a minor update procedure after finishing the adoption procedure.
