Change in vdsm[master]: hooks: ovs

danken at redhat.com danken at redhat.com
Wed Apr 29 09:45:09 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: hooks: ovs
......................................................................


Patch Set 5:

(11 comments)

https://gerrit.ovirt.org/#/c/40312/5/vdsm_hooks/ovs/ovs_network_setup.py
File vdsm_hooks/ovs/ovs_network_setup.py:

Line 17: #
Line 18: # Refer to the README and COPYING files for full details of the license
Line 19: #
Line 20: """ TODO
Line 21: - edit instead of remove and add
first bullet is not so clear
Line 22: - change bond slaves under a vlan
Line 23: - test if parameters are correct (bridged etc)
Line 24: - ip configuration
Line 25: - persistence (NOTE: i don't know if it is possible to dissable ovs persistence


Line 18: # Refer to the README and COPYING files for full details of the license
Line 19: #
Line 20: """ TODO
Line 21: - edit instead of remove and add
Line 22: - change bond slaves under a vlan
=> change bond slaves of an existing bond, probably
Line 23: - test if parameters are correct (bridged etc)
Line 24: - ip configuration
Line 25: - persistence (NOTE: i don't know if it is possible to dissable ovs persistence
Line 26:   but we could simply remove the whole ovsbr0 on startup


Line 23: - test if parameters are correct (bridged etc)
Line 24: - ip configuration
Line 25: - persistence (NOTE: i don't know if it is possible to dissable ovs persistence
Line 26:   but we could simply remove the whole ovsbr0 on startup
Line 27: - add get-vds-caps hook-point, internal bridge as VDSM bridge
th get-vds-caps hook-point already exists, you only need to add a hook script.
Line 28: - add get-vds-stats hook-point
Line 29: - tests
Line 30: - on a device removal, check if it is in config and running in ovs
Line 31:   do the same for remove_redundant_bridge


Line 24: - ip configuration
Line 25: - persistence (NOTE: i don't know if it is possible to dissable ovs persistence
Line 26:   but we could simply remove the whole ovsbr0 on startup
Line 27: - add get-vds-caps hook-point, internal bridge as VDSM bridge
Line 28: - add get-vds-stats hook-point
AND a script to report bond/bridge/vlan stats properly.

Also - we need a hook script for before_device_create.
Line 29: - tests
Line 30: - on a device removal, check if it is in config and running in ovs
Line 31:   do the same for remove_redundant_bridge
Line 32: - better names


Line 25: - persistence (NOTE: i don't know if it is possible to dissable ovs persistence
Line 26:   but we could simply remove the whole ovsbr0 on startup
Line 27: - add get-vds-caps hook-point, internal bridge as VDSM bridge
Line 28: - add get-vds-stats hook-point
Line 29: - tests
add a functional test that is skipped if the hook is not installed. MAYBE - do that for ALL tests. If the hook is installed, run them again with ovs per network
Line 30: - on a device removal, check if it is in config and running in ovs
Line 31:   do the same for remove_redundant_bridge
Line 32: - better names
Line 33: """


Line 27: - add get-vds-caps hook-point, internal bridge as VDSM bridge
Line 28: - add get-vds-stats hook-point
Line 29: - tests
Line 30: - on a device removal, check if it is in config and running in ovs
Line 31:   do the same for remove_redundant_bridge
I'm not sure this is needed - we can assume that if the network is in ovs, we are the ones that have put it there.
Line 32: - better names
Line 33: """
Line 34: import hooking
Line 35: import traceback


Line 28: - add get-vds-stats hook-point
Line 29: - tests
Line 30: - on a device removal, check if it is in config and running in ovs
Line 31:   do the same for remove_redundant_bridge
Line 32: - better names
I hate the name "handle_*", but I don't have a good replacement.
Line 33: """
Line 34: import hooking
Line 35: import traceback
Line 36: 


Line 119:                     non_ovs_bondings[bonding] = attrs
Line 120: 
Line 121:         for bonding, attrs in bondings.items():
Line 122:             if 'remove' not in attrs:
Line 123:                 if 'custom' in attrs and bool(attrs['custom'].get('ovs')):
Engine cannot set 'custom' on bonds.
However, we can abuse bonding's "options" (which is a space-sparated list of key=value)
Line 124:                     self.setup_ovs_bonding(bonding, attrs)
Line 125:                 else:
Line 126:                     non_ovs_bondings[bonding] = attrs
Line 127: 


Line 134: 
Line 135:         if vlan is not None:
Line 136:             vlan = str(vlan)
Line 137:             self.commands.extend(
Line 138:                 ['--', 'add-br', network, _BRIDGE_NAME, str(vlan)])
# TODO: handle the case of modifying an existing network
Line 139: 
Line 140:         if nic is not None:
Line 141:             self.commands.extend(
Line 142:                 ['--', '--may-exist', 'add-port', _BRIDGE_NAME, nic])


Line 140:         if nic is not None:
Line 141:             self.commands.extend(
Line 142:                 ['--', '--may-exist', 'add-port', _BRIDGE_NAME, nic])
Line 143:             if vlan is not None:
Line 144:                 self.commands.extend(['tag=%d' % vlan])
This makes it impossible to add another network with no vlan tagging on top of this nic, which is allowed by us with linux bridge.

We need to find out how to configure this with ovs - but you can keep it as a TODO line here.
Line 145: 
Line 146:         if bonding is not None and vlan is not None:
Line 147:             self.commands.extend(
Line 148:                 ['--', 'set', 'port', bonding, 'tag=%d' % vlan])


Line 169:         self.running_config.removeNetwork(network)
Line 170: 
Line 171:     def remove_ovs_bonding(self, bonding):
Line 172:         self.commands.extend(['--', 'del-port', _BRIDGE_NAME, bonding])
Line 173:         self.running_config.removeBonding(bonding)
double check that runningConfig does not over-writes anything on disk
Line 174: 
Line 175: 
Line 176: def main():
Line 177:     setup_nets_config = hooking.read_json()


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id602b6cc87a663424d06c77d1847d2c2d60d289f
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <toni+ovirt at midokura.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list