Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: handle bridge on additional hosts
......................................................................

packaging: setup: handle bridge on additional hosts

Previously on an additional host hosted-engine-setup checked
for ip addr of the bridge instead of the ip addr of any existing
device. But on additional host the bridge creation is done by
the manager when adding the host.

Enabled the NIC selection for bridge creation also on additional
hosts if the bridge is not found and use its ip

Bug-Url: https://bugzilla.redhat.com/1025253
Change-Id: I81a5edada72d397c3ce30410d903840b1392034e
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
M src/plugins/ovirt-hosted-engine-setup/network/bridge.py
2 files changed, 28 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/44/20744/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
index aa658d6..b107dde 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -31,6 +31,9 @@
 import urllib2
 
 
+import ethtool
+
+
 import ovirtsdk.api
 import ovirtsdk.xml
 import ovirtsdk.infrastructure.errors
@@ -139,16 +142,31 @@
                         )
 
     def _getIPAddress(self):
-        self.logger.debug('Acquiring bridge address')
         address = None
-        rc, stdout, stderr = self.execute(
-            args=(
-                self.command.get('ip'),
-                'addr',
-                'show',
-                self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME],
-            ),
-        )
+        stdout = ''
+        if (
+            self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME] in
+            ethtool.get_devices()
+        ):
+            self.logger.debug('Acquiring bridge address')
+            rc, stdout, stderr = self.execute(
+                args=(
+                    self.command.get('ip'),
+                    'addr',
+                    'show',
+                    self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME],
+                ),
+            )
+        else:
+            self.logger.debug('Acquiring nic address')
+            rc, stdout, stderr = self.execute(
+                args=(
+                    self.command.get('ip'),
+                    'addr',
+                    'show',
+                    self.environment[ohostedcons.NetworkEnv.BRIDGE_IF],
+                ),
+            )
         for line in stdout:
             addressmatch = self._ADDRESS_RE.match(line)
             if addressmatch is not None:
diff --git a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py 
b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
index bd846f6..613adc2 100644
--- a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
+++ b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
@@ -85,10 +85,7 @@
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
-        condition=lambda self: (
-            self._enabled and
-            not self.environment[ohostedcons.CoreEnv.IS_ADDITIONAL_HOST]
-        ),
+        condition=lambda self: self._enabled,
         after=(
             ohostedcons.Stages.DIALOG_TITLES_S_NETWORK,
         ),


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81a5edada72d397c3ce30410d903840b1392034e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to