@Override public boolean isServiceInstance(Instance instance) { return instance.getDeploymentUnitUuid() != null; }
protected void addInstanceToDeploymentUnits(Map<String, List<Instance>> deploymentUnitInstancesToUpgrade, Instance instance) { List<Instance> toRemove = deploymentUnitInstancesToUpgrade.get(instance.getDeploymentUnitUuid()); if (toRemove == null) { toRemove = new ArrayList<>(); } toRemove.add(instance); deploymentUnitInstancesToUpgrade.put(instance.getDeploymentUnitUuid(), toRemove); }
protected List<Instance> getInstancesToAllocate(Instance instance) { if (instance.getDeploymentUnitUuid() != null) { return allocatorDao.getUnmappedDeploymentUnitInstances(instance.getDeploymentUnitUuid()); } else { List<Instance> instances = new ArrayList<>(); instances.add(instance); return instances; } }
public Condition getInstanceHostConstraint(Instance instance) { if (StringUtils.isEmpty(instance.getDeploymentUnitUuid())) { return INSTANCE_HOST_MAP.INSTANCE_ID.eq(instance.getId()); } else { return INSTANCE.DEPLOYMENT_UNIT_UUID.eq(instance.getDeploymentUnitUuid()); } }
@Override public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance) state.getResource(); if (instance.getDeploymentUnitUuid() == null) { return null; } List<Instance> dependants = objectManager.find(Instance.class, INSTANCE.REMOVED, null, INSTANCE.DEPLOYMENT_UNIT_UUID, instance.getDeploymentUnitUuid(), INSTANCE.NETWORK_CONTAINER_ID, instance.getId()); if (dependants.isEmpty()) { return null; } List<String> invalidStates = Arrays.asList(CommonStatesConstants.REMOVING, InstanceConstants.STATE_ERROR, InstanceConstants.STATE_ERRORING, InstanceConstants.STATE_STOPPING, InstanceConstants.STATE_STOPPED); for (Instance dependant : dependants) { if (!invalidStates.contains(dependant.getState())) { objectProcessManager.scheduleProcessInstance(InstanceConstants.PROCESS_STOP, dependant, null); } } return null; } }
protected void waitForDeploymentUnitCreate(Instance instance) { if(StringUtils.isEmpty(instance.getDeploymentUnitUuid())) { return; instanceDao.findUnallocatedInstanceByDeploymentUnitUuid(instance.getAccountId(), instance.getDeploymentUnitUuid());
protected LockDefinition getInstanceLockDef(Instance origInstance, List<Instance> instances, Set<Long> volumeIds) { List<LockDefinition> locks = allocationHelper.extractAllocationLockDefinitions(origInstance, instances); if (origInstance.getDeploymentUnitUuid() != null) { locks.add(new AllocateConstraintLock(AllocateConstraintLock.Type.DEPLOYMENT_UNIT, origInstance.getDeploymentUnitUuid()));
setStartCount(from.getStartCount()); setCreateIndex(from.getCreateIndex()); setDeploymentUnitUuid(from.getDeploymentUnitUuid()); setVersion(from.getVersion()); setHealthUpdated(from.getHealthUpdated());