Skip to content

Instantly share code, notes, and snippets.

@sagar8192
Created August 11, 2017 06:19
Show Gist options
  • Save sagar8192/42ca055720549c5ff3067b1e6c7c68b3 to your computer and use it in GitHub Desktop.
Save sagar8192/42ca055720549c5ff3067b1e6c7c68b3 to your computer and use it in GitHub Desktop.
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 959091c..beaa56f 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -4412,10 +4412,14 @@ Future<Response> Master::Http::___updateMaintenanceSchedule(
// having it in two places results in more conditionals to handle.
if (unavailabilities.contains(id)) {
if (master->machines[id].info.mode() == MachineInfo::UP) {
+ LOG(WARNING) << "(sagarp):This machine is already up: "
+ << id;
continue;
}
master->updateUnavailability(id, unavailabilities[id]);
+ LOG(WARNING) << "(sagarp):Updating unavailability of the machine: "
+ << id;
continue;
}
@@ -4423,6 +4427,8 @@ Future<Response> Master::Http::___updateMaintenanceSchedule(
// unavailability.
master->machines[id].info.set_mode(MachineInfo::UP);
master->updateUnavailability(id, None());
+ LOG(WARNING) << "(sagarp):Transitioning the removed machine back to UP:"
+ << id;
}
// Save each new machine, with the unavailability
@@ -4435,6 +4441,7 @@ Future<Response> Master::Http::___updateMaintenanceSchedule(
}
MachineInfo info;
+
info.mutable_id()->CopyFrom(id);
info.set_mode(MachineInfo::DRAINING);
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 7f38a5e..ebd0502 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -6770,9 +6770,10 @@ void Master::updateUnavailability(
// Remove and rescind offers since we want to inform frameworks of the
// unavailability change as soon as possible.
foreach (Offer* offer, utils::copy(slave->offers)) {
+ LOG(INFO) << "(sagarp) Rescinding offers for slave " << *slave;
allocator->recoverResources(
offer->framework_id(), slave->id, offer->resources(), None());
-
+ LOG(INFO) << "(sagarp) Rescinding offer " << offer;
removeOffer(offer, true); // Rescind!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment