删除僵尸实例的脚本

mysql -unova -pxxxx -h<ip> <<EOF
use nova

delete from instance_actions_events where action_id in (select id from instance_actions where instance_uuid = '$1');
delete from instance_actions where instance_uuid='$1';
delete from security_group_instance_association where instance_uuid='$1';
delete from instance_info_caches where instance_uuid='$1';
delete from block_device_mapping where instance_uuid='$1';
delete from instance_faults where instance_uuid='$1';
delete from instance_extra where instance_uuid='$1';
delete from instance_system_metadata where instance_uuid='$1';
delete from migrations where instance_uuid='$1';
delete from instances where uuid='$1';
EOF

说明:标红处需要修改为实际环境中使用的参数;

使用方法 #bash 脚本名 需要删除的instance_uuid 

 

posted @ 2019-10-28 14:48  jimmy阳  阅读(156)  评论(0编辑  收藏  举报