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.