private VcTask cloneWork(final VcDatacenter dc,
ManagedObjectReference rpMoRef, ManagedObjectReference dsMoRef,
ManagedObjectReference snapMoRef, final ManagedObjectReference folderMoRef,
ManagedObjectReference hostMoRef, boolean linked, final String name,
ConfigSpec config, final IVcTaskCallback callback) throws Exception {
final CloneSpec spec = new CloneSpecImpl();
RelocateSpec relocSpec = new RelocateSpecImpl();
relocSpec.setPool(rpMoRef);
relocSpec.setDatastore(dsMoRef);
if (hostMoRef != null) {
relocSpec.setHost(hostMoRef);
}
if (linked) {
relocSpec.setDiskMoveType("createNewChildDiskBacking");
}
spec.setLocation(relocSpec);
spec.setSnapshot(snapMoRef);
spec.setTemplate(false);
spec.setConfig(config);
VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
public VcTask body() throws Exception {
VirtualMachine vm = getManagedObject();
return new VcTask(TaskType.CloneVm,