Skip to content
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
79 changes: 44 additions & 35 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)" {
Expand Down
75 changes: 42 additions & 33 deletions doc/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""""""""""

Expand Down
6 changes: 6 additions & 0 deletions munet/munet-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
"ready-cmd": {
"type": "string"
},
"ready-timeout": {
"type": "integer"
},
"image": {
"type": "string"
},
Expand Down Expand Up @@ -593,6 +596,9 @@
"ready-cmd": {
"type": "string"
},
"ready-timeout": {
"type": "integer"
},
"image": {
"type": "string"
},
Expand Down
13 changes: 12 additions & 1 deletion munet/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading