17 #ifndef __CSI_V1_UTILS_HPP__ 18 #define __CSI_V1_UTILS_HPP__ 20 #include <google/protobuf/message.h> 40 template <
typename Iterable>
43 foreach (
const auto& capability, capabilities) {
44 if (capability.has_service() &&
45 PluginCapability::Service::Type_IsValid(
46 capability.service().type())) {
47 switch (capability.service().type()) {
53 case PluginCapability::Service::VOLUME_ACCESSIBILITY_CONSTRAINTS:
60 case google::protobuf::kint32min:
61 case google::protobuf::kint32max:
66 if (capability.has_volume_expansion() &&
67 PluginCapability::VolumeExpansion::Type_IsValid(
68 capability.volume_expansion().type())) {
69 switch (capability.volume_expansion().type()) {
72 case PluginCapability::VolumeExpansion::ONLINE:
76 case PluginCapability::VolumeExpansion::OFFLINE:
84 case google::protobuf::kint32min:
85 case google::protobuf::kint32max:
103 template <
typename Iterable>
106 foreach (
const auto& capability, capabilities) {
107 if (capability.has_rpc() &&
108 ControllerServiceCapability::RPC::Type_IsValid(
109 capability.rpc().type())) {
110 switch (capability.rpc().type()) {
113 case ControllerServiceCapability::RPC::CREATE_DELETE_VOLUME:
114 createDeleteVolume =
true;
116 case ControllerServiceCapability::RPC::PUBLISH_UNPUBLISH_VOLUME:
117 publishUnpublishVolume =
true;
119 case ControllerServiceCapability::RPC::LIST_VOLUMES:
122 case ControllerServiceCapability::RPC::GET_CAPACITY:
125 case ControllerServiceCapability::RPC::CREATE_DELETE_SNAPSHOT:
126 createDeleteSnapshot =
true;
128 case ControllerServiceCapability::RPC::LIST_SNAPSHOTS:
129 listSnapshots =
true;
131 case ControllerServiceCapability::RPC::CLONE_VOLUME:
134 case ControllerServiceCapability::RPC::PUBLISH_READONLY:
135 publishReadonly =
true;
137 case ControllerServiceCapability::RPC::EXPAND_VOLUME:
144 case google::protobuf::kint32min:
145 case google::protobuf::kint32max:
152 bool createDeleteVolume =
false;
153 bool publishUnpublishVolume =
false;
154 bool listVolumes =
false;
155 bool getCapacity =
false;
156 bool createDeleteSnapshot =
false;
157 bool listSnapshots =
false;
158 bool cloneVolume =
false;
159 bool publishReadonly =
false;
160 bool expandVolume =
false;
168 template <
typename Iterable>
171 foreach (
const auto& capability, capabilities) {
172 if (capability.has_rpc() &&
173 NodeServiceCapability::RPC::Type_IsValid(capability.rpc().type())) {
174 switch (capability.rpc().type()) {
177 case NodeServiceCapability::RPC::STAGE_UNSTAGE_VOLUME:
178 stageUnstageVolume =
true;
180 case NodeServiceCapability::RPC::GET_VOLUME_STATS:
181 getVolumeStats =
true;
183 case NodeServiceCapability::RPC::EXPAND_VOLUME:
190 case google::protobuf::kint32min:
191 case google::protobuf::kint32max:
198 bool stageUnstageVolume =
false;
199 bool getVolumeStats =
false;
200 bool expandVolume =
false;
205 CSIVolume::VolumeCapability
devolve(
const VolumeCapability& capability);
207 google::protobuf::RepeatedPtrField<CSIVolume::VolumeCapability>
devolve(
208 const google::protobuf::RepeatedPtrField<VolumeCapability>& capabilities);
212 VolumeCapability
evolve(
const CSIVolume::VolumeCapability& capability);
214 google::protobuf::RepeatedPtrField<VolumeCapability>
evolve(
215 const google::protobuf::RepeatedPtrField<CSIVolume::VolumeCapability>&
222 #endif // __CSI_V1_UTILS_HPP__ Volume::Source::CSIVolume CSIVolume
Definition: v1_utils.hpp:33
Definition: v1_utils.hpp:99
PluginCapabilities(const Iterable &capabilities)
Definition: v1_utils.hpp:41
constexpr Service CONTROLLER_SERVICE
Definition: service_manager.hpp:40
bool volumeAccessibilityConstraints
Definition: v1_utils.hpp:93
bool volumeExpansionOnline
Definition: v1_utils.hpp:94
bool controllerService
Definition: v1_utils.hpp:92
const int UNKNOWN
Definition: diagnosis.hpp:39
CSIVolume::VolumeCapability devolve(const VolumeCapability &capability)
#define UNREACHABLE()
Definition: unreachable.hpp:22
ControllerCapabilities(const Iterable &capabilities)
Definition: v1_utils.hpp:104
PluginCapabilities()=default
Definition: v1_utils.hpp:164
VolumeCapability evolve(const CSIVolume::VolumeCapability &capability)
bool volumeExpansionOffline
Definition: v1_utils.hpp:95
NodeCapabilities(const Iterable &capabilities)
Definition: v1_utils.hpp:169
Definition: v1_utils.hpp:36