有两种重启方式供选择,软重启和硬重启,软重启试图优雅的关机并重启实例,而应重启则是直接对实例实施电源的拔插。
默认情况下重启实例采用软重启。
$ openstack server reboot SERVER
To perform a hard reboot, pass the --hard
parameter, as follows:
$ openstack server reboot --hard SERVER
也可以将运行中的实例重启至救援模式。例如,实例的文件系统由于长时间使用导致损坏,此时可能需要该操作。
注解
当实例处于救援模式时,暂停、挂起和停止操作是禁止的,因为触发这些操作会导致原有实例状态丢失,并且导致不能退出救援模式。
救援模式提供了一种机制,在镜像使该实例不可访问的情况下,仍然可以访问实例。默认情况下,救援模式从初始镜像启动一个实例,并连接当前的启动盘作为第二个磁盘。
运行以下命令将实例重启至救援模式:
$ openstack server rescue SERVER
注解
On running the openstack server rescue command,
an instance performs a soft shutdown first. This means that
the guest operating system has 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 unrescue SERVER
If you want to rescue an instance with a specific image, rather than the
default one, use the --image
parameter:
$ nova rescue --image IMAGE_ID SERVER
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.