Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Allow static IP on the host
......................................................................

packaging: setup: Allow static IP on the host

Change-Id: I108c2202ebed0e90a7d06cfdef1bce8154cfd3fb
Bug-Url: https://bugzilla.redhat.com/1013666
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/network/bridge.py
1 file changed, 29 insertions(+), 2 deletions(-)


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

diff --git a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py 
b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
index 64f3e05..0619f41 100644
--- a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
+++ b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
@@ -188,6 +188,16 @@
     def _misc(self):
         self.logger.info(_('Configuring the management bridge'))
         nics = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]
+        iface = nics
+        caps = self.environment[
+            ohostedcons.VDSMEnv.VDS_CLI
+        ].s.getVdsCapabilities()['info']['nics'][nics]
+        self.logger.debug(
+            'getVdsCaps for {iface}: {caps}'.format(
+                iface=iface,
+                caps=caps,
+            )
+        )
         bond = ''
         if netinfo.isbonding(nics):
             bond = nics
@@ -205,10 +215,27 @@
             'nics=%s' % nics,
             'force=False',
             'bridged=True',
-            'BOOTPROTO=dhcp',
             'ONBOOT=yes',
-            'blockingdhcp=true',
         ]
+        boot_proto = caps['cfg']['BOOTPROTO']
+        cmd += ['bootproto=%s' % boot_proto]
+        if boot_proto == 'dhcp':
+            cmd += [
+                'blockingdhcp=true',
+            ]
+        elif boot_proto in ('static', 'none'):
+            cmd += [
+                'ipaddr=%s' % caps['addr'],
+                'netmask=%s' % caps['netmask'],
+                'gateway=%s' % caps['cfg']['GATEWAY'],
+            ]
+        else:
+            raise RuntimeError(_(
+                'Unknown boot protocol {proto} for interface {iface}'.format(
+                    proto=boot_proto,
+                    iface=iface,
+                ))
+            )
         self.execute(
             cmd,
             raiseOnError=True


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I108c2202ebed0e90a7d06cfdef1bce8154cfd3fb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to