From commits-return-20023-archive-asf-public=cust-asf.ponee.io@mesos.apache.org Thu Jan 18 22:00:49 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8475C180654 for ; Thu, 18 Jan 2018 22:00:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 733E3160C2B; Thu, 18 Jan 2018 21:00:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B98A0160C26 for ; Thu, 18 Jan 2018 22:00:48 +0100 (CET) Received: (qmail 72605 invoked by uid 500); 18 Jan 2018 21:00:47 -0000 Mailing-List: contact commits-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mesos.apache.org Delivered-To: mailing list commits@mesos.apache.org Received: (qmail 72596 invoked by uid 99); 18 Jan 2018 21:00:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jan 2018 21:00:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AA601DFD7B; Thu, 18 Jan 2018 21:00:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jieyu@apache.org To: commits@mesos.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: mesos git commit: Made `GetNodeID` call depend on `PUBLISH_UNPUBLISH_VOLUME` capability. Date: Thu, 18 Jan 2018 21:00:47 +0000 (UTC) Repository: mesos Updated Branches: refs/heads/1.5.x 4b8fd0b13 -> b4b82b977 Made `GetNodeID` call depend on `PUBLISH_UNPUBLISH_VOLUME` capability. Review: https://reviews.apache.org/r/65229/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b4b82b97 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b4b82b97 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b4b82b97 Branch: refs/heads/1.5.x Commit: b4b82b977cb32474c0b5176e747e0d064c064013 Parents: 4b8fd0b Author: Chun-Hung Hsiao Authored: Thu Jan 18 12:55:17 2018 -0800 Committer: Jie Yu Committed: Thu Jan 18 13:00:41 2018 -0800 ---------------------------------------------------------------------- src/resource_provider/storage/provider.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b4b82b97/src/resource_provider/storage/provider.cpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/storage/provider.cpp b/src/resource_provider/storage/provider.cpp index 9a32204..1f30d0a 100644 --- a/src/resource_provider/storage/provider.cpp +++ b/src/resource_provider/storage/provider.cpp @@ -749,9 +749,13 @@ Future StorageLocalResourceProviderProcess::recoverServices() }))); } + // NOTE: The `GetNodeID` CSI call is only supported if the plugin has + // the `PUBLISH_UNPUBLISH_VOLUME` controller capability. So to decide + // if `GetNodeID` should be called in `prepareNodeService`, we need to + // run `prepareControllerService` first. return collect(futures) - .then(defer(self(), &Self::prepareNodeService)) - .then(defer(self(), &Self::prepareControllerService)); + .then(defer(self(), &Self::prepareControllerService)) + .then(defer(self(), &Self::prepareNodeService)); } @@ -1959,6 +1963,9 @@ Future StorageLocalResourceProviderProcess::prepareControllerService() Future StorageLocalResourceProviderProcess::prepareNodeService() { + // NOTE: This can only be called after `prepareControllerService`. + CHECK_SOME(controllerCapabilities); + return getService(nodeContainerId) .then(defer(self(), [=](csi::Client client) { // Get the plugin info and check for consistency. @@ -1995,7 +2002,11 @@ Future StorageLocalResourceProviderProcess::prepareNodeService() return getService(nodeContainerId); })); })) - .then(defer(self(), [=](csi::Client client) { + .then(defer(self(), [=](csi::Client client) -> Future { + if (!controllerCapabilities->publishUnpublishVolume) { + return Nothing(); + } + // Get the node ID. csi::GetNodeIDRequest request; request.mutable_version()->CopyFrom(csiVersion); @@ -2016,7 +2027,7 @@ Future StorageLocalResourceProviderProcess::controllerPublish( // NOTE: This can only be called after `prepareControllerService` and // `prepareNodeService`. CHECK_SOME(controllerCapabilities); - CHECK_SOME(nodeId); + CHECK(!controllerCapabilities->publishUnpublishVolume || nodeId.isSome()); CHECK(volumes.contains(volumeId)); if (volumes.at(volumeId).state.state() == @@ -2083,7 +2094,7 @@ Future StorageLocalResourceProviderProcess::controllerUnpublish( // NOTE: This can only be called after `prepareControllerService` and // `prepareNodeService`. CHECK_SOME(controllerCapabilities); - CHECK_SOME(nodeId); + CHECK(!controllerCapabilities->publishUnpublishVolume || nodeId.isSome()); CHECK(volumes.contains(volumeId)); if (volumes.at(volumeId).state.state() == @@ -2323,7 +2334,7 @@ Future StorageLocalResourceProviderProcess::deleteVolume( // NOTE: This can only be called after `prepareControllerService` and // `prepareNodeService` (since it may require `NodeUnpublishVolume`). CHECK_SOME(controllerCapabilities); - CHECK_SOME(nodeId); + CHECK(!controllerCapabilities->publishUnpublishVolume || nodeId.isSome()); // We do not need the capability for pre-existing volumes since no // actual `DeleteVolume` call will be made.