It should be name only

Hello,

 

 

I am trying to create NFS datastore through VI SDK.I tried it using VI client and its getting created succesfully.

 

 

Through SDK I am not able to achieve the same.

 

 

Here the spec for the same.

 

 

HostConfigManager hostConfig = (HostConfigManager)vmUtils._GetPropFromMoref(hostmoref, "configManager");

 

 

ManagedObjectReference morefHostStorageSys = hostConfig.storageSystem;

 

 

HostNasVolumeSpec nasvmSpec = new HostNasVolumeSpec();

 

 

nasvmSpec.accessMode = "readOnly";

 

 

nasvmSpec.localPath = "/vmfs/volumes/nas_ds";

 

 

nasvmSpec.remoteHost = "avocado";

 

 

nasvmSpec.remotePath = "/vol/CrashVM/.snapshot/CRASH_NEW2";

 

 

nasvmSpec.type = "NFS";

 

 

ManagedObjectReference dsMoref = _mconnection.Service.CreateNasDatastore(morefHostStorageSys, nasvmSpec);

 

 

if (dsMoref != null)

 

 

{

 

 

Console.WriteLine("Datastore got created succesfully");

 

 

}

 

 

Correct me If I am missing something.

 

 

 

 

 

Thanks,

 

 

-AsHwIN



Correction:

 

 

ManagedObjectReference morefHostStorageSys = hostConfig.datastoresystem

 

 

Error getting : Specified paramter is not correct.

Local path field was wrong specified





你可能感兴趣的:(It should be name only)