openstack宿主機故障時從雲硬碟恢複虛擬機器

來源:互聯網
上載者:User

標籤:openstack常見問題

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.