Apache Mesos
|
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::DiskInfo::Source
into fields that a Container Storage Interface (CSI) plugin can potentially understand.
More...
#include <disk_profile_adaptor.hpp>
Classes | |
struct | ProfileInfo |
Public Member Functions | |
virtual | ~DiskProfileAdaptor () |
virtual process::Future< ProfileInfo > | translate (const std::string &profile, const ResourceProviderInfo &resourceProviderInfo)=0 |
Returns the CSI volume capability and the parameters to create CSI volumes associated with the profile. More... | |
virtual process::Future< hashset< std::string > > | watch (const hashset< std::string > &knownProfiles, const ResourceProviderInfo &resourceProviderInfo)=0 |
Returns a future that will be satisifed iff the set of profiles known by the module differs from the knownProfiles parameter. More... | |
Static Public Member Functions | |
static Try< DiskProfileAdaptor * > | create (const Option< std::string > &name=None()) |
Factory method used to create a DiskProfileAdaptor instance. More... | |
static void | setAdaptor (const std::shared_ptr< DiskProfileAdaptor > &adaptor) |
Global methods for setting and getting a DiskProfileAdaptor instance. More... | |
static std::shared_ptr< DiskProfileAdaptor > | getAdaptor () |
Protected Member Functions | |
DiskProfileAdaptor () | |
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::DiskInfo::Source
into fields that a Container Storage Interface (CSI) plugin can potentially understand.
This affects the following CSI requests:
This module is not intended to interact with any CSI plugins directly.
Documentation for each of the CSI requests can be found at: https://github.com/container-storage-interface/spec/
|
inlinevirtual |
|
inlineprotected |
|
static |
Factory method used to create a DiskProfileAdaptor instance.
If the name
parameter is provided, the module is instantiated using the ModuleManager
. Otherwise, a "default" disk profile adaptor instance (defined in src/resource_provider/disk_profile_adaptor.cpp
) is returned.
NOTE: The lifecycle of the returned object is delegated to the caller.
|
static |
|
static |
Global methods for setting and getting a DiskProfileAdaptor instance.
The agent (or test) is expected to create and set the adaptor instance and manage the pointer (this method will only keep a weak pointer). Each component that needs to use the DiskProfileAdaptor, such as the Storage Local Resource Provider, should call getAdaptor
.
|
pure virtual |
Returns the CSI volume capability and the parameters to create CSI volumes associated with the profile.
This method is expected to return a Failure if a matching profile cannot be found or retrieved. The caller should not proceed with any of the affected CSI requests if this method returns a failure.
The resourceProviderInfo
parameter is the ResourceProviderInfo
of the storage resource provider. This module may choose to filter results based on the type and name of the resource provider, or based on the type of the CSI plugin.
NOTE: This module assumes that profiles are immutable after creation. Changing the CSI volume capability or parameters of a profile after creation may result in undefined behavior from the storage resource provider.
Implemented in mesos::internal::storage::UriDiskProfileAdaptor.
|
pure virtual |
Returns a future that will be satisifed iff the set of profiles known by the module differs from the knownProfiles
parameter.
The resourceProviderInfo
parameter is the ResourceProviderInfo
of the storage resource provider. This module may choose to filter results based on the type and name of the resource provider, or based on the type of the CSI plugin.
NOTE: It is highly recommended for the module to insert a random delay between discovering a different set of profiles and satisfying this future, because the storage resource provider is expected to update the set of offered resources based on this future. Adding a random delay may prevent a thundering herd of resource updates to the Mesos master.
Implemented in mesos::internal::storage::UriDiskProfileAdaptor.