Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-25 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 3:

* #1195208::Update tracker: OK
* Set MODIFIED::bug 1195208#1195208FAILED, illegal change from ON_QA

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-25 Thread fromani
Francesco Romani has submitted this change and it was merged.

Change subject: ovs: add/remove OVS network based on a bond
..


ovs: add/remove OVS network based on a bond

Bond modes will be handled in a following patch.

Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček 
Reviewed-on: https://gerrit.ovirt.org/58202
Reviewed-by: Edward Haas 
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg 
Reviewed-on: https://gerrit.ovirt.org/6
---
M lib/vdsm/network/ovs/info.py
M lib/vdsm/network/ovs/switch.py
M tests/network/ovs_test.py
3 files changed, 163 insertions(+), 43 deletions(-)

Approvals:
  Jenkins CI: Passed CI tests
  Petr Horáček: Verified
  Dan Kenigsberg: Looks good to me, approved
  Edward Haas: Looks good to me, but someone else must approve



-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-25 Thread danken
Dan Kenigsberg has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 2: Code-Review+2

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-21 Thread phoracek
Petr Horáček has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 2: Verified+1

Passed functional/networkTests.py OK

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-21 Thread edwardh
Edward Haas has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 2: Code-Review+1

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-21 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 2:

* #1195208::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1195208::OK, public bug
* Check Product::#1195208::OK, Correct classification oVirt
* Check TM::#1195208::OK, correct target milestone ovirt-4.0.3
* Check merged to previous::OK, change not open on any previous branch

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-20 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: ovs: add/remove OVS network based on a bond
..


Patch Set 1:

* #1195208::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1195208::OK, public bug
* Check Product::#1195208::OK, Correct classification oVirt
* Check TM::#1195208::OK, correct target milestone ovirt-4.0.3
* Check merged to previous::OK, change not open on any previous branch

-- 
To view, visit https://gerrit.ovirt.org/6
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Petr Horáček 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: ovs: add/remove OVS network based on a bond

2016-07-20 Thread phoracek
Hello Dan Kenigsberg, Edward Haas,

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

https://gerrit.ovirt.org/6

to review the following change.

Change subject: ovs: add/remove OVS network based on a bond
..

ovs: add/remove OVS network based on a bond

Bond modes will be handled in a following patch.

Change-Id: I67305c97b2a00abd05523134c24ef497f33c1c88
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček 
Reviewed-on: https://gerrit.ovirt.org/58202
Reviewed-by: Edward Haas 
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg 
---
M lib/vdsm/network/ovs/info.py
M lib/vdsm/network/ovs/switch.py
M tests/network/ovs_test.py
3 files changed, 163 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/6/1

diff --git a/lib/vdsm/network/ovs/info.py b/lib/vdsm/network/ovs/info.py
index 627f7a4..616911d 100644
--- a/lib/vdsm/network/ovs/info.py
+++ b/lib/vdsm/network/ovs/info.py
@@ -77,6 +77,7 @@
 self._bridges = {bridge['name']: self._bridge_attr(bridge)
  for bridge in ovs_db.bridges}
 self._bridges_by_sb = self._get_bridges_by_sb()
+self._northbounds_by_sb = self._get_northbounds_by_sb()
 
 @property
 def bridges(self):
@@ -95,6 +96,20 @@
 
 return bridges_by_sb
 
+@property
+def northbounds_by_sb(self):
+return self._northbounds_by_sb
+
+def _get_northbounds_by_sb(self):
+northbounds_by_sb = {}
+
+for sb, bridge in six.iteritems(self.bridges_by_sb):
+bridge_ports = self.bridges[bridge]['ports']
+northbounds = self.northbound_ports(bridge_ports)
+northbounds_by_sb[sb] = set(northbounds)
+
+return northbounds_by_sb
+
 def _bridge_attr(self, bridge_entry):
 stp = bridge_entry['stp_enable']
 ports = [self._ports_uuids[uuid] for uuid in bridge_entry['ports']]
diff --git a/lib/vdsm/network/ovs/switch.py b/lib/vdsm/network/ovs/switch.py
index ac9d95c..2b5050d 100644
--- a/lib/vdsm/network/ovs/switch.py
+++ b/lib/vdsm/network/ovs/switch.py
@@ -19,6 +19,7 @@
 from __future__ import absolute_import
 
 from contextlib import contextmanager
+import itertools
 
 import six
 
@@ -76,51 +77,58 @@
 def setup(nets, bonds):
 ovs_info = info.OvsInfo()
 _netinfo = info.create_netinfo(ovs_info)
-nets_to_be_added, nets_to_be_removed = _split_nets_action(
-nets, _netinfo['networks'])
-bonds_to_be_added_or_edited, bonds_to_be_removed = _split_bonds_action(
+nets2add, nets2remove = _split_nets_action(nets, _netinfo['networks'])
+bonds2add, bonds2edit, bonds2remove = _split_bonds_action(
 bonds, _netinfo['bondings'])
 
-_setup_ovs_devices(nets_to_be_added, nets_to_be_removed)
+_setup_ovs_devices(ovs_info, nets2add, nets2remove, bonds2add, bonds2edit,
+   bonds2remove)
 
 
 def _split_nets_action(nets, running_nets):
 # TODO: If a nework is to be edited, we remove it and recreate again.
 # We should implement editation.
-nets_to_be_removed = set()
-nets_to_be_added = {}
+nets2remove = set()
+nets2add = {}
 
 for net, attrs in six.iteritems(nets):
 if 'remove' in attrs:
-nets_to_be_removed.add(net)
+nets2remove.add(net)
 elif net in running_nets:
-nets_to_be_removed.add(net)
-nets_to_be_added[net] = attrs
+nets2remove.add(net)
+nets2add[net] = attrs
 else:
-nets_to_be_added[net] = attrs
+nets2add[net] = attrs
 
-return nets_to_be_added, nets_to_be_removed
+return nets2add, nets2remove
 
 
 def _split_bonds_action(bonds, configured_bonds):
-bonds_to_be_removed = set()
-bonds_to_be_added_or_edited = {}
+bonds2remove = set()
+bonds2edit = {}
+bonds2add = {}
 
 for bond, attrs in six.iteritems(bonds):
 if 'remove' in attrs:
-bonds_to_be_removed.add(bond)
+bonds2remove.add(bond)
+elif bond not in configured_bonds:
+bonds2add[bond] = attrs
 elif attrs != configured_bonds.get(bond):
-bonds_to_be_added_or_edited[bond] = attrs
+bonds2edit[bond] = attrs
 
-return bonds_to_be_added_or_edited, bonds_to_be_removed
+return bonds2add, bonds2edit, bonds2remove
 
 
-def _setup_ovs_devices(nets_to_be_added, nets_to_be_removed):
+def _setup_ovs_devices(ovs_info, nets2add, nets2remove, bonds2add, bonds2edit,
+   bonds2remove):
 ovsdb = driver.create()
 
-with Setup(ovsdb) as s:
-s.remove_nets(nets_to_be_removed)
-s.add_nets(nets_to_be_added)
+with Setup(ovsdb, ovs_info) as s:
+s.remove_nets(nets2remove)
+s.remove_bonds(bonds2remove)
+s.edit_bonds(bonds2edit)
+s.add_bonds(bonds2add)
+s.add_nets(nets2add)
 
 with ovsdb.transac