Dan Kenigsberg has posted comments on this change.

Change subject: Adding supervdsm unit tests
......................................................................


Patch Set 10: (2 inline comments)

....................................................
File vdsm/supervdsmServer.py
Line 326:         log = logging.getLogger("SuperVdsm.Server")
Line 327:         log.warn("Could not init proper logging", exc_info=True)
Line 328: 
Line 329:     log = logging.getLogger("SuperVdsm.Server")
Line 330: 
"The parts of code that are not inside of a try block can't throw exception" 
are "famous last words". E.g. what if someone runs supervdsm with less command 
line arguments?

try-blocks should be as short as possible - with one exception: if you need to 
log exception traceback on application failure, you need to wrap all 
application logic.
Line 331:     log.debug("Making sure I'm root")
Line 332:     if os.geteuid() != 0:
Line 333:         sys.exit(errno.EPERM)
Line 334: 


Line 371:             try:
Line 372:                 chown(f, int(uid), METADATA_GROUP)
Line 373:             except IOError:
Line 374:                 log.error("Could not change file permissions", 
exc_info=True)
Line 375:                 sys.exit(1)
usually, traceback is much better for debugging. a short log can be a nice 
google-search term for laymen, but generally that's not important enough to 
make your code fragmented and cumbersome.
Line 376: 
Line 377:         log.debug("Started serving super vdsm object")
Line 378:         servThread.join()
Line 379:     except Exception:


--
To view, visit http://gerrit.ovirt.org/8600
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I08880b12db8a6ca9cc57d74d2ef2a86980a5b097
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to