Change in vdsm[master]: sdm: Add create_volume job

nsoffer at redhat.com nsoffer at redhat.com
Fri Dec 11 17:02:06 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: sdm: Add create_volume job
......................................................................


Patch Set 2: Code-Review-1

(5 comments)

https://gerrit.ovirt.org/#/c/50221/2/vdsm/storage/sdm/api/sdm_job.py
File vdsm/storage/sdm/api/sdm_job.py:

Line 31: from .. import volume_artifacts
Line 32: 
Line 33: 
Line 34: class SdmJob(jobs.Job):
Line 35:     log = logging.getLogger('Storage.SdmJob')
Lets use only lowercase logger names in new code: "storage.sdmjob", or "storage.sdm"
Line 36: 
Line 37:     def __init__(self, job_id, desc, host_id):
Line 38:         super(SdmJob, self).__init__(job_id, desc)
Line 39:         self._error = None


Line 35:     log = logging.getLogger('Storage.SdmJob')
Line 36: 
Line 37:     def __init__(self, job_id, desc, host_id):
Line 38:         super(SdmJob, self).__init__(job_id, desc)
Line 39:         self._error = None
Why not move error up to Job?
Line 40:         self._progress = None
Line 41:         self.host_id = host_id
Line 42: 
Line 43:     @property


Line 45:         return self._progress
Line 46: 
Line 47:     def info(self):
Line 48:         sdm_info = super(SdmJob, self).info()
Line 49:         sdm_info['extra_info'] = {'error': self._error}
Why not add error to standard job info?
Line 50:         return sdm_info
Line 51: 
Line 52:     def run(self):
Line 53:         vars.job_id = self.id


Line 58:                                self.id, self.description)
Line 59:             self._status = jobs.STATUS.FAILED
Line 60:             self._error = e
Line 61:         except Exception as e:
Line 62:             self.log.exception("Job (id:%s desc:%s) failed",
We are using mostly (id=%s, desc=%s) in other places, and it is also the format used by Pyhton builtins such as namedtuple, so better keep this format.
Line 63:                                self.id, self.description)
Line 64:             self._error = se.GENERAL_EXCEPTION(str(e))
Line 65:             self._status = jobs.STATUS.FAILED
Line 66:         else:


Line 60:             self._error = e
Line 61:         except Exception as e:
Line 62:             self.log.exception("Job (id:%s desc:%s) failed",
Line 63:                                self.id, self.description)
Line 64:             self._error = se.GENERAL_EXCEPTION(str(e))
This returns a tuple, but we want a GeneralExcpetion instance here.
If creating a GeneralException instance works with current code (it should), lets use it.

In the future, we should raise everywhere an error which has a response() method, and kill the error handling code in storage_exception.py.
Line 65:             self._status = jobs.STATUS.FAILED
Line 66:         else:
Line 67:             self._status = jobs.STATUS.DONE


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia614059f52c9625da7841ea9fbca2b2f2375cd75
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list