| 1066 | |
| 1067 | |
| 1068 | void HierarchicalAllocatorProcess::removeSlave( |
| 1069 | const SlaveID& slaveId) |
| 1070 | { |
| 1071 | CHECK(initialized); |
| 1072 | |
| 1073 | { |
| 1074 | const Slave& slave = *CHECK_NOTNONE(getSlave(slaveId)); |
| 1075 | |
| 1076 | // untrackAllocatedResources() potentially removes allocation roles, thus |
| 1077 | // we need to untrack actually allocated resources in the roles tree first. |
| 1078 | roleTree.untrackAllocated(slaveId, slave.totalAllocated); |
| 1079 | |
| 1080 | // Untrack resources in roleTree and sorter. |
| 1081 | foreachpair ( |
| 1082 | const FrameworkID& frameworkId, |
| 1083 | const Resources& resources, |
| 1084 | slave.getOfferedOrAllocated()) { |
| 1085 | untrackAllocatedResources(slaveId, frameworkId, resources); |
| 1086 | } |
| 1087 | |
| 1088 | roleSorter->removeSlave(slaveId); |
| 1089 | |
| 1090 | foreachvalue (const Owned<Sorter>& sorter, frameworkSorters) { |
| 1091 | sorter->removeSlave(slaveId); |
| 1092 | } |
| 1093 | |
| 1094 | roleTree.untrackReservations(slave.getTotal().reserved()); |
| 1095 | |
| 1096 | const ResourceQuantities agentScalarQuantities = |
| 1097 | ResourceQuantities::fromScalarResources(slave.getTotal().scalars()); |
| 1098 | |
| 1099 | CHECK_CONTAINS(totalScalarQuantities, agentScalarQuantities); |
| 1100 | totalScalarQuantities -= agentScalarQuantities; |
| 1101 | } |
| 1102 | |
| 1103 | slaves.erase(slaveId); |
| 1104 | allocationCandidates.erase(slaveId); |
| 1105 | |
| 1106 | removeFilters(slaveId); |
| 1107 | |
| 1108 | LOG(INFO) << "Removed agent " << slaveId; |
| 1109 | } |
| 1110 | |
| 1111 | |
| 1112 | void HierarchicalAllocatorProcess::updateSlave( |
no test coverage detected