Use OSC in run-evacuate-hook instead of novaclient

Recently a change landed in devstack [1] to install packages into a
global venv by default and the "nova" command was not symlinked for
compat, so jobs using run-evacuate-hook are failing with:

  nova: command not found

We had intended to switch away from using novaclient CLI commands in our
scripts anyway, so we can just use this opportunity to switch to OSC.

[1]: If9bc7ba45522189d03f19b86cb681bb150ee2f25

Change-Id: Ifd969b84a99a9c0460bceb1a28fcee6e51cbb4ae
This commit is contained in:
melanie witt 2023-08-12 00:48:49 +00:00
parent f0565e84ee
commit e96ac439d3
3 changed files with 8 additions and 7 deletions

View File

@ -11,11 +11,10 @@ echo "Creating ephemeral test server on subnode"
openstack --os-compute-api-version 2.74 server create --image ${image_id} --flavor ${flavor_id} \
--nic net-id=${network_id} --host $SUBNODE_HOSTNAME --wait evacuate-test
# TODO(lyarwood) Use osc to launch the bfv volume
echo "Creating boot from volume test server on subnode"
nova --os-compute-api-version 2.74 boot --flavor ${flavor_id} --poll \
--block-device id=${image_id},source=image,dest=volume,size=1,bootindex=0,shutdown=remove \
--nic net-id=${network_id} --host ${SUBNODE_HOSTNAME} evacuate-bfv-test
openstack --os-compute-api-version 2.74 server create --flavor ${flavor_id} \
--block-device source_type=image,uuid=${image_id},destination_type=volume,volume_size=1,boot_index=0,delete_on_termination=true \
--network ${network_id} --host ${SUBNODE_HOSTNAME} --wait evacuate-bfv-test
echo "Forcing down the subnode so we can evacuate from it"
openstack --os-compute-api-version 2.11 compute service set --down ${SUBNODE_HOSTNAME} nova-compute

View File

@ -22,7 +22,10 @@ done
function evacuate_and_wait_for_active() {
local server="$1"
nova evacuate ${server}
# Shared storage will be auto-calculated with -os-compute-api-version 2.14
# and greater and --shared-storage should not be used with later
# microversions.
openstack --os-compute-api-version 2.14 server evacuate ${server}
# Wait for the instance to go into ACTIVE state from the evacuate.
count=0
status=$(openstack server show ${server} -f value -c status)

View File

@ -16,8 +16,7 @@ function evacuate_and_wait_for_error() {
local server="$1"
echo "Forcing evacuate of ${server} to local host"
# TODO(mriedem): Use OSC when it supports evacuate.
nova --os-compute-api-version "2.67" evacuate --force ${server} ${CONTROLLER_HOSTNAME}
openstack --os-compute-api-version 2.67 server evacuate --host ${CONTROLLER_HOSTNAME} ${server}
# Wait for the instance to go into ERROR state from the failed evacuate.
count=0
status=$(openstack server show ${server} -f value -c status)