停止和启动实例。

停止和启动实例。

使用以下方法停止和启动实例。

暂停和取消暂停实例。

运行以下命令暂停实例:

$ openstack server pause INSTANCE_NAME

该命令将虚拟机状态保存到内存。暂停中的虚拟机仍然以冻结状态运行。

运行以下命令,取消暂停实例。

$ openstack server unpause INSTANCE_NAME

挂起和恢复实例。

运行以下命令初始化虚拟机管理器级别的挂起操作。

$ openstack server suspend INSTANCE_NAME

运行以下命令恢复一个暂停的实例。

$ openstack server resume INSTANCE_NAME

释放和取消释放实例。

如果有不使用的云主机,但希望在云主机列表中仍然保留,此时需要用到释放功能。例如,一周工作结束后可以停止实例,下周开始后重新启动实例。所有数据和资源都保留;然而内存中的数据不会保留。如果不再使用已释放的实例,也可以完全删除。

执行如下释放命令:

  • 释放实例。关闭实例,将实例连同数据和资源存储到Glance.
$ 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
  • 删除已释放(shelved)的实例。(shelve:将实例作为镜像保存到Glance并从宿主机删除该实例。)从 主机删除实例、数据和关联资源。如果不再需要该实例,可以从虚拟机管理程序中删除该实例以减少资源占用。
$ nova shelve-offload SERVERNAME
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.