final String logId;
if (res.getGroupId() != null) {
logId = Lager.groupid(res.getGroupId());
} else {
final IdempotentInstance instance = instances.get(0);
logId = Lager.id(instance.getID());
}
logger.info(logId + " idempotent creation request already fulfilled");
InstanceResource[] resources = new InstanceResource[instances.size()];
int index = 0;
for (IdempotentInstance instance : instances) {
if (instance == null) {
throw new CreationException("Idempotent reservation has null instance");
}
InstanceResource resource;
try {
resource = this.whome.find(instance.getID());
if (resource == null) {
throw new CreationException("Existing idempotent instance was null (?)");
}
// these parameter checks can only be performed against a running
// instance.
this.checkIdempotentInstanceForMismatch(resource, req, logId);
} catch (DoesNotExistException e) {
logger.debug("Idempotent reservation request has a terminated instance");
final VirtualMachine vm = new VirtualMachine();
vm.setNetwork("NONE");
final VirtualMachineDeployment deployment = new VirtualMachineDeployment();
vm.setDeployment(deployment);
resource = new IdempotentInstanceResource(instance.getID(),
instance.getName(), null, res.getGroupId(), instances.size(),
instance.getLaunchIndex(), res.getCreatorId(), vm,
WorkspaceConstants.STATE_DESTROYING, res.getClientToken());
}
if (resource.getName() == null) {
if (req.getName() != null) {