}
}
public void redoRegistration(ManagedObjectReference morHost) throws Exception {
String vmName = getVmName();
VirtualMachineFileInfo vmFileInfo = getFileInfo();
boolean isTemplate = isTemplate();
HostMO hostMo;
if (morHost != null)
hostMo = new HostMO(getContext(), morHost);
else
hostMo = getRunningHost();
ManagedObjectReference morFolder = getParentMor();
ManagedObjectReference morPool = hostMo.getHyperHostOwnerResourcePool();
_context.getService().unregisterVM(_mor);
ManagedObjectReference morTask = _context.getService().registerVMTask(morFolder, vmFileInfo.getVmPathName(), vmName, false, morPool, hostMo.getMor());
boolean result = _context.getVimClient().waitForTask(morTask);
if (!result) {
throw new Exception("Unable to register template due to " + TaskMO.getTaskFailureInfo(_context, morTask));
} else {