Maintenance Primitives: Added maintenance-related, registry protobufs.
New protobufs:
* MachineID - Describes a single box that holds one or more agents.
* MachineIDs - A list of boxes.
* MachineInfo - Holds a box and some extra information about its status.
* MachineInfo::Mode - An enum for the three states of a machine: UP,
DRAINING, DOWN.
* maintenance::Window - A set of machines and a planned downtime period.
* maintenance::Schedule - A set of maintenance windows.
Review: https://reviews.apache.org/r/36571
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/50344bca
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/50344bca
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/50344bca
Branch: refs/heads/master
Commit: 50344bcaea8b462c1bb096ba46b1d1401b26ba3a
Parents: 7d7f42f
Author: Joseph Wu <[email protected]>
Authored: Sun Aug 30 13:55:10 2015 -0400
Committer: Joris Van Remoortere <[email protected]>
Committed: Mon Aug 31 13:09:26 2015 -0400
----------------------------------------------------------------------
include/mesos/maintenance/maintenance.hpp | 25 +++++++++
include/mesos/maintenance/maintenance.proto | 67 ++++++++++++++++++++++++
include/mesos/mesos.proto | 59 +++++++++++++++++++++
include/mesos/v1/mesos.proto | 59 +++++++++++++++++++++
src/Makefile.am | 20 +++++++
src/master/registry.proto | 27 ++++++++++
6 files changed, 257 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/include/mesos/maintenance/maintenance.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/maintenance/maintenance.hpp
b/include/mesos/maintenance/maintenance.hpp
new file mode 100644
index 0000000..7fec3ff
--- /dev/null
+++ b/include/mesos/maintenance/maintenance.hpp
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAINTENANCE_PROTO_HPP__
+#define __MAINTENANCE_PROTO_HPP__
+
+// ONLY USEFUL AFTER RUNNING PROTOC.
+#include <mesos/maintenance/maintenance.pb.h>
+
+#endif // __MAINTENANCE_PROTO_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/include/mesos/maintenance/maintenance.proto
----------------------------------------------------------------------
diff --git a/include/mesos/maintenance/maintenance.proto
b/include/mesos/maintenance/maintenance.proto
new file mode 100644
index 0000000..ba28d0f
--- /dev/null
+++ b/include/mesos/maintenance/maintenance.proto
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import "mesos/mesos.proto";
+
+package mesos.maintenance;
+
+option java_package = "org.apache.mesos.maintenance";
+option java_outer_classname = "Protos";
+
+// This is an illustration of a maintenance `Schedule`:
+//
+// This is a `Window`.
+// Machine ^ |
+// ... | v
+// 12 | +----------------+
+// 11 | | |
+// 10 | +----------------+
+// 9 | +----------------+
+// 8 | | |
+// 7 | +----------------+
+// 6 | +----------------+
+// 5 | | |
+// 4 | +----------------+
+// 3 | +-----------+
+// 2 | | |
+// 1 | +-----------+
+// |
+// +-----------------------------------------------------~~~~->
+// Downtime for maintenance
+
+
+/**
+ * A set of machines scheduled to go into maintenance
+ * in the same `unavailability`.
+ */
+message Window {
+ // Machines affected by this maintenance window.
+ repeated MachineID machine_ids = 1;
+
+ // Interval during which this set of machines is expected to be down.
+ required Unavailability unavailability = 2;
+}
+
+
+/**
+ * A list of maintenance windows.
+ * For example, this may represent a rolling restart of agents.
+ */
+message Schedule {
+ repeated Window windows = 1;
+}
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 1e07159..b1deed4 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -155,6 +155,65 @@ message Unavailability {
/**
+ * Represents a single machine, which may hold one or more slaves.
+ *
+ * NOTE: In order to match a slave to a machine, both the `hostname` and
+ * `ip` must match the values advertised by the slave to the master.
+ * Hostname is not case-sensitive.
+ */
+message MachineID {
+ optional string hostname = 1;
+ optional string ip = 2;
+}
+
+
+/**
+ * A list of machines.
+ *
+ * TODO(josephw): Remove this when https://reviews.apache.org/r/37826/
+ * is submitted.
+ */
+message MachineIDs {
+ repeated MachineID values = 1;
+}
+
+
+/**
+ * Holds information about a single machine, its `mode`, and any other
+ * relevant information which may affect the behavior of the machine.
+ */
+message MachineInfo {
+ // Describes the several states that a machine can be in. A `Mode`
+ // applies to a machine and to all associated slaves on the machine.
+ enum Mode {
+ // In this mode, a machine is behaving normally;
+ // offering resources, executing tasks, etc.
+ UP = 1;
+
+ // In this mode, all slaves on the machine are expected to cooperate with
+ // frameworks to drain resources. In general, draining is done ahead of
+ // a pending `unavailability`. The resources should be drained so as to
+ // maximize utilization prior to the maintenance but without knowingly
+ // violating the frameworks' requirements.
+ DRAINING = 2;
+
+ // In this mode, a machine is not running any tasks and will not offer
+ // any of its resources. Slaves on the machine will not be allowed to
+ // register with the master.
+ DOWN = 3;
+ }
+
+ required MachineID id = 1;
+ optional Mode mode = 2;
+
+ // Signifies that the machine may be unavailable during the given interval.
+ // See comments in `Unavailability` and for the `unavailability` fields
+ // in `Offer` and `InverseOffer` for more information.
+ optional Unavailability unavailability = 3;
+}
+
+
+/**
* Describes a framework.
*/
message FrameworkInfo {
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 3ac1582..fdd678b 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -155,6 +155,65 @@ message Unavailability {
/**
+ * Represents a single machine, which may hold one or more agents.
+ *
+ * NOTE: In order to match an agent to a machine, both the `hostname` and
+ * `ip` must match the values advertised by the agent to the master.
+ * Hostname is not case-sensitive.
+ */
+message MachineID {
+ optional string hostname = 1;
+ optional string ip = 2;
+}
+
+
+/**
+ * A list of machines.
+ *
+ * TODO(josephw): Remove this when https://reviews.apache.org/r/37826/
+ * is submitted.
+ */
+message MachineIDs {
+ repeated MachineID values = 1;
+}
+
+
+/**
+ * Holds information about a single machine, its `mode`, and any other
+ * relevant information which may affect the behavior of the machine.
+ */
+message MachineInfo {
+ // Describes the several states that a machine can be in. A `Mode`
+ // applies to a machine and to all associated agents on the machine.
+ enum Mode {
+ // In this mode, a machine is behaving normally;
+ // offering resources, executing tasks, etc.
+ UP = 1;
+
+ // In this mode, all agents on the machine are expected to cooperate with
+ // frameworks to drain resources. In general, draining is done ahead of
+ // a pending `unavailability`. The resources should be drained so as to
+ // maximize utilization prior to the maintenance but without knowingly
+ // violating the frameworks' requirements.
+ DRAINING = 2;
+
+ // In this mode, a machine is not running any tasks and will not offer
+ // any of its resources. agents on the machine will not be allowed to
+ // register with the master.
+ DOWN = 3;
+ }
+
+ required MachineID id = 1;
+ optional Mode mode = 2;
+
+ // Signifies that the machine may be unavailable during the given interval.
+ // See comments in `Unavailability` and for the `unavailability` fields
+ // in `Offer` and `InverseOffer` for more information.
+ optional Unavailability unavailability = 3;
+}
+
+
+/**
* Describes a framework.
*/
message FrameworkInfo {
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b620ff..3ea3c8d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,6 +153,9 @@ EXECUTOR_PROTO =
\
FETCHER_PROTO =
\
$(top_srcdir)/include/mesos/fetcher/fetcher.proto
+MAINTENANCE_PROTO = \
+ $(top_srcdir)/include/mesos/maintenance/maintenance.proto
+
ALLOCATOR_PROTO = \
$(top_srcdir)/include/mesos/master/allocator.proto
@@ -184,6 +187,8 @@ CXX_PROTOS =
\
../include/mesos/executor/executor.pb.h \
fetcher/fetcher.pb.cc
\
../include/mesos/fetcher/fetcher.pb.h
\
+ maintenance/maintenance.pb.cc
\
+ ../include/mesos/maintenance/maintenance.pb.h
\
master/allocator.pb.cc \
../include/mesos/master/allocator.pb.h \
module/module.pb.cc \
@@ -278,6 +283,12 @@ fetcher/%.pb.cc ../include/mesos/fetcher/%.pb.h:
$(FETCHER_PROTO)
$(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
mv ../include/mesos/fetcher/*.pb.cc $(@D)
+maintenance/%.pb.cc ../include/mesos/maintenance/%.pb.h: $(MAINTENANCE_PROTO)
+ $(MKDIR_P) $(@D)
+ $(MKDIR_P) ../include/mesos/maintenance
+ $(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
+ mv ../include/mesos/maintenance/*.pb.cc $(@D)
+
master/%.pb.cc ../include/mesos/master/%.pb.h: $(ALLOCATOR_PROTO)
$(MKDIR_P) $(@D)
$(MKDIR_P) ../include/mesos/master
@@ -538,6 +549,14 @@ fetcher_HEADERS =
\
nodist_fetcher_HEADERS = ../include/mesos/fetcher/fetcher.pb.h
+maintenancedir = $(pkgincludedir)/maintenance
+
+maintenance_HEADERS = \
+ $(top_srcdir)/include/mesos/maintenance/maintenance.hpp \
+ $(top_srcdir)/include/mesos/maintenance/maintenance.proto
+
+nodist_maintenance_HEADERS = ../include/mesos/maintenance/maintenance.pb.h
+
masterdir = $(pkgincludedir)/master
master_HEADERS = \
@@ -896,6 +915,7 @@ libmesos_la_SOURCES =
\
$(ALLOCATOR_PROTO) \
$(CONTAINERIZER_PROTO) \
$(FETCHER_PROTO) \
+ $(MAINTENANCE_PROTO) \
$(MESOS_PROTO) \
$(MODULE_PROTO) \
$(SCHEDULER_PROTO) \
http://git-wip-us.apache.org/repos/asf/mesos/blob/50344bca/src/master/registry.proto
----------------------------------------------------------------------
diff --git a/src/master/registry.proto b/src/master/registry.proto
index a1995e5..f5de77f 100644
--- a/src/master/registry.proto
+++ b/src/master/registry.proto
@@ -17,10 +17,19 @@
*/
import "mesos/mesos.proto";
+import "mesos/maintenance/maintenance.proto";
package mesos.internal;
+/**
+ * A top level object that is managed by the Registrar and persisted in a
+ * replicated log. This object is recovered upon master startup and failover.
+ */
message Registry {
+ // NOTE: This object defines wrappers around existing objects in case
+ // the Registry wishes to store more information about the wrapped objects
+ // in the future.
+
message Master {
required MasterInfo info = 1;
}
@@ -33,9 +42,27 @@ message Registry {
repeated Slave slaves = 1;
}
+ message Machine {
+ required MachineInfo info = 1;
+ }
+
+ message Machines {
+ repeated Machine machines = 1;
+ }
+
// Most recent leading master.
optional Master master = 1;
// All admitted slaves.
optional Slaves slaves = 2;
+
+ // Holds a list of machines and some status information about each.
+ // See comments in `MachineInfo` for more information.
+ optional Machines machines = 3;
+
+ // Describes a schedule for taking down specific machines for maintenance.
+ // The schedule is meant to give hints to frameworks about potential
+ // unavailability of resources. The `schedules` are related to the status
+ // information found in `machines`.
+ repeated maintenance.Schedule schedules = 4;
}