Skip to content

Commit

Permalink
Merge pull request #522 from perftool-incubator/rhs-podman-settings
Browse files Browse the repository at this point in the history
Add support for podman-settings
  • Loading branch information
atheurer authored Jul 20, 2024
2 parents c7c8d7f + a363e6d commit f48a593
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
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
}
},
"minLength": 1
}
},
"additionalProperties": false
},
Expand Down

0 comments on commit f48a593

Please sign in to comment.