Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-28 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 3:

* update_tracker: OK
* Set MODIFIED::bug 1379115#1379115OK, already on MODIFIED

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-28 Thread danken
Dan Kenigsberg has submitted this change and it was merged.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


net: Split OVS setup transaction to adjust for bond setup

When using Linux bonds (instead of OVS bonds), the OVS setup transaction
needs to be split into two.
First one for removing networks and a second for adding networks.
In between, the bonds setup is placed.

These three steps contain, in addition to the actual devices setup, the
acquire and running-config update, allowing proper rollback in case of
setup failure.

This patch, fixes a scenario that fails with the previous patch, where
the Linux bonds have been introduced in the setup flow.
The scenario: Move a network nic from a network to a bond slave.

Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Bug-Url: https://bugzilla.redhat.com/1379115
Signed-off-by: Edward Haas 
Reviewed-on: https://gerrit.ovirt.org/64118
Continuous-Integration: Jenkins CI
Reviewed-by: Petr Horáček 
Reviewed-by: Dan Kenigsberg 
Reviewed-on: https://gerrit.ovirt.org/64412
---
M lib/vdsm/network/netswitch.py
M lib/vdsm/network/ovs/switch.py
M tests/network/ovs_switch_test.py
M tests/network/ovs_test.py
4 files changed, 111 insertions(+), 91 deletions(-)

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



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Edward Haas 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-28 Thread danken
Dan Kenigsberg has posted comments on this change.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

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

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-26 Thread edwardh
Edward Haas has posted comments on this change.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 2: Verified+1

Func tests passed

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-26 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 2:

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

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
Gerrit-Reviewer: Dan Kenigsberg 
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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

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

Change subject: net: Split OVS setup transaction to adjust for bond setup
..


Patch Set 1:

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

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Petr Horáček 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org


Change in vdsm[ovirt-4.0]: net: Split OVS setup transaction to adjust for bond setup

2016-09-25 Thread edwardh
Hello Petr Horáček, Dan Kenigsberg,

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

https://gerrit.ovirt.org/64412

to review the following change.

Change subject: net: Split OVS setup transaction to adjust for bond setup
..

net: Split OVS setup transaction to adjust for bond setup

When using Linux bonds (instead of OVS bonds), the OVS setup transaction
needs to be split into two.
First one for removing networks and a second for adding networks.
In between, the bonds setup is placed.

These three steps contain, in addition to the actual devices setup, the
acquire and running-config update, allowing proper rollback in case of
setup failure.

This patch, fixes a scenario that fails with the previous patch, where
the Linux bonds have been introduced in the setup flow.
The scenario: Move a network nic from a network to a bond slave.

Change-Id: I0bd351e755be9d5dcaf5a05e5b79345e6f7bcfe8
Bug-Url: https://bugzilla.redhat.com/1379115
Signed-off-by: Edward Haas 
Reviewed-on: https://gerrit.ovirt.org/64118
Continuous-Integration: Jenkins CI
Reviewed-by: Petr Horáček 
Reviewed-by: Dan Kenigsberg 
---
M lib/vdsm/network/netswitch.py
M lib/vdsm/network/ovs/switch.py
M tests/network/ovs_switch_test.py
M tests/network/ovs_test.py
4 files changed, 111 insertions(+), 91 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/64412/1

diff --git a/lib/vdsm/network/netswitch.py b/lib/vdsm/network/netswitch.py
index 70d2cd6..47d73e5 100644
--- a/lib/vdsm/network/netswitch.py
+++ b/lib/vdsm/network/netswitch.py
@@ -157,11 +157,11 @@
 
 def _setup_ovs(networks, bondings, options, in_rollback):
 _ovs_info = ovs_info.OvsInfo()
-ovs_netinfo = ovs_info.create_netinfo(_ovs_info)
+ovs_nets = ovs_info.create_netinfo(_ovs_info)['networks']
 _netinfo = netinfo()
 
 nets2add, nets2edit, nets2remove = _split_setup_actions(
-networks, ovs_netinfo['networks'])
+networks, ovs_nets)
 bonds2add, bonds2edit, bonds2remove = _split_setup_actions(
 bondings, _netinfo['bondings'])
 
@@ -173,36 +173,38 @@
 # FIXME: we are not able to move a nic from bond to network in one setup
 with Transaction(in_rollback=in_rollback) as config:
 setup_bonds = SetupBonds(bonds2add, bonds2edit, bonds2remove, config)
-with ifacquire.Transaction(ovs_netinfo['networks']) as acq:
-with ovs_switch.create_setup(_ovs_info) as setup_ovs:
-setup_ovs.remove_nets(nets2remove)
-setup_bonds.remove_bonds()
-acq.acquire(setup_bonds.ifaces_for_acquirement)
-setup_bonds.edit_bonds()
-setup_bonds.add_bonds()
-setup_ovs.add_nets(nets2add)
-acq.acquire(setup_ovs.acquired_ifaces)
-_update_networks_running_config(networks, config)
+with ifacquire.Transaction(ovs_nets) as acq:
+_remove_networks(nets2remove, _ovs_info, config)
+
+setup_bonds.remove_bonds()
+
+acq.acquire(setup_bonds.ifaces_for_acquirement)
+setup_bonds.edit_bonds()
+setup_bonds.add_bonds()
+
+_add_networks(nets2add, _ovs_info, config, acq)
+
 ovs_switch.cleanup()
 setup_ipv6autoconf(networks)
 set_ovs_links_up(nets2add, bonds2add, bonds2edit)
 setup_ovs_ip_config(nets2add, nets2remove)
+
 connectivity.check(options)
 
 
-# TODO: We should use KernelConfig when it will be fully reliable.
-def _update_networks_running_config(networks, running_config):
-"""
-Update running_config with the networks configuration.
+def _remove_networks(nets2remove, ovs_info, config):
+net_rem_setup = ovs_switch.create_network_removal_setup(ovs_info)
+net_rem_setup.remove(nets2remove)
+for net, attrs in six.iteritems(nets2remove):
+config.removeNetwork(net)
 
-This step has to be done as soon as we apply the changes in the system.
-The running config will be used to generate the rollback query.
-"""
-for net, attrs in six.iteritems(networks):
-if 'remove' in attrs:
-running_config.removeNetwork(net)
-else:
-running_config.setNetwork(net, attrs)
+
+def _add_networks(nets2add, ovs_info, config, acq):
+net_add_setup = ovs_switch.create_network_addition_setup(ovs_info)
+with net_add_setup.add(nets2add):
+acq.acquire(net_add_setup.acquired_ifaces)
+for net, attrs in six.iteritems(nets2add):
+config.setNetwork(net, attrs)
 
 
 def setup_ovs_ip_config(nets2add, nets2remove):
diff --git a/lib/vdsm/network/ovs/switch.py b/lib/vdsm/network/ovs/switch.py
index 1b47315..e55bbef 100644
--- a/lib/vdsm/network/ovs/switch.py
+++ b/lib/vdsm/network/ovs/switch.py
@@ -18,6 +18,7 @@
 #
 from __future__ import absolute_import
 
+from contextlib import