protected boolean namedCluster(VmPool pool) { return pool.getCluster().isSetName() && !pool.getCluster().isSetId(); }
protected boolean namedCluster(Vm vm) { return vm.isSetCluster() && vm.getCluster().isSetName() && !vm.getCluster().isSetId(); }
protected boolean namedCluster(Template template) { return template.isSetCluster() && template.getCluster().isSetName() && !template.getCluster().isSetId(); }
private Guid getClusterId(Host host) { if (host.isSetCluster()) { org.ovirt.engine.api.model.Cluster cluster = host.getCluster(); if (cluster.isSetId()) { return asGuid(cluster.getId()); } if (cluster.isSetName()) { return getClusterIdByName(cluster.getName()); } } return getClusterIdByName(DEFAULT_NAME); }
@Override public Vm update(Vm incoming) { validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); if(!clusterId.toString().equals(get().getCluster().getId())){
@Override public Host update(Host incoming) { QueryIdResolver<Guid> hostResolver = new QueryIdResolver<>(QueryType.GetVdsByVdsId, IdQueryParameters.class); VDS entity = getEntity(hostResolver, true); BackendExternalProviderHelper.completeExternalNetworkProviderConfigurations(this, incoming.getExternalNetworkProviderConfigurations()); // if fence agents list is null set it to null in entity if(incoming.getAgents() == null) { entity.setFenceAgents(null); } if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); if (!clusterId.equals(entity.getClusterId())) { performAction(ActionType.ChangeVDSCluster, new ChangeVDSClusterParameters(clusterId, guid)); // After changing the cluster with the specialized command we need to reload the entity, so that it // contains the new cluster id. If we don't do this the next command will think that we are trying // to change the cluster, and it will explicitly refuse to perform the update. entity = getEntity(hostResolver, true); } } Host host = performUpdate(incoming, entity, map(entity), hostResolver, ActionType.UpdateVds, new UpdateParametersProvider()); return host; }
@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); }
if (model.getCluster().isSetId()) { entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId())); } else if (model.getCluster().isSetName()) { entity.setClusterName(model.getCluster().getName());
entity.setId(GuidUtils.asGuid(model.getId())); if (model.isSetName()) { entity.setName(model.getName());
to.setMigration(adaptOut(from.getMigration())); if (from.isSetName()) { to.setName(from.getName());