vm instance管理

来源:互联网 发布:二手车评估软件免费 编辑:程序博客网 时间:2024/06/06 09:54

 

1. start
# nova start <server_name/server_id>

2. stop
# nova stop <server_name/server_id>
The instance will be stopped immediately.

3. restart/reboot
# nova reboot <server_name/server_id>
The reboot process may wait for a certain period for the instance to finish the current task. This period may vary from several seconds to a few minutes.

4. pause, unpause
The content of the VM will be stored in memory (RAM).
Pausing keeps the instance running in a "frozen" state, so it won't free up any memory or vCPUS.

 # nova pause <server_name/server_id>
The status of this server will be changed to “PAUSED” immediately. And you cannot ping or ssh to the server. The users already logged into the instance will feel that the interface is freezed, they cannot do any operation again.

 # nova unpause <server_name/server_id>
The status of this server will return to “ACTIVE” immediately. The users will be able to continue their operation directly on the previous interface.

5. suspend, resume
The content of the VM  will be stored on disk.
Suspending an instance frees up memory and vCPUS, while pausing keeps the instance running, in a "frozen" state. Suspension could be compared to an "hibernation" mode.

 # nova suspend <server_name/server_id>
The status of this server will be changed to “SUSPENDED” after several seconds. And you cannot ping or ssh to the server.
The users already logged into the RHEL or SLES instances using ssh will be freezed, they cannot do any operation.
The users already logged into windows instances using vncviewer will be stopped, the vncviewer interface will be closed.

 # nova resume <server_name/server_id>
The status of this server will return to “ACTIVE” after several seconds.
The users already logged into the RHEL or SLES instances using ssh will be able to continue their operation directly.
The users of windows instances should reconnect the instance using vncviewer.

(Note: thevnc port may be different from the previous value before the suspend operation.)

 RHEL:  OK, 8 seconds for suspend, 5 seconds for resume.
 SLES: OK, 10 seconds for suspend, 7 seconds for resume.
 WinXP: OK, 8 seconds for suspend, 5 seconds for resume.
 Win7: OK, 12 seconds for suspend, 7 seconds for resume.
 Win2008: OK, 8 seconds for suspend, 5 seconds for resume.


6. resize
# nova resize <server_name/server_id> <new_flavor_id>
The resize operation requires that the different compute nodes could ssh to each other directly under the user of “nova” without password authentication.

The status of instance will be changed to “RESIZE”.
After about 40 seconds, the status of instance will be changed to “VERIFY_RESIZE”.

# nova resize-confirm <server_name/server_id>
The status of instance will be changed to “ACTIVE”.

Aftere the instance is resized, it will be running on another compute node. And we met the following problems with the new instance:

(1) The hostname of instance was changed to "localhost".
(2) The instance could not acquire an IP through dhcp. If I assign a static IP by changing the ifcfg-eth0 file, it did work.
(3) Sometimes the ram cannot be reverted to the original size after the "nova resize-revert" action.
(4) The status and size of ram and disk seems to be normally resized before the "nova resize-confirm" action. But it might became abnormal after the "nova resize-confirm" action. Sometimes the ram or disk may return to the original size.

We will try to solve the above problems with resize operation.
 

7. Reset the state of an instance
Sometimes the state of an instance may stuck at “REBOOT” or other value, and other operation may not allowed in this state. For this situation, we can force reset the state of the instance by using the command of “nova reset-state”

# nova reset-state <server_name/server_id>
 the state of instance will be changed to “ERROR”

# nova reset-state --active <server_name/server_id>
 the state of instance will be changed to “ACTIVE”
At this time, we can stop the instance, and start it again as usual.

# nova stop <server_name/server_id>
 the state of instance will be changed to “SHUTOFF”

# nova start <server_name/server_id>
 the state of instance will be changed to “ACTIVE”

 

 

原创粉丝点击