Nir Soffer has posted comments on this change.

Change subject: alerts: Introduce the alerts module
......................................................................


Patch Set 2:

(1 comment)

Piotr, code generating alerts will return them to engine. We have existing code 
when getting information about domains, and new code (next patch), returning 
alerts after successful connection to storage server.

In the future, we can use events to send these alerts. This is just the way to 
keep alert information until you deliver it to engine in whatever way, similar 
to storage/storage_exception.py and lib/vdsm/exception.py.

https://gerrit.ovirt.org/#/c/49474/2/lib/vdsm/alerts.py
File lib/vdsm/alerts.py:

Line 25:     def __str__(self):
Line 26:         return self.message.format(self=self)
Line 27: 
Line 28:     def info(self):
Line 29:         return {'code': self.code, 'message': str(self)}
> this really seems a response objects, as we seen in many other places. If s
response returns {status: {"code": ..., "message": ...}}

This is not a response, but the response status.

info() is a genric name when you return a dictionary describing some object. We 
can use other name like todict() or asdict() but I like info more. See for 
example the jobs module.

We certainly don't want to use the response module, which is a temporary hack 
needed because virt does not have proper exceptions with a response() method. 
We will be able to drop it when we finish 
https://gerrit.ovirt.org/#/q/status:open+topic:exceptions
Line 30: 
Line 31: 
Line 32: class UnsupportedReplicaCount(Alert):
Line 33:     code = 7000


-- 
To view, visit https://gerrit.ovirt.org/49474
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6874f2ec39294888de01ba0a5c6e9d1d1a42c63b
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ah...@redhat.com>
Gerrit-Reviewer: Adam Litke <ali...@redhat.com>
Gerrit-Reviewer: Ala Hino <ah...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Freddy Rolland <froll...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to