Skip to content

Commit c8eb8e3

Browse files
ashu-011openshift-merge-bot[bot]
authored andcommitted
Scale in the cell1 compute before deleting the cell in KUTTL
Cell deletion runs delete_cell without --force so it refuses while computes and host mapping still exists. Edit the test to scale-in and remove the compute and wait until its pod is gone then delete the nova-compute service which clears the host mapping when the host has no instances. Only then remove cell1.
1 parent ed46795 commit c8eb8e3

7 files changed

Lines changed: 39 additions & 5 deletions

File tree

‎test/kuttl/test-suites/nova/cell-tests/02-delete-cell-nova.yaml‎

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The fake compute must be gone before cell1 itself is deleted.
2+
apiVersion: nova.openstack.org/v1beta1
3+
kind: NovaCompute
4+
metadata:
5+
name: nova-kuttl-cell1-compute-fake-compute
6+
namespace: nova-kuttl-tests
7+
---
8+
apiVersion: v1
9+
kind: Pod
10+
metadata:
11+
name: nova-kuttl-cell1-compute-fake-compute-0
12+
namespace: nova-kuttl-tests
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
oc patch -n nova-kuttl-tests nova/nova-kuttl --type=json -p='[{"op": "remove", "path": "/spec/cellTemplates/cell1/novaComputeTemplates"}]'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
set -eu
6+
# The compute pod is already gone. Deleting the nova-compute service
7+
# removes its host mapping when the host has no instances.
8+
NS=nova-kuttl-tests
9+
service_ids=$(oc exec -n "${NS}" openstackclient -- openstack --os-compute-api-version 2.53 compute service list \
10+
--service nova-compute -f value -c ID -c Host | awk '$2 ~ /cell1/ { print $1 }')
11+
if [ -z "${service_ids}" ]; then
12+
echo "expected a nova-compute service for cell1"
13+
exit 1
14+
fi
15+
for service_id in ${service_ids}; do
16+
oc exec -n "${NS}" openstackclient -- openstack --os-compute-api-version 2.53 compute service delete "${service_id}"
17+
done
File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
oc patch -n nova-kuttl-tests nova/nova-kuttl --type=json -p='[{"op": "remove", "path": "/spec/cellTemplates/cell1"}]'

test/kuttl/test-suites/nova/cell-tests/03-cleanup-nova.yaml renamed to test/kuttl/test-suites/nova/cell-tests/05-cleanup-nova.yaml

File renamed without changes.

0 commit comments

Comments
 (0)