Simulating APD Event with ESXi
APD stands for all path down. It’s a storage issue that is discussed in VMware KB article Intermittent NFS APDs on VMware ESXi 5.5 U1 (2076392). You can install a patch to address the issue with ESXi 5.5.
My problem is different though – I want the APD, in a controllable way. The reason is that I need to test a project that handles the APD issues. I cannot wait there just for the intermittent APD happens. Here is the way I used to simulate APD events. You can set an alarm to see the APD happens by reading William’s blog How to create vCenter Alarm to alert on ESXi 5.5u1 NFS APD issue?
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
On any Linux machine that is accessible by the ESXi for testing, create a new folder for NFS share, and add the path to the /etc/exports file. To make it simple and meaningful, I just name it as /var/nfs_apd.
$ sudo mkdir /var/nfs_apd $ sudo vi /etc/exports /var/nfs_apd *(rw,sync,no_root_squash,no_subtree_check)
Then, run the following command to make the folder available.
$ sudo exportfs -ra
To make sure it’s exposed, run the following command to check if the folder has been exposed. If successful, you should see the path in the list.
$ showmount -e localhost Export list for localhost: /var/nfs_apd *
Now, you can add a new datastore to an ESXi server via standalone client or Web Client. To make it simple, you can just add it read-only because that’s enough to try out APD.
Once the datastore is added successfully, you can disable the NFS share:
$ sudo vi /etc/exports #/var/nfs_apd *(rw,sync,no_root_squash,no_subtree_check) $ sudo exportfs -ra
Optionally, you can stop or restart the NFS server, but that may be a big disruption to other exports therefore not recommended. Either way, you should not see the path in the showmount command (same as above) output.
$ sudo service nfs-kernel-server stop
Now, you should see the datastore is inaccessible and several events have been created. If you have set up an alarm for APD, it should be triggered as well. Note that if you just monitor the timeout event in the alarm, it may take a couple of minutes before it’s triggered.