Unmount all persistent volumes that are no longer present.
| 468 | #ifdef __linux__ |
| 469 | // Unmount all persistent volumes that are no longer present. |
| 470 | foreach (const Resource& resource, current.persistentVolumes()) { |
| 471 | // This is enforced by the master. |
| 472 | CHECK(resource.disk().has_volume()); |
| 473 | |
| 474 | // Ignore absolute and nested paths. |
| 475 | const string& containerPath = resource.disk().volume().container_path(); |
| 476 | if (strings::contains(containerPath, "/")) { |
| 477 | LOG(WARNING) << "Skipping updating mount for persistent volume " |
| 478 | << resource << " of container " << containerId |
| 479 | << " because the container path '" << containerPath |
| 480 | << "' contains slash"; |
| 481 | continue; |
| 482 | } |
| 483 | |
| 484 | if (updated.contains(resource)) { |
| 485 | continue; |
| 486 | } |
| 487 | |
| 488 | const string target = path::join( |
| 489 | directory, resource.disk().volume().container_path()); |
| 490 | |
| 491 | Try<Nothing> unmount = fs::unmount(target); |
| 492 | if (unmount.isError()) { |
| 493 | return Error("Failed to unmount persistent volume at '" + target + |
| 494 | "': " + unmount.error()); |
| 495 | } |
| 496 | |
| 497 | // TODO(tnachen): Remove mount point after unmounting. This requires |
| 498 | // making sure the work directory is marked as a shared mount. For |
| 499 | // more details please refer to MESOS-3483. |
| 500 | } |
| 501 | |
| 502 | // Get user and group info for this task based on the sandbox directory. |
| 503 | struct stat s; |
no test coverage detected