标签:instance tool $2 _id msu root attach sim host
在openstack里面有时候删除instance时,volume无法跟着删除,可以自己编写脚本来实现,脚本代码如下:
#!/bin/bash for i in $(cat /root/host-del); do host_id=`nova list --all |grep -w $i |awk '{print $2}'` echo -e "\033[34mvm $i deleting...\033[0m" nova delete $host_id 1>/dev/null sleep 3 volume_id=`cinder list --all |grep -w $host_id |awk '{print $2}'` for j in $volume_id do echo -e "\e[1;31mvm $i attached volumes deleting...\e[0m" cinder delete $volume_id 1>/dev/null sleep 2 done done
OpenStack 删除instance 和其附加的volumes
标签:instance tool $2 _id msu root attach sim host
原文地址:http://blog.51cto.com/coolsky/2149025