Vinzenz Feenstra has posted comments on this change. Change subject: Refactor VM._guestSockCleanup into utils.rmFileAndLink ......................................................................
Patch Set 3: (3 comments) http://gerrit.ovirt.org/#/c/26479/3/tests/utilsTests.py File tests/utilsTests.py: Line 487: Line 488: Line 489: class RmFileAndLinkTests(TestCaseBase): Line 490: def testFileAndLinkRemoval(self): Line 491: with namedTemporaryDir('/tmp') as path: > minor nit: if you don't care where the temporary directory is created, pass Yeah i should remove that '/tmp' it makes also too much assumptions of the environment. Line 492: filePath = os.path.join(path, 'file') Line 493: linkPath = os.path.join(path, 'link') Line 494: with open(filePath, 'w') as f: Line 495: f.write("test-file") Line 521: self.assertFalse(os.path.exists(filePath)) Line 522: utils.rmFileAndLink(linkPath) Line 523: self.assertFalse(os.path.exists(linkPath)) Line 524: Line 525: def testNonExistentPath(self): > nit: please be a bit more explicit about the success conditions of this tes Well it should not throw an exception :D I can put a comment there, if this is required. Line 526: with namedTemporaryDir('/tmp') as path: Line 527: nonExistentPath = os.path.join(path, 'somefile') http://gerrit.ovirt.org/#/c/26479/3/vdsm/virt/vm.py File vdsm/virt/vm.py: Line 2690: Line 2691: if name not in _AGENT_CHANNEL_DEVICES: Line 2692: continue Line 2693: Line 2694: if os.path.islink(path): > should use rmFile here as well…. Here I only care about removing the symlink if it exists, rmFile is not beneficial at all. Line 2695: os.unlink(path) Line 2696: Line 2697: socketPath = self._makeChannelPath(name) Line 2698: if path != socketPath: -- To view, visit http://gerrit.ovirt.org/26479 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I749d5e15c91e0046ac700d2eec7220aa7cbd8ac2 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
