Antoni Segura Puimedon has uploaded a new change for review.
Change subject: addNetwork script: Prevent empty params from reaching RunningConfig ......................................................................
addNetwork script: Prevent empty params from reaching RunningConfig
The consumers of the addNetwork script pass empty parameters, e.g. "" in order to fill the positional arguments that the script takes. The problem with that is that those parameters were being passed to addNetwork without modification, and that includes the _alterNetworkConfig wrapper that makes addNetwork requests reach runningConfig (and eventually PersistentConfig).
Due to the issue above, a stored network could contain entries like 'bonding': '' that would mess with selective network restoration.
Change-Id: If6d56eefc05cdb7456f80b7ec13d0be8ad087aa3 Bug-Url: https://bugzilla.redhat.com/1144639 Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M vdsm/network/api.py 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/33510/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py index 8879245..f2a2cd6 100755 --- a/vdsm/network/api.py +++ b/vdsm/network/api.py @@ -822,6 +822,10 @@ kwargs = _parseKwargs(sys.argv[3:]) if 'nics' in kwargs: kwargs['nics'] = kwargs['nics'].split(',') + # Remove empty keys so that they are not taken by _alterRunningConfig + for key, value in kwargs.items(): + if key != 'bondingOptions' and value == '': + del kwargs[key] addNetwork(bridge, **kwargs) elif sys.argv[1] == 'del': bridge = sys.argv[2]