分享

openstack宿主机故障时从云硬盘恢复虚拟机

tscswcn 发表于 2017-9-4 22:39:13 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 5300
openstack宿主机故障时从云硬盘恢复虚拟机
允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://zhanguo1110.blog.51cto.com/5750817/1543029
1、在web界面找到要恢复的虚拟机
2、查看虚拟机的云硬盘ID
3、列如:云硬盘的ID是 49a426c8-6a9c-4047-a100-8ad07885952c
4、从数据库cinder库中,卸载云硬盘和虚拟机的挂载
1)、查看此云硬盘的信息
mysql> select * from volumes where id="49a426c8-6a9c-4047-a100-8ad07885952c";
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+--------------------------------------+------------+----------------------------+--------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
| created_at          | updated_at          | deleted_at | deleted | id                                   | ec2_id | user_id                          | project_id                       | host     | size | availability_zone | instance_uuid                        | mountpoint | attach_time                | status | attach_status | scheduled_at        | launched_at         | terminated_at | display_name | display_description | provider_location | provider_auth | snapshot_id                          | volume_type_id                       | source_volid | bootable | attached_host | provider_geometry | _name_id | encryption_key_id | migration_status |
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+--------------------------------------+------------+----------------------------+--------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
| 2014-08-07 14:54:04 | 2014-08-07 14:54:08 | NULL       |       0 | 49a426c8-6a9c-4047-a100-8ad07885952c | NULL   | 84a36a3ff48a44e89ef2d29b05f902bf | 4c86beee9fee46038b979f11e9fc5520 | os-node1 |  100 | nova              | 37767555-6f49-4f84-aa96-c08f176f10d3 | vda        | 2014-08-07T14:54:08.052233 | in-use | attached      | 2014-08-07 14:54:04 | 2014-08-07 14:54:05 | NULL          |              |                     | NULL              | NULL          | 128cfccf-b1aa-4778-b9c6-32d251d05b45 | 64efb028-794c-4a7c-9cdf-9e8895222fab | NULL         |        1 | NULL          | NULL              | NULL     | NULL              | NULL             |
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+--------------------------------------+------------+----------------------------+--------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
1 row in set (0.00 sec)
2)、卸载云硬盘和虚拟机的挂载关系
mysql> update volumes set instance_uuid=NULL  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
mysql> update volumes set mountpoint=NULL   where id="49a426c8-6a9c-4047-a100-8ad07885952c";
mysql> update volumes set attach_time=NULL  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
mysql> update volumes set status="available"  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
mysql> update volumes set attach_status="detached"  where id="49a426c8-6a9c-4047-a100-8ad07885952c";

mysql> update volumes set instance_uuid=NULL  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update volumes set mountpoint=NULL   where id="49a426c8-6a9c-4047-a100-8ad07885952c";
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update volumes set attach_time=NULL  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
Query OK, 1 row affected (0.03 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update volumes set status="available"  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update volumes set attach_status="detached"  where id="49a426c8-6a9c-4047-a100-8ad07885952c";
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

3)、再次查看云硬盘的信息
mysql> select * from volumes where id="49a426c8-6a9c-4047-a100-8ad07885952c";
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+---------------+------------+-------------+-----------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
| created_at          | updated_at          | deleted_at | deleted | id                                   | ec2_id | user_id                          | project_id                       | host     | size | availability_zone | instance_uuid | mountpoint | attach_time | status    | attach_status | scheduled_at        | launched_at         | terminated_at | display_name | display_description | provider_location | provider_auth | snapshot_id                          | volume_type_id                       | source_volid | bootable | attached_host | provider_geometry | _name_id | encryption_key_id | migration_status |
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+---------------+------------+-------------+-----------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
| 2014-08-07 14:54:04 | 2014-08-07 14:54:08 | NULL       |       0 | 49a426c8-6a9c-4047-a100-8ad07885952c | NULL   | 84a36a3ff48a44e89ef2d29b05f902bf | 4c86beee9fee46038b979f11e9fc5520 | os-node1 |  100 | nova              | NULL          | NULL       | NULL        | available | detached      | 2014-08-07 14:54:04 | 2014-08-07 14:54:05 | NULL          |              |                     | NULL              | NULL          | 128cfccf-b1aa-4778-b9c6-32d251d05b45 | 64efb028-794c-4a7c-9cdf-9e8895222fab | NULL         |        1 | NULL          | NULL              | NULL     | NULL              | NULL             |
+---------------------+---------------------+------------+---------+--------------------------------------+--------+----------------------------------+----------------------------------+----------+------+-------------------+---------------+------------+-------------+-----------+---------------+---------------------+---------------------+---------------+--------------+---------------------+-------------------+---------------+--------------------------------------+--------------------------------------+--------------+----------+---------------+-------------------+----------+-------------------+------------------+
1 row in set (0.00 sec)

mysql>
5、在dashboard界面查看云硬盘的状态,此时就可以用这个云硬盘新建虚拟机了
6、用上面的云硬盘在其他的宿主机建立一个虚拟机恢复故障的虚拟机。

本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1543029

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条