Skip to content

Commit

Permalink
Use OSC in run-evacuate-hook instead of novaclient
Browse files Browse the repository at this point in the history
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
  • Loading branch information
melwitt committed Aug 12, 2023
1 parent f0565e8 commit e96ac43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions roles/run-evacuate-hook/files/setup_evacuate_resources.sh
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion roles/run-evacuate-hook/files/test_evacuate.sh
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions roles/run-evacuate-hook/files/test_negative_evacuate.sh
Expand Up @@ -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)
Expand Down

0 comments on commit e96ac43

Please sign in to comment.