@Test public void provision_deficit_and_deprovision_excess() { var tester = new DynamicProvisioningTester().addInitialNodes(); tester.flagSource.withListFlag(Flags.TARGET_CAPACITY.id(), List.of(new HostCapacity(24, 64, 100, 2), new HostCapacity(16, 24, 100, 1)), HostCapacity.class); assertTrue(tester.nodeRepository.getNode("host2").isPresent()); assertEquals(0 ,tester.hostProvisioner.provisionedHosts.size()); Optional<Node> failedHost = tester.nodeRepository.getNode("host2"); assertTrue(failedHost.isPresent()); tester.maintainer.maintain(); assertTrue("Failed host is deprovisioned", tester.nodeRepository.getNode(failedHost.get().hostname()).isEmpty()); assertTrue("Host with matching resources is kept", tester.nodeRepository.getNode("host3").isPresent()); NodeResources resources = new NodeResources(24, 64, 100, 1); assertEquals(2, tester.provisionedHostsMatching(resources)); }
@Override protected boolean maintain() { try (Mutex lock = nodeRepository().lockUnallocated()) { NodeList nodes = nodeRepository().list(); resumeProvisioning(nodes, lock); convergeToCapacity(nodes); } return true; }
DynamicProvisioningMaintainer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { try (Mutex lock = nodeRepository().lockUnallocated()) { NodeList nodes = nodeRepository().list(); resumeProvisioning(nodes, lock); convergeToCapacity(nodes); } return true; } }
DynamicProvisioningMaintainer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { try (Mutex lock = nodeRepository().lockUnallocated()) { NodeList nodes = nodeRepository().list(); resumeProvisioning(nodes, lock); convergeToCapacity(nodes); } return true; } DynamicProvisioningMaintainer(NodeRepository nodeRepository,
                                  Duration interval,
                                  HostProvisioner hostProvisioner,
                                  FlagSource flagSource,
                                  Metric metric); }
DynamicProvisioningMaintainer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { try (Mutex lock = nodeRepository().lockUnallocated()) { NodeList nodes = nodeRepository().list(); resumeProvisioning(nodes, lock); convergeToCapacity(nodes); } return true; } DynamicProvisioningMaintainer(NodeRepository nodeRepository,
                                  Duration interval,
                                  HostProvisioner hostProvisioner,
                                  FlagSource flagSource,
                                  Metric metric);  }
DynamicProvisioningMaintainer extends NodeRepositoryMaintainer { @Override protected boolean maintain() { try (Mutex lock = nodeRepository().lockUnallocated()) { NodeList nodes = nodeRepository().list(); resumeProvisioning(nodes, lock); convergeToCapacity(nodes); } return true; } DynamicProvisioningMaintainer(NodeRepository nodeRepository,
                                  Duration interval,
                                  HostProvisioner hostProvisioner,
                                  FlagSource flagSource,
                                  Metric metric);   }