Francesco Romani has uploaded a new change for review.
Change subject: **WIP** tool: reconfigure containers networks
......................................................................
**WIP** tool: reconfigure containers networks
TODO: properly integrate into vdsm-tool
Added as PoC/placeholder
Change-Id: I6053e283c004cd61ba7727cea22ba73a631180ba
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
A contrib/cont-setup-net
1 file changed, 53 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/60918/1
diff --git a/contrib/cont-setup-net b/contrib/cont-setup-net
new file mode 100755
index 0000000..7bc7c07
--- /dev/null
+++ b/contrib/cont-setup-net
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+# TODO: integrate into vdsm-tool
+
+import argparse
+import logging
+import sys
+
+from vdsm.virt.containers import config
+from vdsm.virt.containers import runtime
+
+
+_DEFAULT_OVIRT_NET = 'ovirtmgmt'
+_DEFAULT_SUBNET = '10.1.0.0'
+_DEFAULT_MASK = 24
+
+
+def _main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--name', type=str, nargs='?',
+ default=_DEFAULT_OVIRT_NET,
+ help='network name to use')
+ parser.add_argument('--bridge', type=str, nargs='?',
+ default=_DEFAULT_OVIRT_NET,
+ help='bridge to use')
+ parser.add_argument('--subnet', type=str, nargs='?',
+ default=_DEFAULT_SUBNET,
+ help='subnet to use')
+ parser.add_argument('--mask', type=int, nargs='?',
+ default=_DEFAULT_MASK,
+ help='netmask to use')
+ args = parser.parse_args()
+
+ runtimes = convirt.runtime.supported()
+ if not runtimes:
+ logging.warning('no runtimes detected, nothing to do')
+ return
+
+ logging.info('configuring runtimes: %s', runtimes)
+
+ config.network.update(
+ name=args.name,
+ bridge=args.bridge,
+ subnet=args.subnet,
+ mask=args.mask,
+ )
+
+ runtime.configure()
+
+
+if __name__ == "__main__":
+ logging.basicConfig(level=logging.DEBUG)
+ _main()
--
To view, visit
https://gerrit.ovirt.org/60918
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6053e283c004cd61ba7727cea22ba73a631180ba
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>