From a80796ac72bf938b1c857c8fefcb5a11c9dea5ac Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 13 Jun 2023 17:00:53 -0700 Subject: [PATCH] daemon: added initial podman node support --- daemon/core/api/grpc/client.py | 4 +- daemon/core/api/grpc/grpcutils.py | 5 +- daemon/core/api/grpc/wrappers.py | 1 + daemon/core/emulator/broadcast.py | 10 +- daemon/core/emulator/enumerations.py | 1 + daemon/core/emulator/hooks.py | 12 +- daemon/core/emulator/session.py | 3 +- daemon/core/gui/data/icons/podman.png | Bin 0 -> 4300 bytes daemon/core/gui/dialogs/colorpicker.py | 12 +- daemon/core/gui/graph/edges.py | 4 +- daemon/core/gui/images.py | 2 + daemon/core/gui/nodeutils.py | 10 +- daemon/core/nodes/podman.py | 271 +++++++++++++++++++++++++ daemon/core/xml/corexml.py | 8 +- daemon/proto/core/api/grpc/core.proto | 2 + 15 files changed, 310 insertions(+), 35 deletions(-) create mode 100644 daemon/core/gui/data/icons/podman.png create mode 100644 daemon/core/nodes/podman.py diff --git a/daemon/core/api/grpc/client.py b/daemon/core/api/grpc/client.py index b6f6ce38..2a5a1d44 100644 --- a/daemon/core/api/grpc/client.py +++ b/daemon/core/api/grpc/client.py @@ -964,9 +964,7 @@ class CoreGrpcClient: :return: config service defaults """ request = GetConfigServiceDefaultsRequest( - name=name, - session_id=session_id, - node_id=node_id, + name=name, session_id=session_id, node_id=node_id ) response = self.stub.GetConfigServiceDefaults(request) return wrappers.ConfigServiceDefaults.from_proto(response) diff --git a/daemon/core/api/grpc/grpcutils.py b/daemon/core/api/grpc/grpcutils.py index a05a5e8f..f89144e4 100644 --- a/daemon/core/api/grpc/grpcutils.py +++ b/daemon/core/api/grpc/grpcutils.py @@ -36,6 +36,7 @@ from core.nodes.docker import DockerNode, DockerOptions from core.nodes.interface import CoreInterface from core.nodes.lxd import LxcNode, LxcOptions from core.nodes.network import CoreNetwork, CtrlNet, PtpNet, WlanNode +from core.nodes.podman import PodmanNode, PodmanOptions from core.nodes.wireless import WirelessNode from core.services.coreservices import CoreService @@ -81,7 +82,7 @@ def add_node_data( options.config_services = node_proto.config_services if isinstance(options, EmaneOptions): options.emane_model = node_proto.emane - if isinstance(options, (DockerOptions, LxcOptions)): + if isinstance(options, (DockerOptions, LxcOptions, PodmanOptions)): options.image = node_proto.image position = Position() position.set(node_proto.position.x, node_proto.position.y) @@ -313,7 +314,7 @@ def get_node_proto( if isinstance(node, EmaneNet): emane_model = node.wireless_model.name image = None - if isinstance(node, (DockerNode, LxcNode)): + if isinstance(node, (DockerNode, LxcNode, PodmanNode)): image = node.image # check for wlan config wlan_config = session.mobility.get_configs( diff --git a/daemon/core/api/grpc/wrappers.py b/daemon/core/api/grpc/wrappers.py index b7b172fe..f84e6a08 100644 --- a/daemon/core/api/grpc/wrappers.py +++ b/daemon/core/api/grpc/wrappers.py @@ -68,6 +68,7 @@ class NodeType(Enum): DOCKER = 15 LXC = 16 WIRELESS = 17 + PODMAN = 18 class LinkType(Enum): diff --git a/daemon/core/emulator/broadcast.py b/daemon/core/emulator/broadcast.py index 929144de..bf56f99d 100644 --- a/daemon/core/emulator/broadcast.py +++ b/daemon/core/emulator/broadcast.py @@ -12,15 +12,7 @@ from core.emulator.data import ( from core.errors import CoreError T = TypeVar( - "T", - bound=Union[ - EventData, - ExceptionData, - NodeData, - LinkData, - FileData, - ConfigData, - ], + "T", bound=Union[EventData, ExceptionData, NodeData, LinkData, FileData, ConfigData] ) diff --git a/daemon/core/emulator/enumerations.py b/daemon/core/emulator/enumerations.py index e04d382b..96fb919b 100644 --- a/daemon/core/emulator/enumerations.py +++ b/daemon/core/emulator/enumerations.py @@ -50,6 +50,7 @@ class NodeTypes(Enum): DOCKER = 15 LXC = 16 WIRELESS = 17 + PODMAN = 18 class LinkTypes(Enum): diff --git a/daemon/core/emulator/hooks.py b/daemon/core/emulator/hooks.py index 938d3028..ffeeafeb 100644 --- a/daemon/core/emulator/hooks.py +++ b/daemon/core/emulator/hooks.py @@ -43,7 +43,7 @@ class HookManager: state_hooks = self.script_hooks.setdefault(state, {}) if file_name in state_hooks: raise CoreError( - f"adding duplicate state({state.name}) hook script({file_name})", + f"adding duplicate state({state.name}) hook script({file_name})" ) state_hooks[file_name] = data @@ -59,7 +59,7 @@ class HookManager: if file_name not in state_hooks: raise CoreError( f"deleting state({state.name}) hook script({file_name}) " - "that does not exist", + "that does not exist" ) del state_hooks[file_name] @@ -77,7 +77,7 @@ class HookManager: if hook in hooks: name = getattr(callable, "__name__", repr(hook)) raise CoreError( - f"adding duplicate state({state.name}) hook callback({name})", + f"adding duplicate state({state.name}) hook callback({name})" ) hooks.append(hook) @@ -96,7 +96,7 @@ class HookManager: name = getattr(callable, "__name__", repr(hook)) raise CoreError( f"deleting state({state.name}) hook callback({name}) " - "that does not exist", + "that does not exist" ) hooks.remove(hook) @@ -132,7 +132,7 @@ class HookManager: except (OSError, subprocess.CalledProcessError) as e: raise CoreError( f"failure running state({state.name}) " - f"hook script({file_name}): {e}", + f"hook script({file_name}): {e}" ) for hook in self.callback_hooks.get(state, []): try: @@ -141,5 +141,5 @@ class HookManager: name = getattr(callable, "__name__", repr(hook)) raise CoreError( f"failure running state({state.name}) " - f"hook callback({name}): {e}", + f"hook callback({name}): {e}" ) diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index a33abebe..5a6557ee 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -57,6 +57,7 @@ from core.nodes.network import ( WlanNode, ) from core.nodes.physical import PhysicalNode, Rj45Node +from core.nodes.podman import PodmanNode from core.nodes.wireless import WirelessNode from core.plugins.sdt import Sdt from core.services.coreservices import CoreServices @@ -81,9 +82,9 @@ NODES: dict[NodeTypes, type[NodeBase]] = { NodeTypes.DOCKER: DockerNode, NodeTypes.LXC: LxcNode, NodeTypes.WIRELESS: WirelessNode, + NodeTypes.PODMAN: PodmanNode, } NODES_TYPE: dict[type[NodeBase], NodeTypes] = {NODES[x]: x for x in NODES} -CONTAINER_NODES: set[type[NodeBase]] = {DockerNode, LxcNode} CTRL_NET_ID: int = 9001 LINK_COLORS: list[str] = ["green", "blue", "orange", "purple", "turquoise"] NT: TypeVar = TypeVar("NT", bound=NodeBase) diff --git a/daemon/core/gui/data/icons/podman.png b/daemon/core/gui/data/icons/podman.png new file mode 100644 index 0000000000000000000000000000000000000000..771e04a0343c5b2930c68a645b326d75c52c54cb GIT binary patch literal 4300 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 tuple[tuple[float, float], tuple[float, float]]: v_x, v_y = dst_x - src_x, dst_y - src_y - v_len = math.sqrt(v_x**2 + v_y**2) + v_len = math.sqrt(v_x ** 2 + v_y ** 2) if v_len == 0: u_x, u_y = 0.0, 0.0 else: @@ -147,7 +147,7 @@ class Edge: perp_m = -1 / m b = mp_y - (perp_m * mp_x) # get arc x and y - offset = math.sqrt(self.arc**2 / (1 + (1 / m**2))) + offset = math.sqrt(self.arc ** 2 / (1 + (1 / m ** 2))) arc_x = mp_x if self.arc >= 0: arc_x += offset diff --git a/daemon/core/gui/images.py b/daemon/core/gui/images.py index b1832c1e..070137fb 100644 --- a/daemon/core/gui/images.py +++ b/daemon/core/gui/images.py @@ -78,6 +78,7 @@ class ImageEnum(Enum): EDITDELETE = "edit-delete" ANTENNA = "antenna" DOCKER = "docker" + PODMAN = "podman" LXC = "lxc" ALERT = "alert" DELETE = "delete" @@ -101,6 +102,7 @@ TYPE_MAP: dict[tuple[NodeType, str], ImageEnum] = { (NodeType.RJ45, None): ImageEnum.RJ45, (NodeType.TUNNEL, None): ImageEnum.TUNNEL, (NodeType.DOCKER, None): ImageEnum.DOCKER, + (NodeType.PODMAN, None): ImageEnum.PODMAN, (NodeType.LXC, None): ImageEnum.LXC, } diff --git a/daemon/core/gui/nodeutils.py b/daemon/core/gui/nodeutils.py index 0201aa9d..0b3e3d9a 100644 --- a/daemon/core/gui/nodeutils.py +++ b/daemon/core/gui/nodeutils.py @@ -16,8 +16,13 @@ if TYPE_CHECKING: NODES: list["NodeDraw"] = [] NETWORK_NODES: list["NodeDraw"] = [] NODE_ICONS = {} -CONTAINER_NODES: set[NodeType] = {NodeType.DEFAULT, NodeType.DOCKER, NodeType.LXC} -IMAGE_NODES: set[NodeType] = {NodeType.DOCKER, NodeType.LXC} +CONTAINER_NODES: set[NodeType] = { + NodeType.DEFAULT, + NodeType.DOCKER, + NodeType.LXC, + NodeType.PODMAN, +} +IMAGE_NODES: set[NodeType] = {NodeType.DOCKER, NodeType.LXC, NodeType.PODMAN} WIRELESS_NODES: set[NodeType] = { NodeType.WIRELESS_LAN, NodeType.EMANE, @@ -41,6 +46,7 @@ def setup() -> None: (ImageEnum.PROUTER, NodeType.DEFAULT, "PRouter", "prouter"), (ImageEnum.DOCKER, NodeType.DOCKER, "Docker", None), (ImageEnum.LXC, NodeType.LXC, "LXC", None), + (ImageEnum.PODMAN, NodeType.PODMAN, "Podman", None), ] for image_enum, node_type, label, model in nodes: node_draw = NodeDraw.from_setup(image_enum, node_type, label, model) diff --git a/daemon/core/nodes/podman.py b/daemon/core/nodes/podman.py new file mode 100644 index 00000000..00ef24fc --- /dev/null +++ b/daemon/core/nodes/podman.py @@ -0,0 +1,271 @@ +import json +import logging +import shlex +from dataclasses import dataclass, field +from pathlib import Path +from tempfile import NamedTemporaryFile +from typing import TYPE_CHECKING + +from core.emulator.distributed import DistributedServer +from core.errors import CoreCommandError, CoreError +from core.executables import BASH +from core.nodes.base import CoreNode, CoreNodeOptions + +logger = logging.getLogger(__name__) + +if TYPE_CHECKING: + from core.emulator.session import Session + +PODMAN: str = "podman" + + +@dataclass +class PodmanOptions(CoreNodeOptions): + image: str = "ubuntu" + """image used when creating container""" + binds: list[tuple[str, str]] = field(default_factory=list) + """bind mount source and destinations to setup within container""" + volumes: list[tuple[str, str, bool, bool]] = field(default_factory=list) + """ + volume mount source, destination, unique, delete to setup within container + + unique is True for node unique volume naming + delete is True for deleting volume mount during shutdown + """ + + +@dataclass +class VolumeMount: + src: str + """volume mount name""" + dst: str + """volume mount destination directory""" + unique: bool = True + """True to create a node unique prefixed name for this volume""" + delete: bool = True + """True to delete the volume during shutdown""" + path: str = None + """path to the volume on the host""" + + +class PodmanNode(CoreNode): + """ + Provides logic for creating a Podman based node. + """ + + def __init__( + self, + session: "Session", + _id: int = None, + name: str = None, + server: DistributedServer = None, + options: PodmanOptions = None, + ) -> None: + """ + Create a PodmanNode instance. + + :param session: core session instance + :param _id: node id + :param name: node name + :param server: remote server node + will run on, default is None for localhost + :param options: options for creating node + """ + options = options or PodmanOptions() + super().__init__(session, _id, name, server, options) + self.image: str = options.image + self.binds: list[tuple[str, str]] = options.binds + self.volumes: dict[str, VolumeMount] = {} + for src, dst, unique, delete in options.volumes: + src_name = self._unique_name(src) if unique else src + self.volumes[src] = VolumeMount(src_name, dst, unique, delete) + + @classmethod + def create_options(cls) -> PodmanOptions: + """ + Return default creation options, which can be used during node creation. + + :return: podman options + """ + return PodmanOptions() + + def create_cmd(self, args: str, shell: bool = False) -> str: + """ + Create command used to run commands within the context of a node. + + :param args: command arguments + :param shell: True to run shell like, False otherwise + :return: node command + """ + if shell: + args = f"{BASH} -c {shlex.quote(args)}" + return f"{PODMAN} exec {self.name} {args}" + + def _unique_name(self, name: str) -> str: + """ + Creates a session/node unique prefixed name for the provided input. + + :param name: name to make unique + :return: unique session/node prefixed name + """ + return f"{self.session.id}.{self.id}.{name}" + + def alive(self) -> bool: + """ + Check if the node is alive. + + :return: True if node is alive, False otherwise + """ + try: + running = self.host_cmd( + f"{PODMAN} inspect -f '{{{{.State.Running}}}}' {self.name}" + ) + return json.loads(running) + except CoreCommandError: + return False + + def startup(self) -> None: + """ + Create a podman container instance for the specified image. + + :return: nothing + """ + with self.lock: + if self.up: + raise CoreError(f"starting node({self.name}) that is already up") + # create node directory + self.makenodedir() + # setup commands for creating bind/volume mounts + binds = "" + for src, dst in self.binds: + binds += f"--mount type=bind,source={src},target={dst} " + volumes = "" + for volume in self.volumes.values(): + volumes += ( + f"--mount type=volume," f"source={volume.src},target={volume.dst} " + ) + # normalize hostname + hostname = self.name.replace("_", "-") + # create container and retrieve the created containers PID + self.host_cmd( + f"{PODMAN} run -td --init --net=none --hostname {hostname} " + f"--name {self.name} --sysctl net.ipv6.conf.all.disable_ipv6=0 " + f"{binds} {volumes} " + f"--privileged {self.image} tail -f /dev/null" + ) + # retrieve pid and process environment for use in nsenter commands + self.pid = self.host_cmd( + f"{PODMAN} inspect -f '{{{{.State.Pid}}}}' {self.name}" + ) + # setup symlinks for bind and volume mounts within + for src, dst in self.binds: + link_path = self.host_path(Path(dst), True) + self.host_cmd(f"ln -s {src} {link_path}") + for volume in self.volumes.values(): + volume.path = self.host_cmd( + f"{PODMAN} volume inspect -f '{{{{.Mountpoint}}}}' {volume.src}" + ) + link_path = self.host_path(Path(volume.dst), True) + self.host_cmd(f"ln -s {volume.path} {link_path}") + logger.debug("node(%s) pid: %s", self.name, self.pid) + self.up = True + + def shutdown(self) -> None: + """ + Shutdown logic. + + :return: nothing + """ + # nothing to do if node is not up + if not self.up: + return + with self.lock: + self.ifaces.clear() + self.host_cmd(f"{PODMAN} rm -f {self.name}") + for volume in self.volumes.values(): + if volume.delete: + self.host_cmd(f"{PODMAN} volume rm {volume.src}") + self.up = False + + def termcmdstring(self, sh: str = "/bin/sh") -> str: + """ + Create a terminal command string. + + :param sh: shell to execute command in + :return: str + """ + terminal = f"{PODMAN} exec -it {self.name} {sh}" + if self.server is None: + return terminal + else: + return f"ssh -X -f {self.server.host} xterm -e {terminal}" + + def create_dir(self, dir_path: Path) -> None: + """ + Create a private directory. + + :param dir_path: path to create + :return: nothing + """ + logger.debug("creating node dir: %s", dir_path) + self.cmd(f"mkdir -p {dir_path}") + + def mount(self, src_path: str, target_path: str) -> None: + """ + Create and mount a directory. + + :param src_path: source directory to mount + :param target_path: target directory to create + :return: nothing + :raises CoreCommandError: when a non-zero exit status occurs + """ + logger.debug("mounting source(%s) target(%s)", src_path, target_path) + raise Exception("not supported") + + def create_file(self, file_path: Path, contents: str, mode: int = 0o644) -> None: + """ + Create a node file with a given mode. + + :param file_path: name of file to create + :param contents: contents of file + :param mode: mode for file + :return: nothing + """ + logger.debug("node(%s) create file(%s) mode(%o)", self.name, file_path, mode) + temp = NamedTemporaryFile(delete=False) + temp.write(contents.encode()) + temp.close() + temp_path = Path(temp.name) + directory = file_path.parent + if str(directory) != ".": + self.cmd(f"mkdir -m {0o755:o} -p {directory}") + if self.server is not None: + self.server.remote_put(temp_path, temp_path) + self.host_cmd(f"{PODMAN} cp {temp_path} {self.name}:{file_path}") + self.cmd(f"chmod {mode:o} {file_path}") + if self.server is not None: + self.host_cmd(f"rm -f {temp_path}") + temp_path.unlink() + + def copy_file(self, src_path: Path, dst_path: Path, mode: int = None) -> None: + """ + Copy a file to a node, following symlinks and preserving metadata. + Change file mode if specified. + + :param dst_path: file name to copy file to + :param src_path: file to copy + :param mode: mode to copy to + :return: nothing + """ + logger.info( + "node file copy file(%s) source(%s) mode(%o)", dst_path, src_path, mode or 0 + ) + self.cmd(f"mkdir -p {dst_path.parent}") + if self.server: + temp = NamedTemporaryFile(delete=False) + temp_path = Path(temp.name) + src_path = temp_path + self.server.remote_put(src_path, temp_path) + self.host_cmd(f"{PODMAN} cp {src_path} {self.name}:{dst_path}") + if mode is not None: + self.cmd(f"chmod {mode:o} {dst_path}") diff --git a/daemon/core/xml/corexml.py b/daemon/core/xml/corexml.py index f7f9e85d..d566b501 100644 --- a/daemon/core/xml/corexml.py +++ b/daemon/core/xml/corexml.py @@ -17,6 +17,7 @@ from core.nodes.docker import DockerNode, DockerOptions from core.nodes.interface import CoreInterface from core.nodes.lxd import LxcNode, LxcOptions from core.nodes.network import CtrlNet, GreTapBridge, PtpNet, WlanNode +from core.nodes.podman import PodmanNode, PodmanOptions from core.nodes.wireless import WirelessNode from core.services.coreservices import CoreService @@ -225,6 +226,9 @@ class DeviceElement(NodeElement): elif isinstance(self.node, LxcNode): clazz = "lxc" image = self.node.image + elif isinstance(self.node, PodmanNode): + clazz = "podman" + image = self.node.image add_attribute(self.element, "class", clazz) add_attribute(self.element, "image", image) @@ -808,6 +812,8 @@ class CoreXmlReader: node_type = NodeTypes.DOCKER elif clazz == "lxc": node_type = NodeTypes.LXC + elif clazz == "podman": + node_type = NodeTypes.PODMAN _class = self.session.get_node_class(node_type) options = _class.create_options() options.icon = icon @@ -825,7 +831,7 @@ class CoreXmlReader: options.config_services.extend( x.get("name") for x in config_service_elements.iterchildren() ) - if isinstance(options, (DockerOptions, LxcOptions)): + if isinstance(options, (DockerOptions, LxcOptions, PodmanOptions)): options.image = image # get position information position_element = device_element.find("position") diff --git a/daemon/proto/core/api/grpc/core.proto b/daemon/proto/core/api/grpc/core.proto index d2f024da..09f2c764 100644 --- a/daemon/proto/core/api/grpc/core.proto +++ b/daemon/proto/core/api/grpc/core.proto @@ -545,6 +545,8 @@ message NodeType { CONTROL_NET = 13; DOCKER = 15; LXC = 16; + WIRELESS = 17; + PODMAN = 18; } }