| 1957 | |
| 1958 | |
| 1959 | Try<vector<ResourceConversion>> |
| 1960 | StorageLocalResourceProviderProcess::applyCreate( |
| 1961 | const Offer::Operation& operation) const |
| 1962 | { |
| 1963 | CHECK(operation.has_create()); |
| 1964 | |
| 1965 | foreach (const Resource& resource, operation.create().volumes()) { |
| 1966 | CHECK(Resources::isPersistentVolume(resource)); |
| 1967 | CHECK(resource.disk().source().has_id()); |
| 1968 | |
| 1969 | // TODO(chhsiao): Support persistent BLOCK volumes. |
| 1970 | if (resource.disk().source().type() != Resource::DiskInfo::Source::MOUNT) { |
| 1971 | return Error( |
| 1972 | "Cannot create persistent volume '" + |
| 1973 | stringify(resource.disk().persistence().id()) + "' on a " + |
| 1974 | stringify(resource.disk().source().type()) + " disk"); |
| 1975 | } |
| 1976 | |
| 1977 | // TODO(chhsiao): Ideally, we could perform a sanity check to verify that |
| 1978 | // the target path is empty before creating a new persistent volume. |
| 1979 | // However, right now we cannot distinguish the case where a framework is |
| 1980 | // recreating its own persistent volume after the agent ID changes from the |
| 1981 | // case where existing data is being leaked to another framework. |
| 1982 | } |
| 1983 | |
| 1984 | return getResourceConversions(operation); |
| 1985 | } |
| 1986 | |
| 1987 | |
| 1988 | Try<vector<ResourceConversion>> |
nothing calls this directly
no test coverage detected