Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Update engine's mgmt net to have the correct vlan id
......................................................................

Update engine's mgmt net to have the correct vlan id

Up until now, when setting the management network over a vlan, the
logical network in the engine would not be automatically updated to
match the real configuration. This addresses the issue.

Change-Id: Ica4c5804395d364438f1e142387376cc7adc7172
Bug-Url: https://bugzilla.redhat.com/1124207
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/69/32269/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 62a1786..be42195 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -46,7 +46,12 @@
 from otopi import filetransaction
 
 
+from vdsm import netinfo
+from vdsm import vdscli
+
+
 from ovirt_hosted_engine_setup import constants as ohostedcons
+from ovirt_hosted_engine_setup.network import bridge
 
 
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-hosted-engine-setup')
@@ -420,6 +425,20 @@
                 ],
                 ca_file=self.cert,
             )
+
+            conn = vdscli.connect()
+            net_info = netinfo.NetInfo(bridge._getVdsCapabilities(conn))
+            bridge_port = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]
+            if bridge_port in net_info.vlans:
+                self.logger.debug('Updating engine\'s management network to '
+                                  'be vlanned')
+                vlan_id = net_info.vlans[bridge_port]['vlanid']
+                mgmt_network = engine_api.networks.get(
+                    name=self.environment[
+                        ohostedcons.NetworkEnv.DEFAULT_BRIDGE_NAME])
+                mgmt_network.vlan = vlan_id
+                mgmt_network.update()
+
             self.logger.debug('Adding the host to the cluster')
             cluster_name = self.environment[
                 ohostedcons.EngineEnv.HOST_CLUSTER_NAME


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

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

Reply via email to