Hello Fabian Deutsch,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/23150

to review the following change.

Change subject: engine_page: management info for autoinstall
......................................................................

engine_page: management info for autoinstall

We should provide management info also for autoinstall, not only
for tradicional TUI registration.

Change-Id: I58250e31b60ba863b851a3b6b0cfa1a59165c44b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1048929
Signed-off-by: Fabian Deutsch <[email protected]>
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
---
M src/engine_page.py
1 file changed, 26 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm 
refs/changes/50/23150/1

diff --git a/src/engine_page.py b/src/engine_page.py
index 3b1cba4..1ae45ca 100644
--- a/src/engine_page.py
+++ b/src/engine_page.py
@@ -32,9 +32,30 @@
 Configure Engine
 """
 
-
 LOGGER = logging.getLogger(__name__)
-MGMT_IFACES = ('ovirtmgmt', 'rhevm')
+
+
+def sync_mgmt():
+    """Guess mgmt interface and update TUI config
+       FIXME: Autoinstall should write MANAGED_BY and MANAGED_IFNAMES
+       into /etc/defaults/ovirt
+    """
+    MGMT_IFACES = ('ovirtmgmt', 'rhevm')
+    cfg = VDSM().retrieve()
+
+    mgmtInterface = []
+    for iface in MGMT_IFACES:
+        if os.path.exists('/sys/class/net/' + iface):
+            mgmtInterface = [iface]
+            break
+
+    mgmt = Management()
+    mgmt.update(
+        "oVirt Engine http://%s:%s"; % (cfg["server"],
+                                       cfg["port"]),
+        mgmtInterface,
+        None
+    )
 
 
 class Plugin(plugins.NodePlugin):
@@ -46,6 +67,7 @@
     def __init__(self, app):
         super(Plugin, self).__init__(app)
         self._model = {}
+        sync_mgmt()
 
     def name(self):
         return config.engine_name
@@ -72,6 +94,7 @@
                 }
 
     def ui_content(self):
+        sync_mgmt()
         ws = [ui.Header("header[0]",
               "{engine_name} Configuration".format(
                   engine_name=config.engine_name)),
@@ -348,18 +371,7 @@
         if write_vdsm_config(cfg["server"], cfg["port"]):
             self.logger.info("Starting vdsm-reg service")
             deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'start'])
-
-            mgmtInterface = []
-            for iface in MGMT_IFACES:
-                if os.path.exists('/sys/class/net/' + iface):
-                    mgmtInterface = [iface]
-                    break
-
-            mgmt = Management()
-            mgmt.update("oVirt Engine http://%s:%s"; % (cfg["server"],
-                                                       cfg["port"]),
-                        mgmtInterface,
-                        None)
+            sync_mgmt()
 
             msgConf = "{engine_name} Configuration Successfully " \
                 " Updated".format(


-- 
To view, visit http://gerrit.ovirt.org/23150
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58250e31b60ba863b851a3b6b0cfa1a59165c44b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node-plugin-vdsm
Gerrit-Branch: node-3.0
Gerrit-Owner: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Fabian Deutsch <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to