summaryrefslogtreecommitdiff
path: root/kvmd/apps/__init__.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-10-10 16:06:06 +0300
committerDevaev Maxim <[email protected]>2020-10-10 16:06:06 +0300
commitf6ea1eda45346b248910f4b032666d583b6c4386 (patch)
tree6408ea1b64be4dc1daf7404d8c5ed82be79cc711 /kvmd/apps/__init__.py
parent69509349bde314e89101f1825dfda9292fb5acb7 (diff)
kvmd-otgnet
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r--kvmd/apps/__init__.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index a882e0d7..9c07cf94 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -430,21 +430,34 @@ def _get_config_scheme() -> Dict:
"otgnet": {
"iface": {
- "net": Option("169.254.0.100/31", type=functools.partial(valid_net, v6=False)),
+ "net": Option("169.254.0.0/24", type=functools.partial(valid_net, v6=False)),
+ "ip_cmd": Option(["/usr/bin/ip"], type=valid_command),
},
"firewall": {
- "allow_tcp": Option([], type=valid_ports_list),
- "allow_udp": Option([], type=valid_ports_list),
- },
-
- "dhcp": {
- "enabled": Option(True, type=valid_bool),
+ "allow_tcp": Option([], type=valid_ports_list),
+ "allow_udp": Option([], type=valid_ports_list),
+ "iptables_cmd": Option(["/usr/bin/iptables"], type=valid_command),
},
"commands": {
- "ip_cmd": Option(["/usr/bin/ip"], type=valid_command),
- "iptables_cmd": Option(["/usr/bin/iptables"], type=valid_command),
+ "pre_start_cmd": Option(["/bin/true", "pre-start"], type=valid_command),
+ "post_start_cmd": Option([
+ "/usr/bin/systemd-run",
+ "--unit=kvmd-otgnet-dnsmasq",
+ "dnsmasq",
+ "--interface={iface}",
+ "--port=0",
+ "--dhcp-range={dhcp_ip_begin},{dhcp_ip_end},24h",
+ "--dhcp-leasefile=/run/kvmd/dnsmasq.lease",
+ "--no-daemon",
+ ], type=valid_command),
+ "pre_stop_cmd": Option([
+ "/usr/bin/systemctl",
+ "stop",
+ "kvmd-otgnet-dnsmasq",
+ ], type=valid_command),
+ "post_stop_cmd": Option(["/bin/true", "post-stop"], type=valid_command),
},
},