Returns the container ID of the specified CSI plugin container. The container ID is of the following format: - -- where and are the type and name of the CSI plugin with dots replaced by dashes, and lists the CSI services provided by the component, concatenated with dashes.
| 102 | // with dots replaced by dashes, and <list_of_services> lists the CSI services |
| 103 | // provided by the component, concatenated with dashes. |
| 104 | static ContainerID getContainerId( |
| 105 | const CSIPluginInfo& info, |
| 106 | const string& containerPrefix, |
| 107 | const CSIPluginContainerInfo& container) |
| 108 | { |
| 109 | // NOTE: We cannot simply stringify `container.services()` since it returns |
| 110 | // `RepeatedField<int>`, so we reconstruct the list of services here. |
| 111 | vector<Service> services; |
| 112 | services.reserve(container.services_size()); |
| 113 | for (int i = 0; i < container.services_size(); i++) { |
| 114 | services.push_back(container.services(i)); |
| 115 | } |
| 116 | |
| 117 | ContainerID containerId; |
| 118 | containerId.set_value( |
| 119 | containerPrefix + |
| 120 | strings::join("-", strings::replace(info.type(), ".", "-"), info.name()) + |
| 121 | "--" + strings::join("-", services)); |
| 122 | |
| 123 | return containerId; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | class ServiceManagerProcess : public Process<ServiceManagerProcess> |