使用以下方法停止和启动实例。
运行以下命令暂停实例:
$ openstack server pause INSTANCE_NAME
该命令将虚拟机状态保存到内存。暂停中的虚拟机仍然以冻结状态运行。
运行以下命令,取消暂停实例。
$ openstack server unpause INSTANCE_NAME
运行以下命令初始化虚拟机管理器级别的挂起操作。
$ openstack server suspend INSTANCE_NAME
运行以下命令恢复一个暂停的实例。
$ openstack server resume INSTANCE_NAME
如果有不使用的云主机,但希望在云主机列表中仍然保留,此时需要用到释放功能。例如,一周工作结束后可以停止实例,下周开始后重新启动实例。所有数据和资源都保留;然而内存中的数据不会保留。如果不再使用已释放的实例,也可以完全删除。
执行如下释放命令:
$ openstack server shelve SERVERNAME
注解
By default, the openstack server shelve command gives the guest
operating system a chance to perform a controlled shutdown before the
instance is powered off. The shutdown behavior is configured by the
shutdown_timeout
parameter that can be set in the
nova.conf
file. Its value stands for the overall
period (in seconds) a guest operating system is allowed
to complete the shutdown. The default timeout is 60 seconds.
See Description of Compute configuration options
for details.
可以为每个镜像单独设置操作系统关机超时时间。在镜像的metadata中,``os_shutdown_timeout``用于指定该镜像操作系统类型所需的关机超时时间。
$ openstack server unshelve SERVERNAME
$ nova shelve-offload SERVERNAME
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.