File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ for resource in 'loadbalancer' 'server' 'router' 'subnet' 'network' 'volume snap
82
82
volume)
83
83
for r in $( ./stale.sh -q " $resource " ) ; do
84
84
status=$( openstack " ${resource} " show -c status -f value " ${r} " )
85
+ attach_status=$( openstack " ${resource} " show -c attachments -f value " ${r} " )
86
+ if [ " $attach_status " != " []" ]; then
87
+ echo " ${resource} ${r} is attached to a server, will try to detach it"
88
+ openstack " ${resource} " set --detached " $r " || >&2 echo " Failed to detach ${resource} ${r} , ${r} will probably fail to be removed..."
89
+ fi
85
90
case " $status " in
86
91
# For Cinder volumes, deletable states are documented here:
87
92
# https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=delete-a-volume-detail#delete-a-volume
You can’t perform that action at this time.
0 commit comments