Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

vSphere SDK createScheduledTask problems in java

$
0
0

Hi,

 

I am trying to use vsphere sdk 6 to create scheduled task to unmap datastore, here is the code:

 

sc: ServiceContent

hostStorageSystem: HostStorageSystem

vmfsUuid: String (the vmfsUuid of a specific datastore)

 

ManagedObjectReference scheduledTaskManager = sc.getScheduledTaskManager();  // get the scheduledTaskManager

 

//set methodAction
MethodAction methodAction = new MethodAction();

methodAction.setName("UnmapVmfsVolumeEx_Task");

List<MethodActionArgument> arguments = methodAction.getArgument();

MethodActionArgument arg0 = new MethodActionArgument();

MethodActionArgument arg1 = new MethodActionArgument();

List<String> uuidList = new ArrayList<String>();    

uuidList.add(vmfsUuid);

arg0.setValue(uuidList);

arguments.add(arg0);

 

//set taskScheduler
OnceTaskScheduler taskScheduler = new OnceTaskScheduler();

 

//set scheduledTaskSpec

ScheduledTaskSpec taskSpec = new ScheduledTaskInfo();

taskSpec.setName("ScheduledUnmapTask");

taskSpec.setDescription("scheduled task to unmap a datastore");

taskSpec.setEnabled(true);

taskSpec.setAction(methodAction);

taskSpec.setScheduler(taskScheduler);

  _vimPort.createObjectScheduledTask(scheduledTaskManager, hostStorageSystem, taskSpec);

 

 

for the unmapVmfsVolumEx_task, I need to pass the a list containing vmfsuuids. But there are problem with arraylist type.

 

Anyone can help to solve the problem. Not sure whether there are other problems of the above code.


Viewing all articles
Browse latest Browse all 1577

Trending Articles



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