| 1181 | |
| 1182 | |
| 1183 | Future<vector<ResourceConversion>> |
| 1184 | StorageLocalResourceProviderProcess::getStoragePools() |
| 1185 | { |
| 1186 | CHECK(info.has_id()); |
| 1187 | |
| 1188 | vector<Future<Resource>> futures; |
| 1189 | |
| 1190 | foreachpair (const string& profile, |
| 1191 | const DiskProfileAdaptor::ProfileInfo& profileInfo, |
| 1192 | profileInfos) { |
| 1193 | futures.push_back( |
| 1194 | volumeManager->getCapacity( |
| 1195 | profileInfo.capability, profileInfo.parameters) |
| 1196 | .then(std::bind( |
| 1197 | &createRawDiskResource, |
| 1198 | info, |
| 1199 | lambda::_1, |
| 1200 | profile, |
| 1201 | vendor, |
| 1202 | None(), |
| 1203 | None()))); |
| 1204 | } |
| 1205 | |
| 1206 | return collect(futures) |
| 1207 | .then(defer(self(), [=](const vector<Resource>& resources) { |
| 1208 | Resources discovered(resources); // Zero resources will be ignored. |
| 1209 | Resources checkpointed = |
| 1210 | totalResources.filter([](const Resource& resource) { |
| 1211 | return Resources::isDisk(resource, Resource::DiskInfo::Source::RAW) && |
| 1212 | !resource.disk().source().has_id(); |
| 1213 | }); |
| 1214 | |
| 1215 | return vector<ResourceConversion>{ |
| 1216 | computeConversion(std::move(checkpointed), std::move(discovered))}; |
| 1217 | })); |
| 1218 | } |
| 1219 | |
| 1220 | |
| 1221 | void StorageLocalResourceProviderProcess::watchProfiles() |