Repository: mesos Updated Branches: refs/heads/master 79ffec9f8 -> bf67871bb
Allow framework re-registration to update master HTTP fields. Fields: 'name', 'hostname', 'failover_timeout', 'webui_url' Review: https://reviews.apache.org/r/32961 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bf67871b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bf67871b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bf67871b Branch: refs/heads/master Commit: bf67871bb7f0e356e44f2bd3722133839abe751d Parents: 79ffec9 Author: Joris Van Remoortere <[email protected]> Authored: Wed Apr 15 12:14:57 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Wed Apr 15 12:14:59 2015 -0700 ---------------------------------------------------------------------- src/master/master.cpp | 5 ++++ src/master/master.hpp | 57 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/bf67871b/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 44b0a01..6791de0 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -1844,6 +1844,11 @@ void Master::_reregisterFramework( Framework* framework = CHECK_NOTNULL(frameworks.registered[frameworkInfo.id()]); + // Update the framework's info fields based on those passed during + // re-registration. + LOG(INFO) << "Updating info for framework " << framework->id(); + framework->updateFrameworkInfo(frameworkInfo); + framework->reregisteredTime = Clock::now(); if (failover) { http://git-wip-us.apache.org/repos/asf/mesos/blob/bf67871b/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index 6141917..4a1df58 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -1097,7 +1097,62 @@ struct Framework const FrameworkID id() const { return info.id(); } - const FrameworkInfo info; + // Update fields in 'info' using those in 'source'. Currently this + // only updates 'name', 'failover_timeout', 'hostname', and + // 'webui_url'. + void updateFrameworkInfo(const FrameworkInfo& source) + { + // TODO(jmlvanre): We can't check 'FrameworkInfo.id' yet because + // of MESOS-2559. Once this is fixed we can 'CHECK' that we only + // merge 'info' from the same framework 'id'. + + // TODO(jmlvanre): Merge other fields as per design doc in + // MESOS-703. + + if (source.user() != info.user()) { + LOG(WARNING) << "Can not update FrameworkInfo.user to '" << info.user() + << "' for framework " << id() << ". Check MESOS-703"; + } + + info.set_name(source.name()); + + if (source.has_failover_timeout()) { + info.set_failover_timeout(source.failover_timeout()); + } else { + info.clear_failover_timeout(); + } + + if (source.checkpoint() != info.checkpoint()) { + LOG(WARNING) << "Can not update FrameworkInfo.checkpoint to '" + << stringify(info.checkpoint()) << "' for framework " << id() + << ". Check MESOS-703"; + } + + if (source.role() != info.role()) { + LOG(WARNING) << "Can not update FrameworkInfo.role to '" << info.role() + << "' for framework " << id() << ". Check MESOS-703"; + } + + if (source.has_hostname()) { + info.set_hostname(source.hostname()); + } else { + info.clear_hostname(); + } + + if (source.principal() != info.principal()) { + LOG(WARNING) << "Can not update FrameworkInfo.principal to '" + << info.principal() << "' for framework " << id() + << ". Check MESOS-703"; + } + + if (source.has_webui_url()) { + info.set_webui_url(source.webui_url()); + } else { + info.clear_webui_url(); + } + } + + FrameworkInfo info; process::UPID pid;
