This is an automated email from the ASF dual-hosted git repository. gilbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push: new 633b1b5 Renamed agent flag `--default_shm_size`. 633b1b5 is described below commit 633b1b5d4ef3f08b0abf057a3651f34116e1e45f Author: Qian Zhang <zhq527...@gmail.com> AuthorDate: Mon Jul 15 23:46:20 2019 -0700 Renamed agent flag `--default_shm_size`. Review: https://reviews.apache.org/r/71072/ --- docs/configuration/agent.md | 9 +++++---- docs/isolators/namespaces-ipc.md | 13 +++++++------ include/mesos/mesos.proto | 10 +++++----- include/mesos/v1/mesos.proto | 10 +++++----- src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp | 4 ++-- src/slave/flags.cpp | 9 +++++---- src/slave/flags.hpp | 2 +- src/tests/containerizer/isolator_tests.cpp | 6 +++--- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/docs/configuration/agent.md b/docs/configuration/agent.md index 2046bf2..325a37e 100644 --- a/docs/configuration/agent.md +++ b/docs/configuration/agent.md @@ -577,17 +577,18 @@ this role. (default: *) </td> </tr> -<tr id="default_shm_size"> +<tr id="default_container_shm_size"> <td> - --default_shm_size + --default_container_shm_size </td> <td> The default size of the /dev/shm for the container which has its own /dev/shm but does not specify the <code>shm_size</code> field in its <code>LinuxInfo</code>. The format is [number][unit], number must be a positive integer and unit can be B (bytes), KB (kilobytes), MB -(megabytes), GB (gigabytes) or TB (terabytes). This flag will be -ignored if the <code>namespaces/ipc</code> isolator is not enabled. +(megabytes), GB (gigabytes) or TB (terabytes). Note that this flag is +only relevant for the Mesos Containerizer and it will be ignored if +the <code>namespaces/ipc</code> isolator is not enabled. </td> </tr> diff --git a/docs/isolators/namespaces-ipc.md b/docs/isolators/namespaces-ipc.md index 43ed842..4c978ec 100644 --- a/docs/isolators/namespaces-ipc.md +++ b/docs/isolators/namespaces-ipc.md @@ -48,9 +48,10 @@ agent's IPC namespace and /dev/shm, the container launch will be rejected. Framework users can specify the size of a container's /dev/shm in MB by setting the `ContainerInfo.linux_info.shm_size` field, and operators can specify -the default size of /dev/shm via the agent flag `--default_shm_size`. So if the -`ContainerInfo.linux_info.shm_size` field is not set, the size of container's -/dev/shm will be value of the `--default_shm_size` agent flag, if that flag is -not set too, the size of the /dev/shm will be half of the agent host RAM -which is the default behavior of Linux. The `ContainerInfo.linux_info.shm_size` -field will be ignored for the container which shares its parent's /dev/shm. +the default size of /dev/shm via the agent flag `--default_container_shm_size`. +So if the `ContainerInfo.linux_info.shm_size` field is not set, the size of +container's /dev/shm will be value of the `--default_container_shm_size` agent +flag, if that flag is not set too, the size of the /dev/shm will be half +of the agent host RAM which is the default behavior of Linux. The +`ContainerInfo.linux_info.shm_size` field will be ignored for the container which +shares its parent's /dev/shm. diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index 324f686..075c110 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -3320,11 +3320,11 @@ message LinuxInfo { optional IpcMode ipc_mode = 6; // Size of /dev/shm in MB. If not set, the size of the /dev/shm for container - // will be value of the `--default_shm_size` agent flag, if that flag is not - // set too, the size of the /dev/shm will be half of the host RAM which is the - // default behavior of Linux. This field will be ignored for the container - // which shares /dev/shm from its parent and it will be also ignored for any - // containers if the `namespaces/ipc` isolator is not enabled. + // will be value of the `--default_container_shm_size` agent flag, if that + // flag is not set too, the size of the /dev/shm will be half of the host RAM + // which is the default behavior of Linux. This field will be ignored for the + // container which shares /dev/shm from its parent and it will be also ignored + // for any containers if the `namespaces/ipc` isolator is not enabled. optional uint32 shm_size = 7; } diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto index aa9c525..0dcaee6 100644 --- a/include/mesos/v1/mesos.proto +++ b/include/mesos/v1/mesos.proto @@ -3309,11 +3309,11 @@ message LinuxInfo { optional IpcMode ipc_mode = 6; // Size of /dev/shm in MB. If not set, the size of the /dev/shm for container - // will be value of the `--default_shm_size` agent flag, if that flag is not - // set too, the size of the /dev/shm will be half of the host RAM which is the - // default behavior of Linux. This field will be ignored for the container - // which shares /dev/shm from its parent and it will be also ignored for any - // containers if the `namespaces/ipc` isolator is not enabled. + // will be value of the `--default_container_shm_size` agent flag, if that + // flag is not set too, the size of the /dev/shm will be half of the host RAM + // which is the default behavior of Linux. This field will be ignored for the + // container which shares /dev/shm from its parent and it will be also ignored + // for any containers if the `namespaces/ipc` isolator is not enabled. optional uint32 shm_size = 7; } diff --git a/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp b/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp index 9a98476..743d48d 100644 --- a/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp +++ b/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp @@ -121,8 +121,8 @@ Future<Option<ContainerLaunchInfo>> NamespacesIPCIsolatorProcess::prepare( if (containerConfig.container_info().linux_info().has_shm_size()) { shmSize = Megabytes(containerConfig.container_info().linux_info().shm_size()); - } else if (flags.default_shm_size.isSome()) { - shmSize = flags.default_shm_size.get(); + } else if (flags.default_container_shm_size.isSome()) { + shmSize = flags.default_container_shm_size.get(); } } diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp index b4e3eb9..08ec20b 100644 --- a/src/slave/flags.cpp +++ b/src/slave/flags.cpp @@ -763,14 +763,15 @@ mesos::internal::slave::Flags::Flags() "This flag has the same syntax as `--effective_capabilities`." ); - add(&Flags::default_shm_size, - "default_shm_size", + add(&Flags::default_container_shm_size, + "default_container_shm_size", "The default size of the /dev/shm for the container which has its own\n" "/dev/shm but does not specify the `shm_size` field in its `LinuxInfo`.\n" "The format is [number][unit], number must be a positive integer and\n" "unit can be B (bytes), KB (kilobytes), MB (megabytes), GB (gigabytes)\n" - "or TB (terabytes). This flag will be ignored if the `namespaces/ipc`\n" - "isolator is not enabled." + "or TB (terabytes). Note that this flag is only relevant for the Mesos\n" + "Containerizer and it will be ignored if the `namespaces/ipc` isolator\n" + "is not enabled." ); add(&Flags::disallow_sharing_agent_ipc_namespace, diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp index a10bf69..01834f4 100644 --- a/src/slave/flags.hpp +++ b/src/slave/flags.hpp @@ -124,7 +124,7 @@ public: std::string systemd_runtime_directory; Option<CapabilityInfo> effective_capabilities; Option<CapabilityInfo> bounding_capabilities; - Option<Bytes> default_shm_size; + Option<Bytes> default_container_shm_size; bool disallow_sharing_agent_ipc_namespace; bool disallow_sharing_agent_pid_namespace; #endif diff --git a/src/tests/containerizer/isolator_tests.cpp b/src/tests/containerizer/isolator_tests.cpp index a493a30..14feaed 100644 --- a/src/tests/containerizer/isolator_tests.cpp +++ b/src/tests/containerizer/isolator_tests.cpp @@ -77,7 +77,7 @@ public: const string& isolation, const Option<bool>& disallowSharingAgentPidNamespace = None(), const Option<bool>& disallowSharingAgentIpcNamespace = None(), - const Option<Bytes>& defaultShmSize = None()) + const Option<Bytes>& defaultContainerShmSize = None()) { slave::Flags flags = CreateSlaveFlags(); flags.image_providers = "docker"; @@ -93,7 +93,7 @@ public: disallowSharingAgentIpcNamespace.get(); } - flags.default_shm_size = defaultShmSize; + flags.default_container_shm_size = defaultContainerShmSize; fetcher.reset(new Fetcher(flags)); @@ -774,7 +774,7 @@ TEST_F(NamespacesIsolatorTest, ROOT_ShareIPCNamespace) // have its own IPC namespace and /dev/shm. TEST_F(NamespacesIsolatorTest, ROOT_PrivateIPCNamespace) { - // Create containerizer with `--default_shm_size=64MB`. + // Create containerizer with `--default_container_shm_size=64MB`. Try<Owned<MesosContainerizer>> containerizer = createContainerizer( "filesystem/linux,namespaces/ipc", None(),