Dan Kenigsberg has uploaded a new change for review. Change subject: netConfig: translate to "new" option names from cmdline, too ......................................................................
netConfig: translate to "new" option names from cmdline, too At some point in prehistoric past a former Vdsm developer decided to change the names of various networking options. IPADDR had become ipaddr; BONDING_OPTS had become bondingOptions; etc. We continued to support older-style names - which are used up to this very day by ovirt-engine. Translation is done by API.Global._translateOptionsToNew for each network API call. However, we forgot to perform this translation when the network configuration functions are called via the /usr/share/vdsm/addNetwork script during bootstrap/registration. This lacuna leads to IPADDR being written to configuration file uncontrolably. This patch fixes the issue in the simplest quickest form I could think of. Change-Id: I2c18acb87ae0372d5af949f6fa4ab24d025d7faf Bug-Id: BZ#847733 failure to create rhevm network over pre-configured VLAN Signed-off-by: Dan Kenigsberg <[email protected]> --- M vdsm/API.py M vdsm/configNetwork.py 2 files changed, 12 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/7390/1 diff --git a/vdsm/API.py b/vdsm/API.py index ae04e01..2819727 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1166,7 +1166,7 @@ vlan(number) and bond are optional - pass the empty string to discard them. """ - self._translateOptionsToNew(options) + self.translateNetOptionsToNew(options) if not self._cif._networkSemaphore.acquire(blocking=False): self.log.warn('concurrent network verb already executing') return errCode['unavail'] @@ -1190,7 +1190,7 @@ def delNetwork(self, bridge, vlan=None, bond=None, nics=None, options={}): """Delete a network from this vds.""" - self._translateOptionsToNew(options) + self.translateNetOptionsToNew(options) try: if not self._cif._networkSemaphore.acquire(blocking=False): @@ -1236,7 +1236,7 @@ nics=None, options={}): """Add a new network to this vds, replacing an old one.""" - self._translateOptionsToNew(options) + self.translateNetOptionsToNew(options) if not self._cif._networkSemaphore.acquire(blocking=False): self.log.warn('concurrent network verb already executing') return errCode['unavail'] @@ -1364,7 +1364,8 @@ self.log.error(vmId + ': Lost connection to VM') return count, active, migrating - def _translateOptionsToNew(self, options): + @staticmethod + def translateNetOptionsToNew(options): _translationMap = { 'IPADDR': 'ipaddr', 'NETMASK': 'netmask', @@ -1376,6 +1377,6 @@ } for k, v in options.items(): if k in _translationMap: - self.log.warn("options %s is deprecated. Use %s instead" % + logging.warn("options %s is deprecated. Use %s instead" % (k, _translationMap[k])) options[_translationMap[k]] = options.pop(k) diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py index d55a2cc..30427ce 100755 --- a/vdsm/configNetwork.py +++ b/vdsm/configNetwork.py @@ -1275,7 +1275,12 @@ def _parseKwargs(args): - return dict(arg.split('=', 1) for arg in args) + import API + + kwargs = dict(arg.split('=', 1) for arg in args) + API.Global._translateOptionsToNew(kwargs) + + return kwargs def main(): if len(sys.argv) <= 1: -- To view, visit http://gerrit.ovirt.org/7390 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2c18acb87ae0372d5af949f6fa4ab24d025d7faf Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
