usage: nova rescue [--password <password>] [--image <image>] <server>

Reboots a server into rescue mode, which
                                starts the machine from either the initial
                                image or a specified image, attaching the
                                current boot disk as secondary.

A rescue is normally performed when something goes wrong with the
primary images and data needs to be corrected/recovered. Rescuing
should not edit or over-ride the original image, only allow for
data recovery.

不能rescue 一个 volume-backed instance

compute manager中def rescue_instance 不用再check password了

rescue_image_ref哪儿来?

Rescue 是个很有意思的功能。它的一个使用场景是,虚机的启动盘的一个文件被误删除了导致无法再次启动了,或者 admin 的密码忘记了。Rescue 功能提供一个解决这类问题的手段。

执行 nova rescue 命令后的主要过程是:

(1)保存目前domain 的 xml 配置到 unrescue.xml 文件

(2)根据 image 重新生成启动盘 disk.swap (大小不受 falvor.root_disk_size 控制,尽可能小的一个文件)

root@compute2:/var/lib/nova/instances/8352e969-0a25-4abf-978f-d9d0ec4de0cd# qemu-img info disk.rescue
image: disk.rescue
file format: qcow2
virtual size: 39M (41126400 bytes) #不是 falovr 里面定义的 1G 大小
disk size: 1.6M
cluster_size: 65536
backing file: /var/lib/nova/instances/_base/fbad3d96a1727069346073e51d5bbb1824e76e34
Format specific information:
compat: 1.1
lazy refcounts: false
        rescue_images = {
'image_id': (rescue_image_id or
CONF.libvirt.rescue_image_id or instance.image_ref),
'kernel_id': (CONF.libvirt.rescue_kernel_id or
instance.kernel_id),
'ramdisk_id': (CONF.libvirt.rescue_ramdisk_id or
instance.ramdisk_id),
}

(3)构造一个新的 domain 的 xml 配置,使用 disk.rescue 做启动盘,将原来的 disk 挂载到该 domain,其他的盘和volume不会被挂载。

   <disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none"/>
<source file="/var/lib/nova/instances/8352e969-0a25-4abf-978f-d9d0ec4de0cd/disk.rescue"/> #新构造的启动盘
<target bus="virtio" dev="vda"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none"/>
<source file="/var/lib/nova/instances/8352e969-0a25-4abf-978f-d9d0ec4de0cd/disk"/> #原来的启动盘
<target bus="virtio" dev="vdb"/>
</disk>

(4)将原来的 domain destroy 掉 (virt_dom.destroy)

(5)定义新的 domain (conn.defineXML(xml))

(6)启动新的 domain (domain.createWithFlags)

至此,nova rescue 的过程完成。用户可以 ssh 到新的虚机,修改 “Vdb“分区中的受损害的文件。然后执行 ”nova unrescue“命令。其主要过程是:

(1)读取之前保存的 unrescue.xml 文件

(2)将 rescued domain destroy 掉

(3)定义和启动新的domain(同上面5和6)

(4)删除 unrescue.xml 文件

注意,这时候文件夹中的 libvirt.xml 文件和新运行的 domain 的 xml 不一致,因为代码中没有将新的 domain 的xml 写到该文件。

http://www.cnblogs.com/sammyliu/p/4571209.html

最新文章

  1. Web APi之过滤器执行过程原理解析【二】(十一)
  2. Debug模式,不能进入打断点的类,反而进入代理类里
  3. java 并发性和多线程 -- 读感 (二 线程间通讯,共享内存的机制)
  4. 7.4 gcd
  5. svc 报“由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。“的HTTP 错误 404.3 – Not Found
  6. 2.13.1. 对结果排序(Core Data 应用程序实践指南)
  7. Docker存储驱动之总览
  8. margin和padding的区别和用法
  9. (五十)Quartz2D生成图片的一些应用
  10. (转)前端开发-发布一个NPM包之最简单易懂流程
  11. 使用Github Composer Packagist编写及发布扩展包
  12. [R] Lexical &amp; Dynamic Scoping / Execution &amp; Calling environments / Closures
  13. SpringBoot系列: SpringBoot 启动慢的问题
  14. 2019 GOALS
  15. BZOJ 4399 魔法少女LJJ(线段树合并)
  16. s4-5 以太网帧
  17. 安装php扩展包
  18. mfc c++字符串类与 流输出
  19. TFS支持移动设备,微软已经走出了第一步(手机上更新、查询工作项)
  20. Spring整合MyBatis(二)Spring整合MyBatis

热门文章

  1. 修改 /var/lib/locales/supported.d/local 文件(使用 locale -a 命令查看系统中所有已配置的 locale)
  2. Python3.6全栈开发实例[024]
  3. 正确使用索引(sql优化),limit分页优化,执行计划,慢日志查询
  4. vue.js 拦截器
  5. windows 安装 python _ flask
  6. 经典书Discrete.Mathematics上的大神
  7. 003-搭建框架-实现IOC机制
  8. opencv3计算机视觉+Python(四)
  9. Python之函数总结
  10. classmethod