Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for podman-settings #522

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions endpoints/remotehosts/remotehosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"numa-node": None,
"osruntime": "podman",
"user": "root",
"podman-settings": {},
"maximum-worker-threads-count": 250
}

Expand Down Expand Up @@ -399,6 +400,7 @@ def normalize_endpoint_settings(endpoint, rickshaw):
"numa-node": endpoint_defaults["numa-node"],
"osruntime": endpoint_defaults["osruntime"],
"remote-user": endpoint_defaults["user"],
"podman-settings": endpoint_defaults["podman-settings"],
"userenv": rickshaw["userenvs"]["default"]["benchmarks"]
}

Expand Down Expand Up @@ -1021,7 +1023,7 @@ def set_total_cpu_partitions():

return 0

def create_podman(thread_name, remote_name, engine_name, container_name, connection, remote, controller_ip, role, image, cpu_partitioning, numa_node, host_mounts):
def create_podman(thread_name, remote_name, engine_name, container_name, connection, remote, controller_ip, role, image, cpu_partitioning, numa_node, host_mounts, podman_settings):
"""
Using an existing connection create a podman pod for use as a podman pod at runtime

Expand All @@ -1038,6 +1040,7 @@ def create_podman(thread_name, remote_name, engine_name, container_name, connect
cpu_partitioning (int): Whether to use cpu-partitioning for thie engine or not
numa_node (int): The NUMA node to bind this engine to
host_mounts (list): The user requested host directories to bind mount into the engine
podman-settings (dict): settings specific to only podman

Globals:
args (namespace): the script's CLI parameters
Expand Down Expand Up @@ -1100,11 +1103,18 @@ def create_podman(thread_name, remote_name, engine_name, container_name, connect
"--name=" + container_name,
"--env-file=" + remote_env_file_name,
"--privileged",
"--ipc=host",
"--pid=host",
"--net=host",
"--security-opt=label=disable" ]

if "device" in podman_settings:
create_cmd.append("--device " + podman_settings["device"])

if "shm-size" in podman_settings:
create_cmd.append("--shm-size " + podman_settings["shm-size"])
else:
create_cmd.append("--ipc=host") # only works when not using shm

for mount in mandatory_mounts + host_mounts:
if not "dest" in mount:
mount["dest"] = mount["src"]
Expand Down Expand Up @@ -1464,7 +1474,7 @@ def launch_engines_worker_thread(thread_id, work_queue, threads_rcs):
numa_node = remote["config"]["settings"]["numa-node"]
thread_logger(thread_name, "numa-node is '%s'" % (str(numa_node)), remote_name = remote_name, engine_name = engine_name)

create_podman(thread_name, remote_name, engine_name, container_name, con, remote["config"]["host"], remote["config"]["settings"]["controller-ip-address"], engine["role"], image, cpu_partitioning, numa_node, remote["config"]["settings"]["host-mounts"])
create_podman(thread_name, remote_name, engine_name, container_name, con, remote["config"]["host"], remote["config"]["settings"]["controller-ip-address"], engine["role"], image, cpu_partitioning, numa_node, remote["config"]["settings"]["host-mounts"], remote["config"]["settings"]["podman-settings"])
case "chroot":
if not "chroots" in remote:
remote["chroots"] = dict()
Expand Down
16 changes: 15 additions & 1 deletion schema/remotehosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,21 @@
"userenv": {
"type": "string",
"minLength": 1
}
},
"podman-settings": {
"type": "object",
"properties": {
"device": {
"type": "string",
"minLength": 1
},
"shm-size": {
"type": "string",
"minLength": 1
}
atheurer marked this conversation as resolved.
Show resolved Hide resolved
},
"minLength": 1
}
},
"additionalProperties": false
},
Expand Down
Loading