Change in vdsm[master]: Refactoring reportError func

kobi at redhat.com kobi at redhat.com
Tue Jun 10 08:16:38 UTC 2014


Kobi Ianko has posted comments on this change.

Change subject: Refactoring reportError func
......................................................................


Patch Set 5:

(2 comments)

http://gerrit.ovirt.org/#/c/28482/5/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 4492:             return {'status': doneCode}
Line 4493: 
Line 4494:     def _reportError(self, key='Err', msg=None):
Line 4495:         """
Line 4496:         Print an error and return an error status.
> a more precise statement would be
Done
Line 4497:         This method should be called in cases of exception.
Line 4498:         """
Line 4499:         self.log.exception("Operation failed")
Line 4500:         if msg is None:


Line 4497:         This method should be called in cases of exception.
Line 4498:         """
Line 4499:         self.log.exception("Operation failed")
Line 4500:         if msg is None:
Line 4501:             error = errCode[key]
> by "poet" I meant the writer of the code, who decided "Err" is a proper val
since we need to protect the function, we do need a default value(maybe 'unexpected' will be good), or change a bit the function logic when no key was provided(in that case what should happen when key is not provided).

what I'm wondering is that we already had calls to this function with no key in the balloon method(there is a call: _reportError() ), did the code explode? what an I missing here?  

by explode, do you mean that the function return None(that is not good) but the system will continue to run? or that it breaks the system?
Line 4502:         else:
Line 4503:             error = {'status': {'code': errCode[key]
Line 4504:                                 ['status']['code'], 'message': msg}}
Line 4505:         return error


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I041a662f4fe02f671a7335d7eca84704443f5bee
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Kobi Ianko <kobi at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck at redhat.com>
Gerrit-Reviewer: Kobi Ianko <kobi at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list