This Knowledgebase article provides information about how to failover properly if the storage of the Active Virtual Machine is taken offline.
As soon as the storage where the Active Virtual Machine resides goes offline, the Active server gets into a frozen/unknown state. Even in this state, the server still responds to pings. A failover can be initiated when the passive server finds that the active server is unavailable and not online.
Unfortunately, if the active server still replies to pings, the failover cannot be initiated.
The procedure below offers a solution which can be customized to ensure the failover takes place. In order to do this, some scripts need to be used.
The scripts can be find in the Attached Files section below.
- To ensure that everything functions correctly, VMware vSphere Command-Line Interface should be installed on both primary and secondary servers.
- The NFStorageCheck.bat script should be placed in the %Neverfail Intall Dir%\R2\Scripts folder.
- Prior to usage, both Start.bat and NFStorageCheck.bat should be edited with the correct environment information.
For best results, the script should be started when the server starts, and be left running.
The script will perform the follwing:
- Check if the server is active or passive.
- If active, sleep for a while then go to the start and perform the same check again.
If passive, then:
- Create a file on a share on the active server’s system drive, via the channel ip address (\\<Channel IP>\c$)
- Delete that file .
- If all is OK, sleep for a while then go to the start and perform the active/passive check again.
- If the file operations fail, then:
- Use VMware calls (etc) to shut down the active server and allow the passive to detect and execute a failover.
- Sleep for a while and go to the start again.
In order to keep the CMD window hidden the script should only be called by a start-up script. To achieve this, a separate start script should be created and linked to a startup GPO.
This can be done as follows:
Start the Group Policy Editor (gpedit.msc) to open the Local Computer policy.
- Click Start , and then click Run .
- In the Open box, type Gpedit.msc , and then click OK .
- Expand Computer Configuration (if it is not already expanded).
- Expand Windows Settings .
- Click Scripts (Startup/Shutdown) .
- In the right pane, double-click Startup .
- Click Add and point to the Start.bat file.
- Click Apply and then OK .
- Quit the Group Policy Editor snap-in.
- Start the Group Policy Editor (gpedit.msc) to open the Local Computer policy.
- The script will create a log file in %Neverfail Intall Dir%\R2\logs folder.