Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

Problem on to create a Virtual disk on calling CreateVirtualDisk_Task returned NULL Task

$
0
0

Hi experts,

 

I'm trying to create a VMDK by calling  CreateVirtualDisk_Task, the following code is worked perfactly on a vmware 5.0 "stand-alone" deployment, however it always returns "NULL" task management object on a cluster deployment。

can anyone who can help me on this?

 

        public string CreateVMDK(string SrcPath, long LongSizeInKByte)

        {

            _service = ecb.getServiceConnectionV25().Service;

            _sic = ecb.getServiceConnectionV25().ServiceContent;

            ManagedObjectReference datacenterRef = _service.FindByInventoryPath(_sic.searchIndex, _strdatacenterName);

            ManagedObjectReference morVDM = _sic.virtualDiskManager;

            FileBackedVirtualDiskSpec vdsObj = new FileBackedVirtualDiskSpec();

            //vdsObj.capacityKb = 10000000;

            vdsObj.capacityKb = LongSizeInKByte;

            vdsObj.diskType = "eagerZeroedThick";

            vdsObj.adapterType = "lsiLogic";

            ManagedObjectReference morCreateVMDK = _service.CreateVirtualDisk_Task(morVDM, SrcPath, datacenterRef, vdsObj); // morCreateVMDK is null on a cluster deployement.

            string strVM = ecb.getServiceUtilV25().WaitForTask(morCreateVMDK);

            return strVM;

        }

 

Many thanks.

 

-Yan


Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>