今天無意中,將公司的虛擬化服務器,設置成了 維護模式 ,開始到也沒有注意 這個ESXi 服務器的維護模式有什麽區別,進去之後才發現無法新增和部署新的虛擬機了。把VSphere Client 的菜單看完了也沒有找到怎麼樣退出 維護模式。

          開始我想到把虛擬服務器重啟一下,也許就可以恢復到正常模式下,可是虛擬服務器上運行了8、9臺服務器在跑啊,雖說是非關鍵任務的服務器,但隨便中斷也不太好,而且重啟能夠恢復只是我的猜想,要是不能恢復到正常模式,那我不是虧大發了。

        後來上百度找,找到一個專門介紹虛擬機的網站www.vmbest.com ,上面介紹虛擬機的資料還是蠻多的,但沒有我想要的信息,也沒過多的仔細看,心想百度不行,我就換換google吧,在google輸入 how to exit esxi 4.0 maintenance mode ,最後搜出的內容把我帶到了如下鏈接:http://blog.vmpros.nl/2009/06/03/vmware-exiting-hung-maintenance-mode-on-esx-server-9639912/ ,全英文的,全文如下:

VMware: Exiting hung maintenance mode on ESX Server (9639912)

The following solution describes how to exit a hung maintenance mode from Virtual Infrastructure Client or from the command line on the service console of the ESX Server host.

Note: Before you begin please refer to KB1003490 for important information on restarting the mgmt-vmware service.

To exit from a hung maintenance mode, try the following: 

  • Disconnect the Virtual Infrastructure Client (by closing it) and reconnect to the ESX Server system, to see if the option exit maintenance mode appears. If this works, there was a problem refreshing the information known to the Virtual Infrastructure Client.
  • Try restarting the management agent. This shouldn’t affect any running virtual machines and often clears hung tasks.  However prior to ESX Server 3.0.1 (and in ESX Server 3.5.x issuing this command will cause virtual machines to restart if the option "autostart on boot" is set inside VirtualCenter Server.  From the service console of the ESX Server host, type:  # service mgmt-vmware restart
  • Try exiting maintenance mode using the vimsh command.

 

  1. Log into the ESX Server service console as root, either using your favorite SSH program or directly on the physical console.
  2. Run the following command:  # vimsh    You might see some messages similar to the following, which you can safely ignore:
    [2007-04-02 13:17:30.031 'App' 3076472960 info] Current working directory:
    /usr/lib/vmware/hostd
    [2007-04-02 13:17:30.033 'BaseLibs' 3076472960 info] Using system libcrypto, version 90709F
    [2007-04-02 13:17:30.057 'BaseLibs' 11213744 warning] [Vmdb_Unset] Unsetting unknown path: /vmomi/
  3. When you get to the vimsh command prompt [/]$ type the following command:  [/]$ /hostsvc/maintenance_mode_exit
    You should see a confirmation that the command was valid and the task was initiated, similar to the following:
    ‘vim.Task:haTask-ha-host-vim.HostSystem.exitMaintenanceMode-1610715′
    At this point, the ESX Server host should exit maintenance mode.
  4. Exit the vimsh session when you return to the command prompt:  [/]$ quit Alternate commands to run for vimsh:
  • Enter maintenance mode (turn on): vimsh -n -e /hostsvc/maintenance_mode_enter
  • Exit maintenance mode (turn off): vimsh -n -e /hostsvc/maintenance_mode_exit
    If you are unable to get out of maintenance mode there may be an issue due to authd, as shown by messages in /var/log/vmware/hostd.log similar to the following:

[VpxVmdbCnx] Authd error: 514 Error connecting to hostd-vmdb service instance.
[VpxVmdbCnx] Failed to connect to host :902. Check that authd is running correctly (lib/connect error 11) In this situation, try the following commands on the ESX Server service console command-line, step by step:

  1. chkconfig vmware-authd off
  2. service xinetd restart
  3. chkconfig –level 3 vmware-authd on
  4. service xinetd restart

看到其中一點,Try restarting the management agent  后,我就跑到機房,進入虛擬服務器的管理控制臺,輸入root帳號的密碼,找到 management agent 菜單,按下F11,在重啟前還提示了一下會中斷管理工具的連接,我也不管了,直接回車重啟,過了以後,重啟ok,退出管理控制臺。再到我的電腦用VSphere Client 連進去,發現可以創建新的虛擬機了,原來有些在維護模式下不能用的菜單也恢復正常。oh yeah!!!!我的問題解決了。