Code Review
/
releng
/
builder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Use os-std-topo in all netvirt patch-test's
[releng/builder.git]
/
jjb
/
odl-openstack-cleanup-orphaned-nodes.sh
diff --git
a/jjb/odl-openstack-cleanup-orphaned-nodes.sh
b/jjb/odl-openstack-cleanup-orphaned-nodes.sh
index 953dadc81cded07e11715ce8beb1f77d54e9fa56..c3c6b35a24e23c25b85e77ff60dd2851ee8d2dc1 100644
(file)
--- a/
jjb/odl-openstack-cleanup-orphaned-nodes.sh
+++ b/
jjb/odl-openstack-cleanup-orphaned-nodes.sh
@@
-10,9
+10,6
@@
##############################################################################
echo "---> Cleanup orphaned servers"
##############################################################################
echo "---> Cleanup orphaned servers"
-# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091
-source "/tmp/v/openstack/bin/activate"
-
minion_in_jenkins() {
# Usage: check_stack_in_jenkins STACK_NAME JENKINS_URL [JENKINS_URL...]
# Returns: 0 If stack is in Jenkins and 1 if stack is not in Jenkins.
minion_in_jenkins() {
# Usage: check_stack_in_jenkins STACK_NAME JENKINS_URL [JENKINS_URL...]
# Returns: 0 If stack is in Jenkins and 1 if stack is not in Jenkins.
@@
-46,13
+43,17
@@
minion_in_jenkins() {
# Fetch server list before fetching active minions to minimize race condition
# where we might be trying to delete servers while jobs are trying to start
# Fetch server list before fetching active minions to minimize race condition
# where we might be trying to delete servers while jobs are trying to start
+# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091
+source "/tmp/v/openstack/bin/activate"
+
# We purposely need word splitting here to create the OS_SERVERS array.
# shellcheck disable=SC2207
# We purposely need word splitting here to create the OS_SERVERS array.
# shellcheck disable=SC2207
-
OS_SERVERS=($(openstack server list -f value -c "Name" | grep -E 'prd|snd')
)
+
mapfile -t OS_SERVERS < <(openstack server list -f value -c "Name" | grep -E 'prd|snd'
)
#############################
## DELETE ORPHANED SERVERS ##
#############################
#############################
## DELETE ORPHANED SERVERS ##
#############################
+
# Search for servers that are not in use by either releng or sandbox silos and
# delete them.
for server in "${OS_SERVERS[@]}"; do
# Search for servers that are not in use by either releng or sandbox silos and
# delete them.
for server in "${OS_SERVERS[@]}"; do
@@
-64,6
+65,9
@@
for server in "${OS_SERVERS[@]}"; do
continue
else
echo "Deleting $server"
continue
else
echo "Deleting $server"
- openstack server delete "$server"
+ lftools openstack --os-cloud vex \
+ server remove --minutes 15 "$server"
fi
done
fi
done
+
+deactivate