Mark Wu has posted comments on this change.
Change subject: netconf: Improve unified persistence's rollback in memory.
......................................................................
Patch Set 3:
(4 comments)
Thanks a lot for your insightful review! I will post a new patch in a few days.
....................................................
File tests/functional/networkTests.py
Line 1514: self.assertNetworkExists(networks[0])
Line 1515:
Line 1516: # Submit a transaction composed of removing the created
network
Line 1517: # above, creating two new networks with good params and bad
Line 1518: # params separately.
Done
Line 1519: status, msg = self.vdsm_net.setupNetworks({networks[0]:
Line 1520: dict(remove=True),
Line 1521: networks[1]:
Line 1522: attrs[1],
....................................................
File vdsm/netconf/__init__.py
Line 71: self.runningConfig.save()
Line 72: self.runningConfig = None
Line 73:
Line 74: def flush(self):
Line 75: libvirtCfg.flush()
Done
Line 76:
Line 77: def configureBridge(self, bridge, **opts):
Line 78: raise NotImplementedError
Line 79:
....................................................
File vdsm/vdsm-restore-net-config
Line 67:
Line 68:
Line 69: def restore_from_memory(liveConfig):
Line 70: assert config.get('vars', 'persistence') ==
'unified'
Line 71: lastConfig = RunningConfig() # snapshot of running config on disk
Done
Line 72:
Line 73: def get_restore_configs(liveConfig, lastConfig):
Line 74: restoreConfigs = {}
Line 75: for name in liveConfig:
Line 84: nets = get_restore_configs(liveConfig.networks, lastConfig.networks)
Line 85: bonds = get_restore_configs(liveConfig.bonds, lastConfig.bonds)
Line 86: logging.debug("Calling setupNetworks with networks: %s, bondings:
%s" %
Line 87: (nets, bonds))
Line 88: setupNetworks(nets, bonds, connectivityCheck=False)
My thought of solving this problem is adding a new arg to setupNetworks to indicate
it's called in a normal api flow or the context of except handling, and do the final
restore like you suggest in Configurator.__exit__. Maybe the new arg is not necessary,
we can tell the exception depth by exploring its stack frames. I am going to look into
it.
Line 89:
Line 90:
Line 91: if __name__ == '__main__':
Line 92: try:
--
To view, visit
http://gerrit.ovirt.org/20032
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I7436976d8bacbfaa1c4b059c71c4abb46192f99a
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes