Edward Haas has uploaded a new change for review. Change subject: net api: Normalize 'remove' for networks to boolean ......................................................................
net api: Normalize 'remove' for networks to boolean Normalize 'remove' value to a boolean at the api entry point. The incosistent value type caused validation failures of the api, especially when the canonization step has been introduced. Change-Id: I411458ee7847685873d19dfc595f10f609154b43 Signed-off-by: Edward Haas <edwa...@redhat.com> --- M lib/vdsm/network/api.py 1 file changed, 9 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/51041/1 diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py index 4cc5624..cc29b6c 100755 --- a/lib/vdsm/network/api.py +++ b/lib/vdsm/network/api.py @@ -896,7 +896,8 @@ "networks:%r, bondings:%r, options:%r" % (networks, bondings, options)) - _canonize_networks_defaults(networks) + _canonize_networks(networks) + # TODO: Add _canonize_bondings(bondings) logging.debug("Validating configuration") _validateNetworkSetup(networks, bondings) @@ -964,14 +965,18 @@ return vlan -def _canonize_networks_defaults(nets): +def _canonize_networks(nets): """ Given networks configuration, explicitly add missing defaults. :param nets: The network configuration """ for attrs in six.itervalues(nets): - if 'remove' in attrs and attrs['remove'] is True: - continue + # If net is marked for removal, normalize the mark to boolean and + # ignore all other attributes canonization. + if 'remove' in attrs: + attrs['remove'] = utils.tobool(attrs['remove']) + if attrs['remove'] is True: + continue attrs['mtu'] = int(attrs['mtu']) if 'mtu' in attrs else DEFAULT_MTU -- To view, visit https://gerrit.ovirt.org/51041 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I411458ee7847685873d19dfc595f10f609154b43 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Edward Haas <edwa...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches