You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/09/06 19:50:35 UTC

[2/2] mesos git commit: Introduce BLOCK and RAW disk types.

Introduce BLOCK and RAW disk types.

BLOCK and RAW disk types are low-level disk resources which will need
to be transformed into e.g., volumes by dedicated, still to implement
offer operations.

Review: https://reviews.apache.org/r/58047/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/48e39a4c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/48e39a4c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/48e39a4c

Branch: refs/heads/master
Commit: 48e39a4c0da049534f9f90bc66d38b1368b1807a
Parents: 2e084bd
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Sep 6 11:17:43 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Sep 6 12:50:26 2017 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto    | 3 ++-
 include/mesos/v1/mesos.proto | 3 ++-
 src/common/resources.cpp     | 9 +++++++++
 src/slave/paths.cpp          | 2 ++
 src/slave/slave.cpp          | 2 ++
 src/v1/resources.cpp         | 9 +++++++++
 6 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index eede082..b3bf28b 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1313,12 +1313,13 @@ message Resource {
     optional Volume volume = 2;
 
     // Describes where a disk originates from.
-    // TODO(jmlvanre): Add support for BLOCK devices.
     message Source {
       enum Type {
         UNKNOWN = 0;
         PATH = 1;
         MOUNT = 2;
+        BLOCK = 3;
+        RAW = 4;
       }
 
       // A folder that can be located on a separate disk device. This

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 8c6246e..68b369e 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1296,12 +1296,13 @@ message Resource {
     optional Volume volume = 2;
 
     // Describes where a disk originates from.
-    // TODO(jmlvanre): Add support for BLOCK devices.
     message Source {
       enum Type {
         UNKNOWN = 0;
         PATH = 1;
         MOUNT = 2;
+        BLOCK = 3;
+        RAW = 4;
       }
 
       // A folder that can be located on a separate disk device. This

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 8d43889..797fc75 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -848,6 +848,11 @@ Option<Error> Resources::validate(const Resource& resource)
         case Resource::DiskInfo::Source::MOUNT:
           // `PATH` and `MOUNT` contain only `optional` members.
           break;
+        case Resource::DiskInfo::Source::BLOCK:
+        case Resource::DiskInfo::Source::RAW:
+          // TODO(bbannier): Update with validation once the exact format of
+          // `BLOCK` and `RAW` messages have taken some form.
+          break;
         case Resource::DiskInfo::Source::UNKNOWN:
           return Error(
               "Unsupported 'DiskInfo.Source.Type' in "
@@ -2141,6 +2146,10 @@ ostream& operator<<(ostream& stream, const Resource::DiskInfo::Source& source)
       return stream << "PATH"
                     << (source.path().has_root() ? ":" + source.path().root()
                                                  : "");
+    case Resource::DiskInfo::Source::BLOCK:
+      return stream << "BLOCK";
+    case Resource::DiskInfo::Source::RAW:
+      return stream << "RAW";
     case Resource::DiskInfo::Source::UNKNOWN:
       return stream << "UNKNOWN";
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/src/slave/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.cpp b/src/slave/paths.cpp
index 1a6943f..08177bc 100644
--- a/src/slave/paths.cpp
+++ b/src/slave/paths.cpp
@@ -517,6 +517,8 @@ string getPersistentVolumePath(
       CHECK(volume.disk().source().mount().has_root());
       return volume.disk().source().mount().root();
     }
+    case Resource::DiskInfo::Source::BLOCK:
+    case Resource::DiskInfo::Source::RAW:
     case Resource::DiskInfo::Source::UNKNOWN:
       LOG(FATAL) << "Unsupported DiskInfo.Source.type";
       break;

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index df920ec..6d1516a 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -531,6 +531,8 @@ void Slave::initialize()
 #endif // __linux__
         break;
       }
+      case Resource::DiskInfo::Source::BLOCK:
+      case Resource::DiskInfo::Source::RAW:
       case Resource::DiskInfo::Source::UNKNOWN: {
         EXIT(EXIT_FAILURE)
           << "Unsupported 'DiskInfo.Source.Type' in '" << resource << "'";

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e39a4c/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 508f3f8..96913b7 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -879,6 +879,11 @@ Option<Error> Resources::validate(const Resource& resource)
         case Resource::DiskInfo::Source::MOUNT:
           // `PATH` and `MOUNT` contain only `optional` members.
           break;
+        case Resource::DiskInfo::Source::BLOCK:
+        case Resource::DiskInfo::Source::RAW:
+          // TODO(bbannier): Update with validation once the exact format of
+          // `BLOCK` and `RAW` messages have taken some form.
+          break;
         case Resource::DiskInfo::Source::UNKNOWN:
           return Error(
               "Unsupported 'DiskInfo.Source.Type' in "
@@ -2170,6 +2175,10 @@ ostream& operator<<(ostream& stream, const Resource::DiskInfo::Source& source)
       return stream << "PATH"
                     << (source.path().has_root() ? ":" + source.path().root()
                                                  : "");
+    case Resource::DiskInfo::Source::BLOCK:
+      return stream << "BLOCK";
+    case Resource::DiskInfo::Source::RAW:
+      return stream << "RAW";
     case Resource::DiskInfo::Source::UNKNOWN:
       return stream << "UNKNOWN";
   }