I've seen this issue before, are you using load sharing mirrors for you vserver root volume? If so have you tried invoking a snapmirror update of your vserver root LSM volume, then mount trying to add the volume as an NFS datastore to your ESX hosts? To check if your vserver hosting the NFS volumes for your vsphere datastores is using a load sharing mirror or the root volume (namespace) SSH to your cluster and using the following commands as an example:
cluster1::> snapmirror show -vserver vserver1
Source Destination Mirror Relationship Total Last
Path Type Path State Status Progress Healthy Updated
----------- ---- ------------ ------- -------------- --------- ------- --------
Idle - true -
cluster1::> snapmirror update -source-path vserver1:vserver1_root -destination-path vserver1:vserver1_root_m1
[Job 2772] Job is queued: snapmirror update of destination "cluster1://vserver1/vserver1_root_m1".
Also you can use WFA to automate this task and integrate with vSphere too. Might be an option for you instead of a script, you can call WFA workflows using a script via a REST API if you really want to stay with CLI script option, the benefit of using WFA for this is that your automation process is centralised, logged, auditable etc. Please let me know if you have any questions.
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.