pmctl2 is a command-line tool to control nodes, network namespaces, and networks on placemat
$ pmctl2 [--endpoint http://localhost:10808] <subcommand> [args...]
Option | Default Value | Description |
---|---|---|
--endpoint |
http://localhost:10808 |
API endpoint of the target placemat |
Show nodes list.
--json
: Show detailed information of a node in JSON format.
$ pmctl2 node list
node1
node2
$ pmctl2 node list --json | jq .
[
{
"name": "node1",
"taps": {
"mynet": "pm0"
},
"volumes": [
"root",
"data"
],
"cpu": 1,
"memory": "3G",
"uefi": false,
"tpm": false,
"smbios": {
"manufacturer": "",
"product": "",
"serial": "e5e2a9518607915ae99ab77d575bfe7a7dcf2a99"
},
"power_status": "On",
"socket_path": "/tmp/host1.socket"
},
{
"name": "node2",
"taps": {
"mynet": "pm1"
},
"volumes": [
"root",
"data"
],
"cpu": 1,
"memory": "3G",
"uefi": false,
"tpm": false,
"smbios": {
"manufacturer": "",
"product": "",
"serial": "e0d87a849f5a1e3d140e8b666446536edfe92089"
},
"power_status": "On",
"socket_path": "/tmp/host2.socket"
}
]
Show a node info.
$ pmctl2 node node1 | jq .
{
"name": "node1",
"taps": {
"mynet": "pm0"
},
"volumes": [
"root",
"data"
],
"cpu": 1,
"memory": "3G",
"uefi": false,
"tpm": false,
"smbios": {
"manufacturer": "",
"product": "",
"serial": "e5e2a9518607915ae99ab77d575bfe7a7dcf2a99"
},
"power_status": "On",
"socket_path": "/tmp/host1.socket"
}
Connect to a node via serial console.
If placemat starts without -graphic
option, VMs will have no graphic console.
Instead, they have serial consoles exposed via UNIX domain sockets.
$ sudo pmctl2 node enter node1
picocom v2.2
port is : /tmp/placemat_node1
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
stopbits are : 1
escape is : C-q
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
Type [C-q] [C-h] to see available commands
Terminal ready
This is node1 (Linux x86_64 4.14.55-coreos) 03:09:18
node1 ~ $
To exit from the console, press Ctrl-Q, Ctrl-X in this order.
Start a node.
$ pmctl2 node action start node1
Stop a node.
$ pmctl2 node action stop node1
Restart a node.
$ pmctl2 node action restart node1
forward
subcommand manages port-forward settings from the host to internal networks.
Show list of forward settings.
--json
: Show detailed information of forward settings in JSON format.
$ pmctl2 forward list
30000 external:10.72.32.0:80
30001 external:10.72.32.1:80
$ pmctl2 forward list --json
[
{
"local_port": 30000,
"netns": "external",
"remote_host": "10.72.32.0",
"remote_port": 80
},
{
"local_port": 30001,
"netns": "external",
"remote_host": "10.72.32.1",
"remote_port": 80
}
]
Add a forward setting.
This listens on 0.0.0.0:<LOCAL PORT>
in TCP, and forwards connections to <REMOTE HOST>:<REMOTE PORT>
in the network namespace.
$ pmctl2 forward add 30000 external:10.72.32.0:80
Delete a forward setting listening on <LOCAL PORT>
.
$ pmctl2 forward delete 30000
Generates shell completion functions.
Usage:
$ complete -r pmctl2
$ . <(pmctl2 completion [bash|zsh|fish|powershell])