| 442 | |
| 443 | |
| 444 | Future<Nothing> VolumeManagerProcess::attachVolume(const string& volumeId) |
| 445 | { |
| 446 | if (!volumes.contains(volumeId)) { |
| 447 | return Failure("Cannot attach unknown volume '" + volumeId + "'"); |
| 448 | } |
| 449 | |
| 450 | VolumeData& volume = volumes.at(volumeId); |
| 451 | |
| 452 | LOG(INFO) << "Attaching volume '" << volumeId << "' in " |
| 453 | << volume.state.state() << " state"; |
| 454 | |
| 455 | // Volume attaching is serialized with other operations on the same volume to |
| 456 | // avoid races. |
| 457 | return volume.sequence->add(std::function<Future<Nothing>()>( |
| 458 | process::defer(self(), &Self::_attachVolume, volumeId))); |
| 459 | } |
| 460 | |
| 461 | |
| 462 | Future<Nothing> VolumeManagerProcess::detachVolume(const string& volumeId) |