summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-09 15:08:08 +0000
committerGerrit Code Review <review@openstack.org>2021-04-09 15:08:08 +0000
commit42c353bd2f1c1f1396def905e31b28ab6e216e9d (patch)
treee0b1505301d10c79c1ca68b12091aa6880971168
parentd482083bfd68ae7e43d37a65859635da56956d23 (diff)
parent20a7c98eff6592c3131360ad9d6eb12367dd11f6 (diff)
downloadnova-42c353bd2f1c1f1396def905e31b28ab6e216e9d.tar.gz
Merge "[OVN] Adapt the live-migration job scripts to work with OVN"
-rwxr-xr-xgate/test_evacuate.sh6
-rw-r--r--roles/run-evacuate-hook/tasks/main.yaml20
2 files changed, 20 insertions, 6 deletions
diff --git a/gate/test_evacuate.sh b/gate/test_evacuate.sh
index 2f8d21f64b..19466221da 100755
--- a/gate/test_evacuate.sh
+++ b/gate/test_evacuate.sh
@@ -56,7 +56,11 @@ nova boot --flavor ${flavor_id} --poll \
# Fence the subnode
echo "Stopping n-cpu, q-agt and guest domains on subnode"
-$ANSIBLE subnodes --become -f 5 -i "$WORKSPACE/inventory" -m shell -a "systemctl stop devstack@n-cpu devstack@q-agt"
+_stop_services="devstack@n-cpu"
+if sudo systemctl list-unit-files --type service | grep -q "devstack@q-agt"; then
+ _stop_services+=" devstack@q-agt"
+fi
+$ANSIBLE subnodes --become -f 5 -i "$WORKSPACE/inventory" -m shell -a "systemctl stop $_stop_services"
$ANSIBLE subnodes --become -f 5 -i "$WORKSPACE/inventory" -m shell -a "for domain in \$(virsh list --all --name); do virsh destroy \$domain; done"
echo "Forcing down the subnode so we can evacuate from it"
diff --git a/roles/run-evacuate-hook/tasks/main.yaml b/roles/run-evacuate-hook/tasks/main.yaml
index 184b9d18f9..9ca444a867 100644
--- a/roles/run-evacuate-hook/tasks/main.yaml
+++ b/roles/run-evacuate-hook/tasks/main.yaml
@@ -5,15 +5,25 @@
environment:
SUBNODE_HOSTNAME: "{{ hostvars['compute1']['ansible_hostname'] }}"
-- name: Fence subnode by stopping q-agt and n-cpu
+- name: Fence subnode by stopping n-cpu
delegate_to: compute1
become: true
systemd:
- name: "{{ item }}"
+ name: devstack@n-cpu
state: stopped
- with_items:
- - devstack@q-agt
- - devstack@n-cpu
+
+- name: Check if q-agt exists
+ shell: sudo systemctl status devstack@q-agt
+ ignore_errors: true
+ register: qagtstatus
+
+- name: Fence subnode by stopping q-agt (if exists)
+ delegate_to: compute1
+ become: true
+ systemd:
+ name: devstack@q-agt
+ state: stopped
+ when: qagtstatus.rc | int == 0
- name: Register running domains on subnode
delegate_to: compute1