OpenStack源码级深入了解删除虚拟机操作
Posted puyangsky
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenStack源码级深入了解删除虚拟机操作相关的知识,希望对你有一定的参考价值。
首先看一下虚拟机有多少种状态:(/nova/compute/vmstates.py)
1 ACTIVE = ‘active‘ # VM is running 2 BUILDING = ‘building‘ # VM only exists in DB 3 PAUSED = ‘paused‘ 4 SUSPENDED = ‘suspended‘ # VM is suspended to disk. 5 STOPPED = ‘stopped‘ # VM is powered off, the disk image is still there. 6 RESCUED = ‘rescued‘ # A rescue image is running with the original VM image 7 # attached. 8 RESIZED = ‘resized‘ # a VM with the new size is active. The user is expected 9 # to manually confirm or revert. 10 11 SOFT_DELETED = ‘soft-delete‘ # VM is marked as deleted but the disk images are 12 # still available to restore. 13 DELETED = ‘deleted‘ # VM is permanently deleted. 14 15 ERROR = ‘error‘ 16 17 SHELVED = ‘shelved‘ # VM is powered off, resources still on hypervisor 18 SHELVED_OFFLOADED = ‘shelved_offloaded‘ # VM and associated resources are 19 # not on hypervisor 20 21 ALLOW_SOFT_REBOOT = [ACTIVE] # states we can soft reboot from 22 ALLOW_HARD_REBOOT = ALLOW_SOFT_REBOOT + [STOPPED, PAUSED, SUSPENDED, ERROR] 23 # states we allow hard reboot from 24 25 ALLOW_TRIGGER_CRASH_DUMP = [ACTIVE, PAUSED, RESCUED, RESIZED, ERROR] 26 # states we allow to trigger crash dump 27 28 ALLOW_RESOURCE_REMOVAL = [DELETED, SHELVED_OFFLOADED] 29 # states we allow resources to be freed in
在删除虚拟机时,会根据虚拟机状态来进行不同的操作。可以看出deleted和shelved_offloaded两种状态下虚拟机资源完全释放,而shelved
以上是关于OpenStack源码级深入了解删除虚拟机操作的主要内容,如果未能解决你的问题,请参考以下文章