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

alitke at redhat.com alitke at redhat.com
Fri Dec 11 21:02:07 UTC 2015


Adam Litke has posted comments on this change.

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


Patch Set 2:

(7 comments)

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

Line 32: class Job(sdm_job.SdmJob):
Line 33:     def __init__(self, job_id, host_id, dom_manifest, vol_params):
Line 34:         super(Job, self).__init__(job_id, 'create_volume', host_id)
Line 35:         self.dom_manifest = dom_manifest
Line 36:         self.vol_params = _CreateVolumeParams(vol_params)
> Why not _VolumeParameters?
Changed to _CreateVolumeInfo for symmetry with the schema.
Line 37: 
Line 38:     def _run(self):
Line 39:         self.dom_manifest.validateCreateVolumeParams(
Line 40:             self.vol_params.vol_format, self.vol_params.parent_vol_id)


Line 38:     def _run(self):
Line 39:         self.dom_manifest.validateCreateVolumeParams(
Line 40:             self.vol_params.vol_format, self.vol_params.parent_vol_id)
Line 41: 
Line 42:         self.dom_manifest.acquireDomainLock(self.host_id)
> We can use now with dom_manifest.domain_lock(self.host_id)
Done
Line 43:         try:
Line 44:             image_res_ns = sd.getNamespace(self.dom_manifest.sdUUID,
Line 45:                                            IMAGE_NAMESPACE)
Line 46:             with rmanager.acquireResource(image_res_ns, self.vol_params.img_id,


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 "sto
Done
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?
Done
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?
Done
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 fo
Done
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.
Now using utils.GeneralException
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