sh 从VM状态为ERROR的Mysql中删除VM

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 从VM状态为ERROR的Mysql中删除VM相关的知识,希望对你有一定的参考价值。

#!/bin/bash

echo "Enter your MySQL user"
read MYSQL_USER

echo "Enter your MySQL user password"
read MYSQL_PASSWD

echo "Enter your MySQL host"
read MYSQL_HOST

mysql -u$MYSQL_USER -p$MYSQL_PASSWD -h$MYSQL_HOST -e 'USE nova; DELETE FROM security_group_instance_association WHERE instance_id IN (SELECT id FROM instances WHERE vm_state = "error");'
mysql -u$MYSQL_USER -p$MYSQL_PASSWD -h$MYSQL_HOST -e 'USE nova; DELETE FROM block_device_mapping WHERE instance_id IN (SELECT id FROM instances WHERE vm_state = "error");'
mysql -u$MYSQL_USER -p$MYSQL_PASSWD -h$MYSQL_HOST -e 'USE nova; DELETE FROM instance_info_caches WHERE instance_id IN (SELECT uuid FROM instances WHERE vm_state = "error");'
mysql -u$MYSQL_USER -p$MYSQL_PASSWD -h$MYSQL_HOST -e 'USE nova; UPDATE fixed_ips SET allocated = 0 WHERE instance_id IN (SELECT id FROM instances WHERE vm_state = "error");'
mysql -u$MYSQL_USER -p$MYSQL_PASSWD -h$MYSQL_HOST -e 'USE nova; DELETE FROM instances WHERE vm_state = "error";'

以上是关于sh 从VM状态为ERROR的Mysql中删除VM的主要内容,如果未能解决你的问题,请参考以下文章

sh 在Linux上自动保存所有正在运行的VM的状态的脚本

Kivy Buildozer VM sh.ErrorReturnCode_127 错误

sh 一个shell脚本,为本地托管的nat VM创建一个8节点nat网络,通过por提供ssh,mysql,postgres和其他Web服务

Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/vm10-0-0-19

通过Logstash6.x 导入MySQL8 数据至ES 提示:Error occurred during initialization of VM

jboss服务启动失败报:Error occurred during initialization of VM