Hello Douglas Schilling Landgraf, Dan Kenigsberg, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/26373 to review the following change. 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 Reviewed-on: http://gerrit.ovirt.org/25063 Tested-by: Douglas Schilling Landgraf <dougsl...@redhat.com> Reviewed-by: Dan Kenigsberg <dan...@redhat.com> --- M init/vdsmd_init_common.sh.in M vdsm/vdsm-restore-net-config 2 files changed, 26 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/26373/1 diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in index 47b147c..505072e 100644 --- a/init/vdsmd_init_common.sh.in +++ b/init/vdsmd_init_common.sh.in @@ -250,8 +250,8 @@ tune_system \ test_space \ test_lo \ - restore_nets \ unified_network_persistence_upgrade \ + restore_nets \ upgrade_300_nets \ " ;; diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index 9e90be8..4829658 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/26373 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I584b3b2ee953b508da23874c0adc79fe59e06856 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.4 Gerrit-Owner: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Douglas Schilling Landgraf <dougsl...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches