diff --git a/README.org b/README.org index 5d21f54..21c71cf 100644 --- a/README.org +++ b/README.org @@ -46,15 +46,16 @@ module: labn-munet-config | +--rw new-window? boolean | +--rw top-level? boolean +--rw kinds* [name] + | +--rw merge* string | +--rw ip* string | +--rw ipv6* string - | +--rw merge* string | +--rw cap-add* string | +--rw cap-remove* string | +--rw cmd? string | +--rw cmd-file? string | +--rw cleanup-cmd? string | +--rw ready-cmd? string + | +--rw ready-timeout? uint32 | +--rw image? string | +--rw hostnet? boolean | +--rw server? string @@ -63,26 +64,27 @@ module: labn-munet-config | +--rw ssh-user? string | +--rw ssh-password? string | +--rw qemu - | | +--rw bios? string - | | +--rw cloud-init? boolean - | | +--rw cloud-init-disk? string - | | +--rw disk? string - | | +--rw disk-driver? string - | | +--rw disk-template? string - | | +--rw initial-cmd? string - | | +--rw initial-cmd-file? string - | | +--rw kernel? string - | | +--rw initrd? string - | | +--rw kvm? boolean - | | +--rw ncpu? uint32 - | | +--rw memory? string - | | +--rw root? string - | | +--rw cmdline-extra? string - | | +--rw extra-args? string + | | +--rw bios? string + | | +--rw cloud-init? boolean + | | +--rw cloud-init-disk? string + | | +--rw disk? string + | | +--rw disk-driver? string + | | +--rw disk-template? string + | | +--rw initial-cmd? string + | | +--rw initial-cmd-file? string + | | +--rw kernel? string + | | +--rw initrd? string + | | +--rw kvm? boolean + | | +--rw ncpu? uint32 + | | +--rw memory? string + | | +--rw root? string + | | +--rw cmdline-extra? string + | | +--rw extra-args? string | | +--rw console | | +--rw user? string | | +--rw password? string | | +--rw initial-password? string + | | +--rw prompt? string | | +--rw expects* string | | +--rw sends* string | | +--rw timeout? uint32 @@ -114,7 +116,7 @@ module: labn-munet-config | +--rw mounts* [destination] | | +--rw destination string | | +--rw source? string - | | +--rw size? string + | | +--rw size? string | | +--rw type? string | +--rw name string | +--rw podman @@ -167,6 +169,7 @@ module: labn-munet-config | +--rw cmd-file? string | +--rw cleanup-cmd? string | +--rw ready-cmd? string + | +--rw ready-timeout? uint32 | +--rw image? string | +--rw hostnet? boolean | +--rw server? string @@ -175,22 +178,22 @@ module: labn-munet-config | +--rw ssh-user? string | +--rw ssh-password? string | +--rw qemu - | | +--rw bios? string - | | +--rw cloud-init? boolean - | | +--rw cloud-init-disk? string - | | +--rw disk? string - | | +--rw disk-driver? string - | | +--rw disk-template? string - | | +--rw initial-cmd? string - | | +--rw initial-cmd-file? string - | | +--rw kernel? string - | | +--rw initrd? string - | | +--rw kvm? boolean - | | +--rw ncpu? uint32 - | | +--rw memory? string - | | +--rw root? string - | | +--rw cmdline-extra? string - | | +--rw extra-args? string + | | +--rw bios? string + | | +--rw cloud-init? boolean + | | +--rw cloud-init-disk? string + | | +--rw disk? string + | | +--rw disk-driver? string + | | +--rw disk-template? string + | | +--rw initial-cmd? string + | | +--rw initial-cmd-file? string + | | +--rw kernel? string + | | +--rw initrd? string + | | +--rw kvm? boolean + | | +--rw ncpu? uint32 + | | +--rw memory? string + | | +--rw root? string + | | +--rw cmdline-extra? string + | | +--rw extra-args? string | | +--rw console | | +--rw user? string | | +--rw password? string @@ -227,7 +230,7 @@ module: labn-munet-config | +--rw mounts* [destination] | | +--rw destination string | | +--rw source? string - | | +--rw size? string + | | +--rw size? string | | +--rw type? string | +--rw name string | +--rw podman @@ -611,6 +614,12 @@ munet> description "Shell command[s] to execute to determine if the node is ready"; } + leaf ready-timeout { + type uint32; + default 30; + description + "Maximum time in seconds to wait for the node to become ready."; + } leaf image { type string; must "not(../hostnet) and not(../qemu) and not(../server)" { diff --git a/doc/source/config.rst b/doc/source/config.rst index ab8edbe..84944ca 100644 --- a/doc/source/config.rst +++ b/doc/source/config.rst @@ -145,39 +145,45 @@ Nodes Tree diagram for node config:: - +--rw topology - | +--rw nodes* [name] - | +--rw id? uint32 - | +--rw kind? -> ../../../kinds/name - | +--rw ip* string - | +--rw ipv6* string - | +--rw cap-add* string - | +--rw cap-remove* string - | +--rw cmd? string - | +--rw cmd-file? string - | +--rw cleanup-cmd? string - | +--rw image? string - | +--rw server? string - | +--rw server-port? uint16 - | +--rw qemu - | +--rw connections* [to] - | ... described in subsection - | +--rw env* [name] - | | +--rw name string - | | +--rw value? string - | +--rw init? union - | +--rw mounts* [destination] - | ... described in subsection - | | +--rw destination string - | | +--rw source? string - | | +--rw tmpfs-size? string - | | +--rw type? string - | +--rw name string - | +--rw podman - | | +--rw extra-args* string - | +--rw privileged? boolean - | +--rw shell? union - | +--rw volumes* string + +--rw topology + +--rw nodes* [name] + +--rw id? uint32 + +--rw kind? -> ../../../kinds/name + +--rw ip* string + +--rw ipv6* string + +--rw cap-add* string + +--rw cap-remove* string + +--rw cmd? string + +--rw cmd-file? string + +--rw cleanup-cmd? string + +--rw ready-cmd? string + +--rw ready-timeout? uint32 + +--rw image? string + +--rw hostnet? boolean + +--rw server? string + +--rw server-port? uint16 + +--rw ssh-identity-file? string + +--rw ssh-user? string + +--rw ssh-password? string + +--rw qemu + ... intentionally truncated + +--rw connections* [to] + ... described in subsections + +--rw env* [name] + | +--rw name string + | +--rw value? string + +--rw gdb-cmd? string + +--rw gdb-target-cmds* string + +--rw gdb-run-cmds* string + +--rw init? union + +--rw mounts* [destination] + ... described in subsections + +--rw name string + +--rw podman + | +--rw extra-args* string + +--rw privileged? boolean + +--rw shell? union + +--rw volumes* string A particularly useful config option for any node is to set the ``cmd``. The ``cmd`` is a startup command that will run each time when the node is @@ -202,6 +208,9 @@ to use the same interpreter as specified by the file's shebang (again, defaultin to ``/bin/bash`` if none is found). Setting ``shell`` overrides this behavior to use a specific configured interpreter instead. +The ``ready-cmd`` and ``ready-timeout`` provide customization for how to check if a +node is ready and for how long to wait for it be ready. + Connections """"""""""" diff --git a/munet/munet-schema.json b/munet/munet-schema.json index b61ce5c..ca3a004 100644 --- a/munet/munet-schema.json +++ b/munet/munet-schema.json @@ -105,6 +105,9 @@ "ready-cmd": { "type": "string" }, + "ready-timeout": { + "type": "integer" + }, "image": { "type": "string" }, @@ -593,6 +596,9 @@ "ready-cmd": { "type": "string" }, + "ready-timeout": { + "type": "integer" + }, "image": { "type": "string" }, diff --git a/munet/native.py b/munet/native.py index bf1bfae..acc5d0e 100644 --- a/munet/native.py +++ b/munet/native.py @@ -3586,7 +3586,18 @@ async def wait_until_ready(x): tasks = [asyncio.create_task(wait_until_ready(x)) for x in ready_nodes] logging.debug("Waiting for ready on nodes: %s", ready_nodes) - _, pending = await asyncio.wait(tasks, timeout=30) + + # setable via "ready-timeout: 600" in kinds.yaml. + ready_timeout = max( + node.config.get("ready-timeout", 30) for node in ready_nodes + ) + self.logger.info( + "waiting up to %ss for ready-cmd on %s ready nodes", + ready_timeout, + len(ready_nodes), + ) + + _, pending = await asyncio.wait(tasks, timeout=ready_timeout) if pending: logging.warning("Timeout waiting for ready: %s", pending) for nr in pending: