private Guid getTargetClusterId(Action action) { if (action.isSetCluster() && action.getCluster().isSetId()) { return asGuid(action.getCluster().getId()); } // means use the cluster of the provided host return null; }
@Override public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); Guid clusterId = null; if (action.isSetCluster()) { clusterId = getClusterId(action); } ImportVmTemplateParameters params = new ImportVmTemplateParameters(parent.getDataCenterId(destStorageDomainId), parent.getStorageDomainId(), destStorageDomainId, clusterId, getEntity()); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); params.setForceOverride(action.isSetExclusive() ? action.isExclusive() : false); if (action.isSetClone()){ params.setImportAsNewEntity(action.isClone()); if(action.isSetTemplate() && action.getTemplate().isSetName()) { params.getVmTemplate().setName(action.getTemplate().getName()); } } return doAction(ActionType.ImportVmTemplate, params, action); }
@Override public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); Guid clusterId = null; if (action.isSetCluster()) { clusterId = getClusterId(action); } ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), clusterId); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); params.setForceOverride(action.isSetExclusive() ? action.isExclusive() : false); boolean collapseSnapshots = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, COLLAPSE_SNAPSHOTS, true, false); if (collapseSnapshots) { params.setCopyCollapse(collapseSnapshots); } setVolumesTypeFormat(action); if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if (action.isSetVm() && action.getVm().isSetName()) { params.getVm().setName(action.getVm().getName()); } } return doAction(ActionType.ImportVm, params, action); }
params.setContainerId(guid); params.setStorageDomainId(parent.getStorageDomainId()); if (action.isSetCluster()) { params.setClusterId(getClusterId(action));
@Override public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } ApproveVdsParameters params = new ApproveVdsParameters(guid); params = (ApproveVdsParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, params); // Set pk authentication as default params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.PublicKey); if (action.isSetRootPassword()) { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.Password); params.setRootPassword(action.getRootPassword()); } else if (action.isSetSsh() && action.getSsh().isSetAuthenticationMethod()) { if (action.getSsh().getAuthenticationMethod() == SshAuthenticationMethod.PASSWORD) { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.Password); if (action.getSsh().isSetUser() && action.getSsh().getUser().isSetPassword()) { params.setPassword(action.getSsh().getUser().getPassword()); } } } // by default activate the host after approval boolean activate = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, BackendHostsResource.ACTIVATE, true, true); params.setActivateHost(activate); return doAction(ActionType.ApproveVds, params, action); }
params.setContainerId(guid); params.setStorageDomainId(parent.getStorageDomainId()); if (action.isSetCluster()) { params.setClusterId(getClusterId(action));
to.setClone(from.isClone()); if (from.isSetCluster()) { to.setCluster(adaptOut(from.getCluster()));