Dan Kenigsberg has uploaded a new change for review.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
configNet: introduce ConfigWriter.restorePersistentBackup()
restorePersistentBackup is to be called before vdsm starts, via vdsm-restore-net-config, to load persistent backup into memory, make them effective again, and remove the backup.
This patch makes a single function out of this in order to fix the currently-broken testPersistentBackup test case.
Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M tests/configNetworkTests.py M vdsm/configNetwork.py M vdsm/vdsm-restore-net-config 3 files changed, 12 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/7463/1
diff --git a/tests/configNetworkTests.py b/tests/configNetworkTests.py index b888667..f6dc402 100644 --- a/tests/configNetworkTests.py +++ b/tests/configNetworkTests.py @@ -357,14 +357,13 @@ cw.restoreAtomicBackup() self._assertFilesRestored()
- @brokentest('Fixing this test requires more monkeypatching ' - 'than I can handle') @MonkeyPatch(os, 'chown', lambda *x: 0) def testPersistentBackup(self):
with MonkeyPatchScope([ (netinfo, 'NET_CONF_BACK_DIR', - os.path.join(self._tempdir, 'netback')) + os.path.join(self._tempdir, 'netback')), + (netinfo, 'NET_CONF_DIR', self._tempdir), ]): #after vdsm package is installed, the 'vdsm' account will be #created if no 'vdsm' account, we should skip this test @@ -380,9 +379,7 @@
self._makeFilesDirty()
- subprocess.call(['../vdsm/vdsm-restore-net-config', - '--skip-net-restart'], - env={'NET_CONF_BACK_DIR': netinfo.NET_CONF_BACK_DIR, - 'NET_CONF_DIR': self._tempdir}) + cw = configNetwork.ConfigWriter() + cw.restorePersistentBackup()
self._assertFilesRestored() diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py index 0dc5f34..62a3ccc 100755 --- a/vdsm/configNetwork.py +++ b/vdsm/configNetwork.py @@ -312,6 +312,13 @@
cls.writeBackupFile(netinfo.NET_CONF_BACK_DIR, basename, content)
+ def restorePersistentBackup(self): + """Restore network config to last known 'safe' state""" + + self.loadBackups() + self.restoreBackups() + self.clearBackups() + def _loadBackupFiles(self, loadDir, restoreDir=None): for fpath in glob.iglob(loadDir + '/*'): if not os.path.isfile(fpath): diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index a805f93..a879969 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -36,9 +36,7 @@ pass
configWriter = configNetwork.ConfigWriter() - configWriter.loadBackups() - configWriter.restoreBackups() - configWriter.clearBackups() + configWriter.restorePersistentBackup()
if __name__ == '__main__':
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/662/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/664/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Igor Lvovsky has posted comments on this change.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
Patch Set 2: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
Patch Set 2: Verified
I've verified that it has no functional side effects on Vdsm, and makes the test run.
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: configNet: introduce ConfigWriter.restorePersistentBackup() ......................................................................
configNet: introduce ConfigWriter.restorePersistentBackup()
restorePersistentBackup is to be called before vdsm starts, via vdsm-restore-net-config, to load persistent backup into memory, make them effective again, and remove the backup.
This patch makes a single function out of this in order to fix the currently-broken testPersistentBackup test case.
Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M tests/configNetworkTests.py M vdsm/configNetwork.py M vdsm/vdsm-restore-net-config 3 files changed, 12 insertions(+), 11 deletions(-)
Approvals: Dan Kenigsberg: Verified Igor Lvovsky: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7463 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I31e1f6a2cce082fcc82da37663518edec6c9d095 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org