Ido Barkan has uploaded a new change for review.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
net: factor out _find_bonds_with_available_nics
Aiming to break _filter_nets_bonds apart so it will be simpler and easier to read.
Change-Id: I09dc7278607b3f908a82ec1c523052c79e6269c8 Signed-off-by: Ido Barkan ibarkan@redhat.com --- M vdsm/vdsm-restore-net-config 1 file changed, 14 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/40539/1
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index eb19a1a..6f0f195 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -116,14 +116,10 @@ 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_bonds = {}, {} + available_nets = {} available_nics = netinfo.nics() - for bond, attrs in persisted_bonds.iteritems(): - available_bond_nics = [nic for nic in attrs['nics'] if - nic in available_nics] - if available_bond_nics: - available_bonds[bond] = attrs.copy() - available_bonds[bond]['nics'] = available_bond_nics + available_bonds = _find_bonds_with_available_nics(available_nics, + persisted_bonds)
for net, attrs in persisted_nets.iteritems(): bond = attrs.get('bonding') @@ -155,6 +151,17 @@ return available_nets, available_bonds
+def _find_bonds_with_available_nics(available_nics, persisted_bonds): + available_bonds = {} + for bond, attrs in persisted_bonds.iteritems(): + available_bond_nics = [nic for nic in attrs['nics'] if + nic in available_nics] + if available_bond_nics: + available_bonds[bond] = attrs.copy() + available_bonds[bond]['nics'] = available_bond_nics + return available_bonds + + def _get_all_configurators(): """Returns the class objects of all the configurators in the netconf pkg""" prefix = configurators.__name__ + '.'
automation@ovirt.org has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Ondřej Svoboda has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 1: Code-Review+1
automation@ovirt.org has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Ido Barkan has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 3: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 3: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
net: factor out _find_bonds_with_available_nics
Aiming to break _filter_nets_bonds apart so it will be simpler and easier to read.
Change-Id: I09dc7278607b3f908a82ec1c523052c79e6269c8 Signed-off-by: Ido Barkan ibarkan@redhat.com Reviewed-on: https://gerrit.ovirt.org/40539 Reviewed-by: Ondřej Svoboda osvoboda@redhat.com Continuous-Integration: Jenkins CI Reviewed-by: Dan Kenigsberg danken@redhat.com --- M vdsm/vdsm-restore-net-config 1 file changed, 14 insertions(+), 7 deletions(-)
Approvals: Ido Barkan: Verified Ondřej Svoboda: Looks good to me, but someone else must approve Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: net: factor out _find_bonds_with_available_nics ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org