You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/11/02 15:02:11 UTC
[mesos] branch master updated: Fixed a GetContainers crash when
using XFS disk isolation.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 5d9b8ed Fixed a GetContainers crash when using XFS disk isolation.
5d9b8ed is described below
commit 5d9b8ed5b7b0aac4ea09bf7c6fcf4cec60d09655
Author: James Peach <jp...@apache.org>
AuthorDate: Fri Nov 2 08:01:44 2018 -0700
Fixed a GetContainers crash when using XFS disk isolation.
Since the XFS disk isolator didn't check that the persistent volume
has a `DiskInfo::Source` before populating the corresponding field
in the `ResourceStatistics` message. This caused the JSON conversion
(triggered by operator API calls) to check fail. The fix is to simply
check that the volume has a `DiskInfo::Source` before propagating it.
Review: https://reviews.apache.org/r/69233/
---
src/slave/containerizer/mesos/isolators/xfs/disk.cpp | 6 +++++-
src/tests/containerizer/xfs_quota_tests.cpp | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/slave/containerizer/mesos/isolators/xfs/disk.cpp b/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
index 44b7d05..646330c 100644
--- a/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/xfs/disk.cpp
@@ -657,7 +657,11 @@ Future<ResourceStatistics> XfsDiskIsolatorProcess::usage(
if (pathInfo.disk.isSome()) {
disk = statistics.add_disk_statistics();
disk->mutable_persistence()->CopyFrom(pathInfo.disk->persistence());
- disk->mutable_source()->CopyFrom(pathInfo.disk->source());
+
+ // Root disk volumes don't have a source.
+ if (pathInfo.disk->has_source()) {
+ disk->mutable_source()->CopyFrom(pathInfo.disk->source());
+ }
}
// We don't require XFS on MOUNT disks, but we still want the isolator
diff --git a/src/tests/containerizer/xfs_quota_tests.cpp b/src/tests/containerizer/xfs_quota_tests.cpp
index b2f977f..96cd40d 100644
--- a/src/tests/containerizer/xfs_quota_tests.cpp
+++ b/src/tests/containerizer/xfs_quota_tests.cpp
@@ -26,6 +26,8 @@
#include <mesos/mesos.hpp>
#include <mesos/resources.hpp>
+#include <mesos/v1/mesos.hpp>
+
#include <process/gtest.hpp>
#include <process/pid.hpp>
@@ -33,6 +35,7 @@
#include <stout/gtest.hpp>
#include <stout/os.hpp>
#include <stout/path.hpp>
+#include <stout/protobuf.hpp>
#include "common/values.hpp"
@@ -1103,6 +1106,11 @@ TEST_F(ROOT_XFS_QuotaTest, ResourceStatistics)
ASSERT_FALSE(timeout.expired());
+ // Verify that we can round-trip the ResourceStatistics through a JSON
+ // conversion. The v1 operator API depends on this conversion.
+ EXPECT_SOME(::protobuf::parse<mesos::v1::ResourceStatistics>(
+ JSON::protobuf(usage.get())));
+
const string volumePath =
getPersistentVolumePath(flags.work_dir, DEFAULT_TEST_ROLE, "id1");