| 421 | |
| 422 | |
| 423 | Future<Nothing> VolumeManagerProcess::attachVolume(const string& volumeId) |
| 424 | { |
| 425 | if (!volumes.contains(volumeId)) { |
| 426 | return Failure("Cannot attach unknown volume '" + volumeId + "'"); |
| 427 | } |
| 428 | |
| 429 | VolumeData& volume = volumes.at(volumeId); |
| 430 | |
| 431 | LOG(INFO) << "Attaching volume '" << volumeId << "' in " |
| 432 | << volume.state.state() << " state"; |
| 433 | |
| 434 | // Volume attaching is serialized with other operations on the same volume to |
| 435 | // avoid races. |
| 436 | return volume.sequence->add(std::function<Future<Nothing>()>( |
| 437 | process::defer(self(), &Self::_attachVolume, volumeId))); |
| 438 | } |
| 439 | |
| 440 | |
| 441 | Future<Nothing> VolumeManagerProcess::detachVolume(const string& volumeId) |