Antoni Segura Puimedon has uploaded a new change for review. Change subject: unified pers: fix restoration when moving from ifcfg pers ......................................................................
unified pers: fix restoration when moving from ifcfg pers Up until now we were only flushing the persistence of the configurator currently set up. This had the problem that when switching between configurators and persistence models, old persistence remainders could be left over. Bug-Url https://bugzilla.redhat.com/1064530 Signed-off-by: Antoni S. Puimedon <asegu...@redhat.com> Change-Id: I584b3b2ee953b508da23874c0adc79fe59e06856 --- M vdsm/vdsm-restore-net-config 1 file changed, 25 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/25063/1 diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index fc2308b..8f758fd 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -1,6 +1,6 @@ #! /usr/bin/python # -# Copyright 2011-2012 Red Hat, Inc. +# Copyright 2011-2014 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,14 +18,19 @@ # # Refer to the README and COPYING files for full details of the license # - import logging import logging.config -from netconf import ifcfg from vdsm.config import config + +# Ifcfg persistence restoration +from netconf import ifcfg + +# Unified persistence restoration from vdsm.netconfpersistence import RunningConfig, PersistentConfig -from configNetwork import setupNetworks, ConfiguratorClass +from configNetwork import setupNetworks +import pkgutil +import netconf def ifcfg_restoration(): @@ -38,7 +43,6 @@ Builds a setupNetworks command from the persistent configuration to set it as running configuration. """ - configurator = ConfiguratorClass() runningConfig = RunningConfig() removeNetworks = {} removeBonds = {} @@ -51,7 +55,11 @@ setupNetworks(removeNetworks, removeBonds, connectivityCheck=False, _inRollback=True) - configurator.flush() + # Flush vdsm configurations left-overs from any configurator on the system + # so that changes of configurator and persistence system are smooth. + for configurator_cls in _get_all_configurators(): + configurator_cls().flush() + persistentConfig = PersistentConfig() nets = persistentConfig.networks bonds = persistentConfig.bonds @@ -60,6 +68,17 @@ setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True) +def _get_all_configurators(): + """Returns the class objects of all the configurators in the netconf pkg""" + prefix = netconf.__name__ + '.' + for importer, moduleName, isPackage in pkgutil.iter_modules( + netconf.__path__, prefix): + __import__(moduleName, fromlist="_") + + for cls in netconf.Configurator.__subclasses__(): + yield cls + + def restore(): if config.get('vars', 'net_persistence') == 'unified': unified_restoration() -- To view, visit http://gerrit.ovirt.org/25063 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I584b3b2ee953b508da23874c0adc79fe59e06856 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <asegu...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches