Hi Experts,
Need your help on one of our requirements. Below ae the details of same:
We are using a web based java application which will be deployed on a linux machine. We are using VMWare 5.1 version API's to perform few of the operations like vm poweron/power off/mounting the floppy on the vm etc...Along with it , we will mount our server as NFS store on the ESXi host using VMWare ApI's.
As per our new requirement, user will enter an input in our application which is some other linux server/sftp server ip, which we need to add as an NFS store on the ESXi host using our application and using VMWare API's.
Can you please let me know if that is possible?
I tried doing it by giving the other server ip instead of ours in the application for addNFSDatastore method. Where it is adding an entry of the server ip on /etc/exports file like below:
<path> <server_ip>(ro,all_squash)
and failing to mount the datastore with below error:
" com.vmware.vim25.PlatformConfigFault"
and I could see that the hostd.log has below error :
2016-11-24T08:44:53.857Z info hostd[4D840B70] [Originator@6876 sub=Solo.Vmomi opID=1556dcf9 user=root] Throw vim.fault.PlatformConfigFault
2016-11-24T08:44:53.857Z info hostd[4D840B70] [Originator@6876 sub=Solo.Vmomi opID=1556dcf9 user=root] Result:
--> (vim.fault.PlatformConfigFault) {
| --> | faultCause = (vmodl.MethodFault) null, |
| --> | faultMessage = (vmodl.LocalizableMessage) [ |
| --> | (vmodl.LocalizableMessage) { |
| --> | key = "vob.vmfs.nfs.mount.error.perm.denied", |
| --> | arg = (vmodl.KeyAnyValue) [ |
| --> | (vmodl.KeyAnyValue) { |
| --> | key = "1", |
| --> | value = "1.1.1.1" |
| --> | }, |
| --> | (vmodl.KeyAnyValue) { |
| --> | key = "2", |
| --> | value = "/" |
| --> | } |
| --> | ], |
| --> | message = "NFS mount 10.126.155.104:/common/adminsftp/fresh_install failed: The mount request was denied by the NFS server. Check that the export exists and that the client is permitted to mount it. |
--> "
| --> | } |
| --> | ], |
Can you please provide your thoughts on the above?
Thanks In Advance
Best Regards,
Can you give a try with this API: https://www.vmware.com/support/developer/converter-sdk/conv50_apireference/vim.host.DatastoreSystem....
Here is sample script in perl for this: How to add NFS share as datastore to ESX/ESXi host using Perl SDK .. ? You can refer this and code in the language of your choice.
Hi,
Thanks for your prompt response. Our API whcih we are using to add NFS store "AddNFSDataStore" internally making use of createNASDatatsore method only to mount my server as NFS store on ESXi host.
But my requirement here is through the application whcih is running on my server, I need to add some other server as NFS on ESXi.
like my server is 1.1.1.1 whcih is linux box where my java based web application is runing. And in the web application user enters some input which is below:
Server IP : 2.2.2.2
ESXi IP: 22.22.22.22
credentails for ESXi : username: "abcd" & password: "abcd@123"
So now my application which is running on server 1.1.1.1 need to use the vmwar api to mount 2.2.2.2 as the NFS store on the above ESXi. Which is failing to do with the "PlatformConfigFault": exception.
Any idea why it could be.
Regards,
Anjana
Ok I got it. I will give a try using Java SDKs. I will come back once I am done.
It worked for me when I invoked this API against vCenter. Below is the code snippet
HostDatastoreSystem dssystem=host.getHostDatastoreSystem();
HostNasVolumeSpec NasSpec=new HostNasVolumeSpec();
NasSpec.setAccessMode("readWrite");
NasSpec.setLocalPath("NFSShare2");
NasSpec.setRemoteHost("10.192.x.x"); //NFS server IP
NasSpec.setRemotePath("/store1");
dssystem.createNasDatastore(NasSpec);
System.out.println("createNasDatastore API is called");
Can you please try the same? At the moment, I am not sure if this API works directly on ESXi host as well (Without any connection to vCenter)
I am using VC 60U2 and ESXi also 60U2.
Let me know your progress.
Your code looks similar to mine.
When I looked for the fault that you are getting
A PlatformConfigFault is a catch-all fault indicating that some error has occurred regarding the configuration of the host. Data about the fault is available and will be presented as a platform specific string.
is your environment configured properly?
Hi,
I ma trying to run the API against ESXi only. And I could see that vmkernal logs of ESXi is throwing the below error :
2016-11-25T13:51:27.045Z cpu1:34909 opID=7c1cc3d1)World: 15516: VC opID 1557ffb6 maps to vmkernel opID 7c1cc3d1
2016-11-25T13:51:27.045Z cpu1:34909 opID=7c1cc3d1)NFS: 157: Command: (mount) Server: (2.2.2.2) IP: (2.2.2.2) Path: (/l) Label: (sample-237) Options: (None)
2016-11-25T13:51:27.045Z cpu1:34909 opID=7c1cc3d1)StorageApdHandler: 982: APD Handle a33ee8a0-f505aa90 Created with lock[StorageApd-0x4306aee76260]
2016-11-25T13:51:27.047Z cpu22:12263537)WARNING: NFS: 221: Got error 13 from mount call
2016-11-25T13:51:27.047Z cpu1:34909 opID=7c1cc3d1)StorageApdHandler: 1066: Freeing APD handle 0x4306aee76260 [a33ee8a0-f505aa90]
2016-11-25T13:51:27.047Z cpu1:34909 opID=7c1cc3d1)StorageApdHandler: 1150: APD Handle freed!
2016-11-25T13:51:27.047Z cpu1:34909 opID=7c1cc3d1)NFS: 190: NFS mount 2.2.2.2:/ failed: The mount request was denied by the NFS server. Check that the export exists and that the client is permitted to mount it.
which looks to be some permission denied error. But not sure what is being expected here to have permission?
Regards,
Posted the solution here: Copy Files from NFS datatsore to local datatsore using VMWARE API
