nova shelve
当一个虚机不需要使用的时候,可以将其 shelve 起来。该操作会创建该虚机的一个快照并传到 Glance 中,然后在 Hypervisor 上将该虚机删除,从而释放其资源。
其主要过程为:
- destroy 虚机 (virt_dom.destroy())
- snapshot 该 domain
- 如果 CONF.shelved_offload_time == 0 的话,将domain 的各种资源(interface,volume,实例文件等),然后将其undefine (virt_dom.undefine())
其只存在于数据库和 Glance 中。运行 nova list 能看到一条记录:
| 8352e969-0a25-4abf-978f-d9d0ec4de0cd | vm11 | SHELVED_OFFLOADED | - | Shutdown | demo-net2=10.0.10.14; demo-net=10.0.0.41 |
运行 glance image-list 能看到其image:
| 6ed6eb92-ce42-46d1-ab46-259e3e235304 | vm11-shelved | qcow2 | bare | 19988480 | active |
能看到该 image 的 instance 相关的属性:
s1@controller:~$ glance image-show 6ed6eb92-ce42-46d1-ab46-259e3e235304
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| Property 'base_image_ref' | bb9318db-5554-4857-a309-268c6653b9ff |
| Property 'image_location' | snapshot |
| Property 'image_state' | available |
| Property 'image_type' | snapshot |
| Property 'instance_type_ephemeral_gb' | 1 |
| Property 'instance_type_flavorid' | 129f237e-8825-49fa-b489-0e41fb06b70e |
| Property 'instance_type_id' | 8 |
| Property 'instance_type_memory_mb' | 50 |
| Property 'instance_type_name' | tiny2 |
| Property 'instance_type_root_gb' | 1 |
| Property 'instance_type_rxtx_factor' | 1.0 |
| Property 'instance_type_swap' | 30 |
| Property 'instance_type_vcpus' | 1 |
| Property 'instance_uuid' | 8352e969-0a25-4abf-978f-d9d0ec4de0cd |
| Property 'network_allocated' | True |
| Property 'owner_id' | 74c8ada23a3449f888d9e19b76d13aab |
| Property 'user_id' | bcd37e6272184f34993b4d7686ca4479 |
Unshelve 是 shelve 的反操作。它的主要过程是:
- 从 DB 中获取 network_info 和 block_device_info
- 从 Glance 中获取 image
- 象新建一个虚拟那样 spawn 新的虚机
- 调用 image API 将 image 删除
shelve 对于非后端卷VM,会先根据当前VM信息创建一个镜像待用。
* 之后消息会直接发到VM所在的节点上去。
* 在manager层会根据hypervisor类型,调用具体Driver的关机+快照操作,image_id使用上一步已创建好的镜像。
* 同时在 instance_system_metadata表中添加 shelved_at、shelved_image_id、shelved_host三项内容。
* VM状态变为SHELVED。
* 对于shelve_offload_time =0 时,直接对VM进行shelve_offload,无需定时任务再计时。
对于shelve_offload操作:
l 只有SHELVED状态的VM能够进行shelve-offload操作。
l 且该对外接口需要管理员角色。
l 实质操作仅为调用Driver的删除VM接口,释放hypervisor层面上资源而已。
l VM状态变迁为SHELVED_OFFLOADED。
https://blueprints.launchpad.net/nova/+spec/shelve-instance
https://review.openstack.org/#/c/135387/18
最新文章
- Mac OS Terminal 几个快捷键
- springmvc导出excel并弹出下载框
- Linux-Gcc生成和使用静态库和动态库详解
- JAVA异常体系
- 图片轮播插件-carouFredSel
- POJ 2151 概率DP
- paip.mysql 5.6 安装总结
- web.xml中配置Spring中applicationContext.xml的方式
- 今天在研究jquery用ajax提交form表单中得数据时,学习到了一种新的提交方式
- 字符串的缺点以及StringBuilder
- JavaScript提高篇之面向对象之单利模式工厂模型构造函数原型链模式
- C语言——第一次作业(2)
- asp.net core 系列之中间件进阶篇-编写自定义中间件(middleware)
- C++智能指针剖析(下)boost::shared_ptr&;其他
- 关于几天来研究使用css3动画的一点总结
- html页面导出为excel表格
- BZOJ.3631.[JLOI2014]松鼠的新家(树上差分)
- 此请求已被阻止,因为当用在 GET 请求中时,会将敏感信息透漏给第三方网站。若要允许 GET 请求,请将 JsonRequestBehavior 设置为 AllowGet。
- 【转】Rancher 2.0 里程碑版本:支持添加自定义节点!
- ONOS架构-概览