Change in vdsm[master]: hook: ovs: divide custom bond opts with ':'
phoracek at redhat.com
phoracek at redhat.com
Thu Apr 7 14:52:30 UTC 2016
Petr Horáček has uploaded a new change for review.
Change subject: hook: ovs: divide custom bond opts with ':'
......................................................................
hook: ovs: divide custom bond opts with ':'
On Engine side we forbid multiple '=' in one bond option. That means,
that we cannot pass custom options as 'custom=foo=bar,x=y'.
Now we use ':' as a delimiter, so custom options should look like
'custom=foo:bar,x:y'.
Change-Id: I086d65792969da19cb374fcd367499cfaa45955f
Bug-Url: https://bugzilla.redhat.com/1234867
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M vdsm_hooks/ovs/ovs_utils.py
1 file changed, 6 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/55827/1
diff --git a/vdsm_hooks/ovs/ovs_utils.py b/vdsm_hooks/ovs/ovs_utils.py
index c703689..8aa459a 100644
--- a/vdsm_hooks/ovs/ovs_utils.py
+++ b/vdsm_hooks/ovs/ovs_utils.py
@@ -51,18 +51,19 @@
def get_bond_options(options, keep_custom=False):
""" Parse bonding options into dictionary, if keep_custom is set to True,
custom option will not be recursive parsed.
- >>> get_bond_options('mode=4 custom=foo=yes,bar=no')
+ >>> get_bond_options('mode=4 custom=foo:yes,bar:no')
{'custom': {'bar': 'no', 'foo': 'yes'}, 'mode': '4'}
"""
- def _string_to_dict(str, div):
+ def _string_to_dict(str, div, eq):
if options == '':
return {}
- return dict(option.split('=', 1)
+ return dict(option.split(eq, 1)
for option in str.strip(div).split(div))
if options:
- d_options = _string_to_dict(options, ' ')
+ d_options = _string_to_dict(options, ' ', '=')
if d_options.get('custom') and not keep_custom:
- d_options['custom'] = _string_to_dict(d_options['custom'], ',')
+ d_options['custom'] = _string_to_dict(d_options['custom'], ',',
+ ':')
return d_options
else:
return {}
--
To view, visit https://gerrit.ovirt.org/55827
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I086d65792969da19cb374fcd367499cfaa45955f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
More information about the vdsm-patches
mailing list