Dan Kenigsberg has uploaded a new change for review.
Change subject: network: store non-Vdsm ifcfgs with unified persistence
......................................................................
network: store non-Vdsm ifcfgs with unified persistence
Unified restoration first removes everything in the running config and
then tries to regenerate everything that's in the persisted config,
problem is, that original devices are not persisted.
In this patch we (temporarily) use ifcfg persistence for non-Vdsm devices
(even when unified persistence is set), so we are able to restore them.
Change-Id: Iaac0d82863334238e6db71b4a6a4f6b76a260223
Bug-Url:
https://bugzilla.redhat.com/1188251
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
Reviewed-on:
http://gerrit.ovirt.org/37453
Reviewed-by: Ondřej Svoboda <osvoboda(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/network/configurators/ifcfg.py
M vdsm/vdsm-restore-net-config
M vdsm/vdsm-store-net-config.in
3 files changed, 25 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/38240/1
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 87fd849..d1f65a4 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -358,6 +358,9 @@
self._atomicBackup(filename)
if config.get('vars', 'net_persistence') != 'unified':
self._persistentBackup(filename)
+ elif not self._ownedIfcfg(filename):
+ # Backup non-VDSM network devices (BZ#1188251)
+ self._persistentBackup(filename)
def _atomicBackup(self, filename):
"""
@@ -472,19 +475,23 @@
logging.info('Loaded %s', fpath)
+ def _ownedIfcfg(self, fpath):
+ if not os.path.isfile(fpath):
+ return False
+ try:
+ with open(fpath) as confFile:
+ content = confFile.readline()
+ except IOError as e:
+ if e.errno == os.errno.ENOENT:
+ return False
+ else:
+ raise
+ if content.startswith(self.CONFFILE_HEADER_BASE):
+ return True
+
def _ownedFiles(self):
for fpath in glob.iglob(netinfo.NET_CONF_DIR + '/*'):
- if not os.path.isfile(fpath):
- continue
- try:
- with open(fpath) as confFile:
- content = confFile.read()
- except IOError as e:
- if e.errno == os.errno.ENOENT:
- continue
- else:
- raise
- if content.startswith(self.CONFFILE_HEADER_BASE):
+ if self._ownedIfcfg(fpath):
yield fpath
def loadBackups(self):
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 4eddf49..974ffc8 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -61,6 +61,10 @@
for configurator_cls in _get_all_configurators():
configurator_cls().flush()
+ # Restore non-VDSM network devices (BZ#1188251)
+ configWriter = ifcfg.ConfigWriter()
+ configWriter.restorePersistentBackup()
+
persistentConfig = PersistentConfig()
nets, bonds = _filter_nets_bonds(persistentConfig.networks,
persistentConfig.bonds)
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/vdsm-store-net-config.in
index 94e658b..c19d5e0 100755
--- a/vdsm/vdsm-store-net-config.in
+++ b/vdsm/vdsm-store-net-config.in
@@ -46,6 +46,9 @@
}
unified_nonnode_persist() {
+ # Remove stored non-VDSM network devices (BZ#1188251)
+ ifcfg_nonnode_persist
+
# Atomic directory copy by using the atomicity of overwriting a link
# (rename syscall).
TIMESTAMP=$(date +%s%N)
--
To view, visit
https://gerrit.ovirt.org/38240
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaac0d82863334238e6db71b4a6a4f6b76a260223
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>