Ido Barkan has uploaded a new change for review. Change subject: net: factor out _find_nets_with_available_devices. ......................................................................
net: factor out _find_nets_with_available_devices. Aiming to simplify _filter_nets_bonds. Change-Id: I4e1ea8759d2c671fa27edc9b01ccc496e31dc928 Signed-off-by: Ido Barkan <ibar...@redhat.com> --- M vdsm/vdsm-restore-net-config 1 file changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/40540/1 diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index 6f0f195..4b1fd8a 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -116,11 +116,20 @@ def _filter_nets_bonds(persisted_nets, persisted_bonds): """Returns only nets and bonds that can be configured with the devices present in the system""" - available_nets = {} available_nics = netinfo.nics() available_bonds = _find_bonds_with_available_nics(available_nics, persisted_bonds) + available_nets = _find_nets_with_available_devices(available_bonds, + available_nics, + persisted_bonds, + persisted_nets) + return available_nets, available_bonds + + +def _find_nets_with_available_devices(available_bonds, available_nics, + persisted_bonds, persisted_nets): + available_nets = {} for net, attrs in persisted_nets.iteritems(): bond = attrs.get('bonding') if bond is not None: @@ -148,7 +157,8 @@ # Bridge-only nics available_nets[net] = attrs - return available_nets, available_bonds + + return available_nets def _find_bonds_with_available_nics(available_nics, persisted_bonds): -- To view, visit https://gerrit.ovirt.org/40540 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4e1ea8759d2c671fa27edc9b01ccc496e31dc928 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ido Barkan <ibar...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches