You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/06/20 22:47:57 UTC

[1/3] mesos git commit: Added validation logic for UUID's.

Repository: mesos
Updated Branches:
  refs/heads/master 67825e8e6 -> e3a825a5c


Added validation logic for UUID's.

This change adds validation logic to `UUID::fromBytes()` for uuids.
The modified return type of this function is now `Try<UUID>`.

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


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

Branch: refs/heads/master
Commit: 4912a714f18f77db50a92c7871303bd7daaf3cc6
Parents: 67825e8
Author: Deshna Jain <de...@gmail.com>
Authored: Mon Jun 20 15:46:56 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Jun 20 15:46:56 2016 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/uuid.hpp | 15 ++++++++++++++-
 3rdparty/stout/tests/uuid_tests.cpp   | 12 +++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4912a714/3rdparty/stout/include/stout/uuid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/uuid.hpp b/3rdparty/stout/include/stout/uuid.hpp
index cde3bdb..a57896c 100644
--- a/3rdparty/stout/include/stout/uuid.hpp
+++ b/3rdparty/stout/include/stout/uuid.hpp
@@ -22,7 +22,9 @@
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
 
+#include <stout/error.hpp>
 #include <stout/thread_local.hpp>
+#include <stout/try.hpp>
 
 #ifdef __WINDOWS__
 #include <stout/windows.hpp>
@@ -49,10 +51,21 @@ public:
     return UUID((*generator)());
   }
 
-  static UUID fromBytes(const std::string& s)
+  static Try<UUID> fromBytes(const std::string& s)
   {
+    const std::string error = "Not a valid UUID";
+
+    if (s.size() != UUID::static_size()) {
+      return Error(error);
+    }
+
     boost::uuids::uuid uuid;
     memcpy(&uuid, s.data(), s.size());
+
+    if (uuid.version() == UUID::version_unknown) {
+      return Error(error);
+    }
+
     return UUID(uuid);
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/4912a714/3rdparty/stout/tests/uuid_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/uuid_tests.cpp b/3rdparty/stout/tests/uuid_tests.cpp
index 50295ad..b061b82 100644
--- a/3rdparty/stout/tests/uuid_tests.cpp
+++ b/3rdparty/stout/tests/uuid_tests.cpp
@@ -16,6 +16,8 @@
 
 #include <gmock/gmock.h>
 
+#include <stout/check.hpp>
+#include <stout/gtest.hpp>
 #include <stout/uuid.hpp>
 
 using std::string;
@@ -24,7 +26,7 @@ using std::string;
 TEST(UUIDTest, Test)
 {
   UUID uuid1 = UUID::random();
-  UUID uuid2 = UUID::fromBytes(uuid1.toBytes());
+  UUID uuid2 = UUID::fromBytes(uuid1.toBytes()).get();
   UUID uuid3 = uuid2;
 
   EXPECT_EQ(uuid1, uuid2);
@@ -47,3 +49,11 @@ TEST(UUIDTest, Test)
   EXPECT_EQ(string2, string3);
   EXPECT_EQ(string1, string3);
 }
+
+
+TEST(UUIDTest, MalformedUUID)
+{
+  EXPECT_SOME(UUID::fromBytes(UUID::random().toBytes()));
+  EXPECT_ERROR(UUID::fromBytes("malformed-uuid"));
+  EXPECT_ERROR(UUID::fromBytes("invalidstringmsg"));
+}


[3/3] mesos git commit: Added validation for UUID's to master/agent validation helpers.

Posted by vi...@apache.org.
Added validation for UUID's to master/agent validation helpers.

This change adds logic to the master/agent validation helpers
to see if the status update acknowledgments have a valid UUID
set conforming to one of the supported versions.

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


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

Branch: refs/heads/master
Commit: e3a825a5c172fb75227909b964db924543c83f75
Parents: d260aeb
Author: Deshna Jain <de...@gmail.com>
Authored: Mon Jun 20 15:47:09 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Jun 20 15:47:09 2016 -0700

----------------------------------------------------------------------
 src/master/validation.cpp              |  8 ++-
 src/slave/validation.cpp               |  6 ++
 src/tests/scheduler_http_api_tests.cpp | 87 +++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e3a825a5/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 7f139fb..9120b71 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -301,11 +301,17 @@ Option<Error> validate(
       }
       return None();
 
-    case mesos::scheduler::Call::ACKNOWLEDGE:
+    case mesos::scheduler::Call::ACKNOWLEDGE: {
       if (!call.has_acknowledge()) {
         return Error("Expecting 'acknowledge' to be present");
       }
+
+      Try<UUID> uuid = UUID::fromBytes(call.acknowledge().uuid());
+      if (uuid.isError()) {
+        return uuid.error();
+      }
       return None();
+    }
 
     case mesos::scheduler::Call::RECONCILE:
       if (!call.has_reconcile()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/e3a825a5/src/slave/validation.cpp
----------------------------------------------------------------------
diff --git a/src/slave/validation.cpp b/src/slave/validation.cpp
index 86e95a2..610829e 100644
--- a/src/slave/validation.cpp
+++ b/src/slave/validation.cpp
@@ -19,6 +19,7 @@
 #include <mesos/agent/agent.hpp>
 
 #include <stout/unreachable.hpp>
+#include <stout/uuid.hpp>
 
 #include "slave/validation.hpp"
 
@@ -142,6 +143,11 @@ Option<Error> validate(const mesos::executor::Call& call)
         return Error("Expecting 'uuid' to be present");
       }
 
+      Try<UUID> uuid = UUID::fromBytes(status.uuid()).get();
+      if (uuid.isError()) {
+        return uuid.error();
+      }
+
       if (status.has_executor_id() &&
           status.executor_id().value()
           != call.executor_id().value()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/e3a825a5/src/tests/scheduler_http_api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_http_api_tests.cpp b/src/tests/scheduler_http_api_tests.cpp
index c12205f..80a2ef0 100644
--- a/src/tests/scheduler_http_api_tests.cpp
+++ b/src/tests/scheduler_http_api_tests.cpp
@@ -935,6 +935,93 @@ TEST_P(SchedulerHttpApiTest, TeardownWrongStreamId)
   }
 }
 
+
+// This test verifies that the scheduler will receive a `BadRequest` response
+// when it tries to acknowledge a status update with a malformed UUID.
+TEST_P(SchedulerHttpApiTest, MalformedUUID)
+{
+  Try<Owned<cluster::Master>> master = StartMaster();
+  ASSERT_SOME(master);
+
+  // Retrieve the parameter passed as content type to this test.
+  const string contentType = GetParam();
+
+  process::http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
+  headers["Accept"] = contentType;
+  v1::FrameworkID frameworkId;
+  string streamId;
+
+  // Subscribe once to get a valid stream ID.
+  {
+    Call call;
+    call.set_type(Call::SUBSCRIBE);
+
+    Call::Subscribe* subscribe = call.mutable_subscribe();
+    subscribe->mutable_framework_info()->CopyFrom(DEFAULT_V1_FRAMEWORK_INFO);
+
+    Future<Response> response = process::http::streaming::post(
+        master.get()->pid,
+        "api/v1/scheduler",
+        headers,
+        serialize(call, contentType),
+        contentType);
+
+    AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+    ASSERT_EQ(Response::PIPE, response.get().type);
+    ASSERT_TRUE(response.get().headers.contains("Mesos-Stream-Id"));
+
+    streamId = response.get().headers.at("Mesos-Stream-Id");
+
+    Option<Pipe::Reader> reader = response.get().reader;
+    ASSERT_SOME(reader);
+
+    auto deserializer = lambda::bind(
+        &SchedulerHttpApiTest::deserialize, this, contentType, lambda::_1);
+
+    Reader<Event> responseDecoder(Decoder<Event>(deserializer), reader.get());
+
+    Future<Result<Event>> event = responseDecoder.read();
+    AWAIT_READY(event);
+    ASSERT_SOME(event.get());
+
+    // Check that the event type is subscribed and the framework ID is set.
+    ASSERT_EQ(Event::SUBSCRIBED, event.get().get().type());
+
+    frameworkId = event.get().get().subscribed().framework_id();
+    EXPECT_NE("", frameworkId.value());
+  }
+
+  // Make an acknowledge call with a malformed UUID. This should result in a
+  // `BadResponse`.
+  {
+    headers["Mesos-Stream-Id"] = streamId;
+
+    Call call;
+    call.set_type(Call::ACKNOWLEDGE);
+
+    // Set the framework ID in the subscribe call.
+    call.mutable_framework_id()->CopyFrom(frameworkId);
+
+    Call::Acknowledge* acknowledge = call.mutable_acknowledge();
+    acknowledge->mutable_task_id()->set_value("task-id");
+    acknowledge->mutable_agent_id()->set_value("agent-id");
+
+    // Set a malformed uuid.
+    acknowledge->set_uuid("bad-uuid");
+
+    Future<Response> response = process::http::post(
+        master.get()->pid,
+        "api/v1/scheduler",
+        headers,
+        serialize(call, contentType),
+        contentType);
+
+    AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
+    AWAIT_EXPECT_RESPONSE_BODY_EQ(
+        "Failed to validate scheduler::Call: Not a valid UUID", response);
+  }
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {


[2/3] mesos git commit: Fixed all source files affected by the `fromBytes()` change.

Posted by vi...@apache.org.
Fixed all source files affected by the `fromBytes()` change.

This change fixes all occurrences in the existing code
of `fromBytes()` that needed revisiting after the return
type has been changed to a `Try`.

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


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

Branch: refs/heads/master
Commit: d260aeb7c5f0feae167d22d4af484324f68ca449
Parents: 4912a71
Author: Deshna Jain <de...@gmail.com>
Authored: Mon Jun 20 15:47:00 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Jun 20 15:47:00 2016 -0700

----------------------------------------------------------------------
 include/mesos/state/state.hpp        |  2 +-
 src/examples/long_lived_executor.cpp |  2 +-
 src/examples/test_http_executor.cpp  |  2 +-
 src/exec/exec.cpp                    |  9 +++++---
 src/launcher/executor.cpp            |  2 +-
 src/master/master.cpp                | 37 +++++++++++++++++++++++--------
 src/messages/messages.cpp            |  3 ++-
 src/slave/slave.cpp                  |  6 ++---
 src/slave/state.cpp                  |  2 +-
 src/slave/status_update_manager.cpp  | 15 +++++++------
 src/state/in_memory.cpp              |  6 +++--
 src/state/leveldb.cpp                |  6 ++---
 src/state/log.cpp                    |  6 ++---
 src/state/zookeeper.cpp              |  5 +++--
 src/tests/slave_recovery_tests.cpp   |  2 +-
 15 files changed, 66 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/include/mesos/state/state.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/state/state.hpp b/include/mesos/state/state.hpp
index f2fddee..1117253 100644
--- a/include/mesos/state/state.hpp
+++ b/include/mesos/state/state.hpp
@@ -152,7 +152,7 @@ inline process::Future<Variable> State::_fetch(
 inline process::Future<Option<Variable>> State::store(const Variable& variable)
 {
   // Note that we try and swap an entry even if the value didn't change!
-  UUID uuid = UUID::fromBytes(variable.entry.uuid());
+  UUID uuid = UUID::fromBytes(variable.entry.uuid()).get();
 
   // Create a new entry to replace the existing entry provided the
   // UUID matches.

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/examples/long_lived_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_executor.cpp b/src/examples/long_lived_executor.cpp
index 770aae2..5c1fde1 100644
--- a/src/examples/long_lived_executor.cpp
+++ b/src/examples/long_lived_executor.cpp
@@ -113,7 +113,7 @@ protected:
 
         case Event::ACKNOWLEDGED: {
           // Remove the corresponding update.
-          updates.erase(UUID::fromBytes(event.acknowledged().uuid()));
+          updates.erase(UUID::fromBytes(event.acknowledged().uuid()).get());
 
           // Remove the corresponding task.
           tasks.erase(event.acknowledged().task_id());

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/examples/test_http_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_executor.cpp b/src/examples/test_http_executor.cpp
index 1a04b75..19d0f68 100644
--- a/src/examples/test_http_executor.cpp
+++ b/src/examples/test_http_executor.cpp
@@ -167,7 +167,7 @@ public:
           cout << "Received an ACKNOWLEDGED event" << endl;
 
           // Remove the corresponding update.
-          updates.erase(UUID::fromBytes(event.acknowledged().uuid()));
+          updates.erase(UUID::fromBytes(event.acknowledged().uuid()).get());
 
           // Remove the corresponding task.
           tasks.erase(event.acknowledged().task_id());

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/exec/exec.cpp
----------------------------------------------------------------------
diff --git a/src/exec/exec.cpp b/src/exec/exec.cpp
index f78e8b6..90a16a9 100644
--- a/src/exec/exec.cpp
+++ b/src/exec/exec.cpp
@@ -358,20 +358,23 @@ protected:
       const TaskID& taskId,
       const string& uuid)
   {
+    Try<UUID> uuid_ = UUID::fromBytes(uuid);
+    CHECK_SOME(uuid_);
+
     if (aborted.load()) {
       VLOG(1) << "Ignoring status update acknowledgement "
-              << UUID::fromBytes(uuid) << " for task " << taskId
+              << uuid_.get() << " for task " << taskId
               << " of framework " << frameworkId
               << " because the driver is aborted!";
       return;
     }
 
     VLOG(1) << "Executor received status update acknowledgement "
-            << UUID::fromBytes(uuid) << " for task " << taskId
+            << uuid_.get() << " for task " << taskId
             << " of framework " << frameworkId;
 
     // Remove the corresponding update.
-    updates.erase(UUID::fromBytes(uuid));
+    updates.erase(uuid_.get());
 
     // Remove the corresponding task.
     tasks.erase(taskId);

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index 877b0fd..939a165 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -215,7 +215,7 @@ public:
 
         case Event::ACKNOWLEDGED: {
           // Remove the corresponding update.
-          updates.erase(UUID::fromBytes(event.acknowledged().uuid()));
+          updates.erase(UUID::fromBytes(event.acknowledged().uuid()).get());
 
           // Remove the corresponding task.
           task = None();

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 1971e9b..dead0ee 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2166,9 +2166,16 @@ void Master::receive(
       shutdown(framework, call.shutdown());
       break;
 
-    case scheduler::Call::ACKNOWLEDGE:
+    case scheduler::Call::ACKNOWLEDGE: {
+      Try<UUID> uuid = UUID::fromBytes(call.acknowledge().uuid());
+      if (uuid.isError()) {
+        drop(from, call, uuid.error());
+        return;
+      }
+
       acknowledge(framework, call.acknowledge());
       break;
+    }
 
     case scheduler::Call::RECONCILE:
       reconcile(framework, call.reconcile());
@@ -4301,22 +4308,34 @@ void Master::statusUpdateAcknowledgement(
   // important as validation logic is moved out of the scheduler
   // driver and into the master.
 
+  Try<UUID> uuid_ = UUID::fromBytes(uuid);
+  if (uuid_.isError()) {
+    LOG(WARNING)
+      << "Ignoring status update acknowledgement "
+      << " for task " << taskId << " of framework " << frameworkId
+      << " on agent " << slaveId << " due to: " << uuid_.error();
+    metrics->invalid_status_update_acknowledgements++;
+    return;
+  }
+
   Framework* framework = getFramework(frameworkId);
 
   if (framework == nullptr) {
     LOG(WARNING)
-      << "Ignoring status update acknowledgement " << UUID::fromBytes(uuid)
-      << " for task " << taskId << " of framework " << frameworkId
-      << " on agent " << slaveId << " because the framework cannot be found";
+      << "Ignoring status update acknowledgement "
+      << uuid_.get() << " for task " << taskId << " of framework "
+      << frameworkId << " on agent " << slaveId << " because the framework "
+      << "cannot be found";
     metrics->invalid_status_update_acknowledgements++;
     return;
   }
 
   if (framework->pid != from) {
     LOG(WARNING)
-      << "Ignoring status update acknowledgement " << UUID::fromBytes(uuid)
-      << " for task " << taskId << " of framework " << *framework
-      << " on agent " << slaveId << " because it is not expected from " << from;
+      << "Ignoring status update acknowledgement "
+      << uuid_.get() << " for task " << taskId << " of framework "
+      << *framework << " on agent " << slaveId << " because it is not "
+      << "expected from " << from;
     metrics->invalid_status_update_acknowledgements++;
     return;
   }
@@ -4340,7 +4359,7 @@ void Master::acknowledge(
 
   const SlaveID& slaveId = acknowledge.slave_id();
   const TaskID& taskId = acknowledge.task_id();
-  const UUID uuid = UUID::fromBytes(acknowledge.uuid());
+  const UUID uuid = UUID::fromBytes(acknowledge.uuid()).get();
 
   Slave* slave = slaves.registered.get(slaveId);
 
@@ -4392,7 +4411,7 @@ void Master::acknowledge(
 
     // Remove the task once the terminal update is acknowledged.
     if (protobuf::isTerminalState(task->status_update_state()) &&
-        UUID::fromBytes(task->status_update_uuid()) == uuid) {
+        UUID::fromBytes(task->status_update_uuid()).get() == uuid) {
       removeTask(task);
      }
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/messages/messages.cpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.cpp b/src/messages/messages.cpp
index 9274b1b..7f1da63 100644
--- a/src/messages/messages.cpp
+++ b/src/messages/messages.cpp
@@ -31,7 +31,8 @@ ostream& operator<<(ostream& stream, const StatusUpdate& update)
   stream << update.status().state();
 
   if (update.has_uuid()) {
-    stream << " (UUID: " << stringify(UUID::fromBytes(update.uuid())) << ")";
+    stream << " (UUID: " << stringify(UUID::fromBytes(update.uuid()).get())
+           << ")";
   }
 
   stream << " for task " << update.status().task_id();

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 4bf01f2..8890907 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -2625,13 +2625,13 @@ void Slave::statusUpdateAcknowledgement(
   }
 
   statusUpdateManager->acknowledgement(
-      taskId, frameworkId, UUID::fromBytes(uuid))
+      taskId, frameworkId, UUID::fromBytes(uuid).get())
     .onAny(defer(self(),
                  &Slave::_statusUpdateAcknowledgement,
                  lambda::_1,
                  taskId,
                  frameworkId,
-                 UUID::fromBytes(uuid)));
+                 UUID::fromBytes(uuid).get()));
 }
 
 
@@ -6194,7 +6194,7 @@ void Executor::recoverTask(const TaskState& state)
         << "Expecting updates without 'uuid' to have been rejected";
 
       // If the terminal update has been acknowledged, remove it.
-      if (state.acks.contains(UUID::fromBytes(update.uuid()))) {
+      if (state.acks.contains(UUID::fromBytes(update.uuid()).get())) {
         completeTask(state.id);
       }
       break;

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index 04c3d42..9cec086 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -638,7 +638,7 @@ Try<TaskState> TaskState::recover(
     if (record.get().type() == StatusUpdateRecord::UPDATE) {
       state.updates.push_back(record.get().update());
     } else {
-      state.acks.insert(UUID::fromBytes(record.get().uuid()));
+      state.acks.insert(UUID::fromBytes(record.get().uuid()).get());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/slave/status_update_manager.cpp
----------------------------------------------------------------------
diff --git a/src/slave/status_update_manager.cpp b/src/slave/status_update_manager.cpp
index 0e9891c..5caa2aa 100644
--- a/src/slave/status_update_manager.cpp
+++ b/src/slave/status_update_manager.cpp
@@ -716,7 +716,7 @@ Try<bool> StatusUpdateStream::update(const StatusUpdate& update)
   // Check that this status update has not already been acknowledged.
   // This could happen in the rare case when the slave received the ACK
   // from the framework, died, but slave's ACK to the executor never made it!
-  if (acknowledged.contains(UUID::fromBytes(update.uuid()))) {
+  if (acknowledged.contains(UUID::fromBytes(update.uuid()).get())) {
     LOG(WARNING) << "Ignoring status update " << update
                  << " that has already been acknowledged by the framework!";
     return false;
@@ -725,7 +725,7 @@ Try<bool> StatusUpdateStream::update(const StatusUpdate& update)
   // Check that this update hasn't already been received.
   // This could happen if the slave receives a status update from an executor,
   // then crashes after it writes it to disk but before it sends an ack.
-  if (received.contains(UUID::fromBytes(update.uuid()))) {
+  if (received.contains(UUID::fromBytes(update.uuid()).get())) {
     LOG(WARNING) << "Ignoring duplicate status update " << update;
     return false;
   }
@@ -758,9 +758,10 @@ Try<bool> StatusUpdateStream::acknowledgement(
 
   // This might happen if we retried a status update and got back
   // acknowledgments for both the original and the retried update.
-  if (uuid != UUID::fromBytes(update.uuid())) {
+  if (uuid != UUID::fromBytes(update.uuid()).get()) {
     LOG(WARNING) << "Unexpected status update acknowledgement (received "
-                 << uuid << ", expecting " << UUID::fromBytes(update.uuid())
+                 << uuid << ", expecting "
+                 << UUID::fromBytes(update.uuid()).get()
                  << ") for update " << update;
     return false;
   }
@@ -804,7 +805,7 @@ Try<Nothing> StatusUpdateStream::replay(
     _handle(update, StatusUpdateRecord::UPDATE);
 
     // Check if the update has an ACK too.
-    if (acks.contains(UUID::fromBytes(update.uuid()))) {
+    if (acks.contains(UUID::fromBytes(update.uuid()).get())) {
       _handle(update, StatusUpdateRecord::ACK);
     }
   }
@@ -857,13 +858,13 @@ void StatusUpdateStream::_handle(
 
   if (type == StatusUpdateRecord::UPDATE) {
     // Record this update.
-    received.insert(UUID::fromBytes(update.uuid()));
+    received.insert(UUID::fromBytes(update.uuid()).get());
 
     // Add it to the pending updates queue.
     pending.push(update);
   } else {
     // Record this ACK.
-    acknowledged.insert(UUID::fromBytes(update.uuid()));
+    acknowledged.insert(UUID::fromBytes(update.uuid()).get());
 
     // Remove the corresponding update from the pending queue.
     pending.pop();

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/state/in_memory.cpp
----------------------------------------------------------------------
diff --git a/src/state/in_memory.cpp b/src/state/in_memory.cpp
index c50f46d..c16637d 100644
--- a/src/state/in_memory.cpp
+++ b/src/state/in_memory.cpp
@@ -52,7 +52,8 @@ public:
   {
     const Option<Entry>& option = entries.get(entry.name());
 
-    if (option.isSome() && UUID::fromBytes(option.get().uuid()) != uuid) {
+    if (option.isSome() &&
+        UUID::fromBytes(option.get().uuid()).get() != uuid) {
       return false;
     }
 
@@ -68,7 +69,8 @@ public:
       return false;
     }
 
-    if (UUID::fromBytes(option.get().uuid()) != UUID::fromBytes(entry.uuid())) {
+    if (UUID::fromBytes(option.get().uuid()).get() !=
+        UUID::fromBytes(entry.uuid()).get()) {
       return false;
     }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/state/leveldb.cpp
----------------------------------------------------------------------
diff --git a/src/state/leveldb.cpp b/src/state/leveldb.cpp
index 6cd8655..7f8a1d2 100644
--- a/src/state/leveldb.cpp
+++ b/src/state/leveldb.cpp
@@ -159,7 +159,7 @@ Future<bool> LevelDBStorageProcess::set(const Entry& entry, const UUID& uuid)
   }
 
   if (option.get().isSome()) {
-    if (UUID::fromBytes(option.get().get().uuid()) != uuid) {
+    if (UUID::fromBytes(option.get().get().uuid()).get() != uuid) {
       return false;
     }
   }
@@ -197,8 +197,8 @@ Future<bool> LevelDBStorageProcess::expunge(const Entry& entry)
     return false;
   }
 
-  if (UUID::fromBytes(option.get().get().uuid()) !=
-      UUID::fromBytes(entry.uuid())) {
+  if (UUID::fromBytes(option.get().get().uuid()).get() !=
+      UUID::fromBytes(entry.uuid()).get()) {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/state/log.cpp
----------------------------------------------------------------------
diff --git a/src/state/log.cpp b/src/state/log.cpp
index 2a55913..1513c2a 100644
--- a/src/state/log.cpp
+++ b/src/state/log.cpp
@@ -484,7 +484,7 @@ Future<bool> LogStorageProcess::__set(
 
   // Check the version first (if we've already got a snapshot).
   if (snapshot.isSome() &&
-      UUID::fromBytes(snapshot.get().entry.uuid()) != uuid) {
+      UUID::fromBytes(snapshot.get().entry.uuid()).get() != uuid) {
     return false;
   }
 
@@ -604,8 +604,8 @@ Future<bool> LogStorageProcess::__expunge(const Entry& entry)
   }
 
   // Check the version first.
-  if (UUID::fromBytes(snapshot.get().entry.uuid()) !=
-      UUID::fromBytes(entry.uuid())) {
+  if (UUID::fromBytes(snapshot.get().entry.uuid()).get() !=
+      UUID::fromBytes(entry.uuid()).get()) {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/state/zookeeper.cpp
----------------------------------------------------------------------
diff --git a/src/state/zookeeper.cpp b/src/state/zookeeper.cpp
index 1ba700e..9b37204 100644
--- a/src/state/zookeeper.cpp
+++ b/src/state/zookeeper.cpp
@@ -551,7 +551,7 @@ Result<bool> ZooKeeperStorageProcess::doSet(const Entry& entry,
     return Error("Failed to deserialize Entry");
   }
 
-  if (UUID::fromBytes(current.uuid()) != uuid) {
+  if (UUID::fromBytes(current.uuid()).get() != uuid) {
     return false;
   }
 
@@ -602,7 +602,8 @@ Result<bool> ZooKeeperStorageProcess::doExpunge(const Entry& entry)
     return Error("Failed to deserialize Entry");
   }
 
-  if (UUID::fromBytes(current.uuid()) != UUID::fromBytes(entry.uuid())) {
+  if (UUID::fromBytes(current.uuid()).get() !=
+      UUID::fromBytes(entry.uuid()).get()) {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d260aeb7/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 2238355..e6e7b8e 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -320,7 +320,7 @@ TYPED_TEST(SlaveRecoveryTest, RecoverSlaveState)
         .tasks[task.task_id()]
         .updates.front().uuid());
 
-  const UUID& uuid = UUID::fromBytes(ack.get().acknowledge().uuid());
+  const UUID uuid = UUID::fromBytes(ack.get().acknowledge().uuid()).get();
   ASSERT_TRUE(state
                 .frameworks[frameworkId]
                 .executors[executorId]