Assaf Muller has uploaded a new change for review. Change subject: Unified network persistence [3/3] - Restore network configuration ......................................................................
Unified network persistence [3/3] - Restore network configuration Change-Id: I73462b160ecfbaa7efe71eed905a3bbd69ee6c23 Signed-off-by: Assaf Muller <[email protected]> --- M vdsm/vdsm-restore-net-config 1 file changed, 30 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/17010/1 diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index aeac132..0a430da 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -19,12 +19,40 @@ # Refer to the README and COPYING files for full details of the license # +import json +import os + from netconf import ifcfg +from vdsm.config import config +from vdsm import netinfo +from configNetwork import setupNetworks + + +def ifcfg_restoration(): + configWriter = ifcfg.ConfigWriter() + configWriter.restorePersistentBackup() + + +def unified_restoration(): + """ + Builds a setupNetworks command from the persistent configuration to set it + as running configuration. + """ + nets = {} + bonds = {} + for netFile in os.listdir(netinfo.NET_CONF_PERS_DIR): + nets[os.path.basename(netFile)] = json.load(open(netFile)) + + for bondFile in os.listdir(netinfo.BOND_CONF_PERS_DIR): + bonds[os.path.basename(bondFile)] = json.load(open(bondFile)) + setupNetworks(nets, bonds) def main(): - configWriter = ifcfg.ConfigWriter() - configWriter.restorePersistentBackup() + if config.get('vars', 'persistence') == 'unified': + unified_restoration() + else: + ifcfg_restoration() if __name__ == '__main__': -- To view, visit http://gerrit.ovirt.org/17010 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73462b160ecfbaa7efe71eed905a3bbd69ee6c23 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Assaf Muller <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
