| 51 | |
| 52 | |
| 53 | int MesosContainerizerMount::execute() |
| 54 | { |
| 55 | if (flags.help) { |
| 56 | cerr << flags.usage(); |
| 57 | return EXIT_SUCCESS; |
| 58 | } |
| 59 | |
| 60 | #ifdef __linux__ |
| 61 | if (flags.operation.isNone()) { |
| 62 | cerr << "Flag --operation is not specified" << endl; |
| 63 | return 1; |
| 64 | } |
| 65 | |
| 66 | if (flags.operation.get() == MAKE_RSLAVE) { |
| 67 | if (flags.path.isNone()) { |
| 68 | cerr << "Flag --path is required for " << MAKE_RSLAVE << endl; |
| 69 | return 1; |
| 70 | } |
| 71 | |
| 72 | Try<Nothing> mount = mesos::internal::fs::mount( |
| 73 | None(), |
| 74 | flags.path.get(), |
| 75 | None(), |
| 76 | MS_SLAVE | MS_REC, |
| 77 | nullptr); |
| 78 | |
| 79 | if (mount.isError()) { |
| 80 | cerr << "Failed to mark rslave with path '" << flags.path.get() << "': " |
| 81 | << mount.error(); |
| 82 | return 1; |
| 83 | } |
| 84 | } else { |
| 85 | cerr << "Unsupported mount operation '" << flags.operation.get() << "'"; |
| 86 | return 1; |
| 87 | } |
| 88 | |
| 89 | return 0; |
| 90 | #else |
| 91 | cerr << "Mount is only supported on Linux"; |
| 92 | |
| 93 | return 1; |
| 94 | #endif // __linux__ |
| 95 | } |
| 96 | |
| 97 | } // namespace slave { |
| 98 | } // namespace internal { |