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、用上面的云硬盘在其他的宿主机建立一个虚拟机恢复故障的虚拟机。

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

时间: 2024-10-13 05:23:28

openstack宿主机故障时从云硬盘恢复虚拟机的相关文章

openstack宿主机宕机迁移

控制器上修改数据库 mysql -Dnova -e "update instances set host='os-node11' where uuid='5209f21b-b81e-4e19-8193-57263dc93dd7'" 创建一个网桥 brctl addbr  qbrdf45a648-6e 初始化迁移后的XML文件及启动云主机 cd/var/lib/nova/instances/5209f21b-b81e-4e19-8193-57263dc93dd7 删除libvirt.xm

在openstack宿主机里删除一个虚拟机关联的网卡、端口及桥

在宿主机里删除一个虚拟机关联的网卡.端口及桥 1).用ovs-vsctl命令查看宿主机的所有的桥信息 [[email protected] ~]#ovs-vsctl show 169dc0d6-0c44-42df-9bd5-5e1f380a8704 Bridge br-int Port int-br-int Interface int-br-int Port phy-br-int Interface phy-br-int Port "em2" Interface "em2&q

Openstack之路(九)云硬盘服务Cinder

Cinder的概述 Openstack块存储服务(Cinder)为云主机添加持久的存储,块存储提供一个基础设施为了管理卷,以及和Openstack计算服务交互,为实例提供卷.此服务也会激活管理卷的快照和卷类型的功能. Cinder的组件 Cinder-API 接收API请求,调用Cinder-Volume执行操作. Cinder-Volume 管理Volume的服务,与Volume Provider协调工作,管理Volume的生命周期.运行Cinder-Volume服务的节点被称作为存储节点.

OpenStack实践系列⑨云硬盘服务Cinder

OpenStack实践系列⑨云硬盘服务Cinder八.cinder8.1存储的三大分类 块存储:硬盘,磁盘阵列DAS,SAN存储 文件存储:nfs,GluserFS,Ceph(PB级分布式文件系统),MooserFS(缺点Metadata数据丢失,虚拟机就毁了) 11.2网络类型选择 对象存储:swift,S3 8.2 cinder控制节点的部署 安装cinder [[email protected] ~]# yum install openstack-cinder python-cinderc

Vmware Centos7 配置静态 ip 和 使宿主机和虚拟机互相 ping 通

NAT 方式1. 配置静态 ipVmware 安装 Centos7 可以参考 https://blog.csdn.net/guo_ridgepole/article/details/78973763 安装完 Centos7 后,开始给虚拟机配置静态 ip 查看配置 点击“编辑虚拟机设置” 选择“网络适配器” -->选中 NAT 模式 -->点击确定 点击“编辑” -->虚拟网络编辑器 VMnet8 -->NAT 设置然后记下 3 中的网关 ip,后面配置要用到 配置静态 ip启动虚

Linux虚拟机安装及与宿主机相互通信

1.首先,我们先装Linux系统在VMWare上.新建虚拟机,点击自定义,选择下一步. 2.选择兼容性最好的硬件VMWare12.0选择下一步. 3.选择稍后安装操作程序,为程序方便运行,点击下一步. 4.选择要安装的程序Linux,版本选择你所拥有的最高版本Red Hat Enterprise Linux6,点击下一步. 5.创建新文件夹,以便虚拟机卸载删除方便快捷(路径内不能有中文字符出现,计算机无法识别),点击下一步,选择参数,根据自身需要及电脑实际情况进行安排. 6.一般情况下,我们做实

kvm宿主机物理内存预留方案

正常一个kvm虚拟机的管理内存大约为1.2GB左右,正常不会超过2GB 标准虚机机可用内存计算方法: 宿主机物理内存 - 系统保留内存4GB - N个虚拟机物理内存 - (N个虚拟机 * 2GB虚拟机管理内存) 可能存在的内存浪费: 系统正常内存使用量为:2.5GB,空闲1.5GB 虚拟机管理内存通常为:1.2GB,空闲0.8GB 虚拟机内部业务未使用的物理内存:大小不定   (通常不能复用) 避免内存浪费方法: 增加虚拟内存,使用swap分区. swap分区大小如何设置? 正常大小应该设置为可

VMware虚拟机中centos6.5网络配置(桥接方式)与宿主机之间通信

1.修改网络适配器 2.选择桥接所用的网卡 3.设置网络 3.1在系统终端中输入 setup ,进行图形网络配置(此命令只有redhat系列才有作用) 上下左右键选择,enter键确定 将光标移动到Use DHCP的*上按空格键,取消动态获取 输入IP.子网掩码.默认网关 保存修改 保存并推出 退出 4.开启eth0网卡 在终端中输入 cd /etc/sysconfig/network-scripts 编辑ifcfg-eth0文件   vi ifcfg-eth0 将ONBOOT的值设置为yes

宿主机与虚拟机局域网互联

参考:Ubuntu14.04如何设置固定IP和DNS 0. 本文前置条件为宿主机已经处于局域网内,开启虚拟机并使它加入局域网 1. 环境 宿主机操作系统:Windows 7 professional虚拟工具软件:VirtualBox-5.1.6-110634-Win虚拟操作系统:ubuntu-15.10-server-i386 2. 安装ubuntu操作系统 略 3. 宿主环境 4. 在VirtualBox Manager中设置虚拟机网络配置为-->桥接模式 5. 配置虚拟机静态ip sudo