Adam Litke has posted comments on this change.
Change subject: Refactor v2v jobs for reusability
......................................................................
Patch Set 3:
(4 comments)
https://gerrit.ovirt.org/#/c/44857/3/vdsm/jobs.py
File vdsm/jobs.py:
Line 73: _JOB_TYPE = None
Line 74:
Line 75: def __init__(self, job_id, description=''):
Line 76: self._id = job_id
Line 77: self._status = STATUS.RUNNING
Seems safer and will allow quicker merge, as we did not get any reply
on th
Done
Line 78: self._description = description
Line 79:
Line 80: @property
Line 81: def id(self):
https://gerrit.ovirt.org/#/c/44857/3/vdsm/v2v.py
File vdsm/v2v.py:
Line 45: import caps
Line 46: import jobs
Line 47:
Line 48:
Line 49: _V2V_JOB_TYPE = 'v2v'
Not needed, should be defined only in ImportVm._JOB_TYPE
I
disagree. It is used in two places: 1) when actually defining the type in the ImportVM
class, 2) When passing a filter into get_jobs_info in the jobs module.
Line 50: _V2V_DIR = os.path.join(P_VDSM_RUN, 'v2v')
Line 51: _VIRT_V2V = CommandPath('virt-v2v', '/usr/bin/virt-v2v')
Line 52: _OVF_RESOURCE_CPU = 3
Line 53: _OVF_RESOURCE_MEMORY = 4
Line 107:
Line 108: def get_jobs_status():
Line 109: all_jobs = jobs.get_jobs_status()
Line 110: return {job_id: status for (job_id, status) in all_jobs.items()
Line 111: if status['job_type'] == _V2V_JOB_TYPE}
get_job_status should have a job_type argument to allow filtering.
I'm fine with adding a filter in the jobs module, but we still need
_V2V_JOB_TYPE as this is what we would pass to that function.
Line 112:
Line 113:
Line 114: def get_external_vms(uri, username, password):
Line 115: if not supported():
Line 232: def __init__(self, vminfo, job_id, irs):
Line 233: '''
Line 234: do not use directly, use a factory method instead!
Line 235: '''
Line 236: jobs.Job.__init__(self, job_id)
Right, we should use super more:
I don't mind changing it,
but when there is simple inheritance I prefer to specify the parent class name.
Line 237: self._vminfo = vminfo
Line 238: self._irs = irs
Line 239:
Line 240: self._disk_progress = 0
--
To view, visit
https://gerrit.ovirt.org/44857
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ida6b1c460c5030c820c540e836e423d4632410df
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <mskrivan(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes