Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread nsoffer
Nir Soffer has submitted this change and it was merged.

Change subject: jobs: Add error property
..


jobs: Add error property

When a Job encounters an error, there should be a standardized way for
that error to be stored so that code working with Job objects has a
standard way to propagate the error.

Add an 'error' property to the job class which is None by default but
can contain an instance of utils.GeneralException or one of its
decendants.  If error is set, the dictionary returned by the call to
info() will contain an 'error' key.  The value of this key is a status
code (containing a standard vdsm code and message).

Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Signed-off-by: Adam Litke 
Reviewed-on: https://gerrit.ovirt.org/50354
Reviewed-by: Nir Soffer 
Reviewed-by: Shahar Havivi 
Reviewed-by: Piotr Kliczewski 
Continuous-Integration: Jenkins CI
---
M lib/vdsm/jobs.py
M tests/jobsTests.py
2 files changed, 25 insertions(+), 7 deletions(-)

Approvals:
  Piotr Kliczewski: Looks good to me, but someone else must approve
  Adam Litke: Verified
  Nir Soffer: Looks good to me, approved
  Shahar Havivi: Looks good to me, but someone else must approve
  Jenkins CI: Passed CI tests



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 5:

* Update tracker: IGNORE, no Bug-Url found
* Set MODIFIED::IGNORE, no Bug-Url found.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 3:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread shavivi
Shahar Havivi has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread piotr . kliczewski
Piotr Kliczewski has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 4: Code-Review+1

Based on the patch with schema changing my score.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 4:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/50354/2/lib/vdsm/jobs.py
File lib/vdsm/jobs.py:

Line 99:'progress': self.progress,
Line 100:'job_type': self.job_type}
Line 101: 
Line 102: if self.error:
Line 103: ret['error'] = self.error.response()
> We don't have a schema for this yet since this code is not actually exposed
The schema changes are here: https://gerrit.ovirt.org/49450
Line 104: 
Line 105: return ret
Line 106: 
Line 107: def abort(self):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-15 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 4:

Verified by running the tests (we have 96% coverage).

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: Shahar Havivi 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-14 Thread piotr . kliczewski
Piotr Kliczewski has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2: Code-Review-1

(1 comment)

https://gerrit.ovirt.org/#/c/50354/2/lib/vdsm/jobs.py
File lib/vdsm/jobs.py:

Line 99:'progress': self.progress,
Line 100:'job_type': self.job_type}
Line 101: 
Line 102: if self.error:
Line 103: ret['error'] = self.error.response()
It looks like this is api change but schema is not updated.
Line 104: 
Line 105: return ret
Line 106: 
Line 107: def abort(self):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-14 Thread alitke
Adam Litke has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2: Verified+1

(1 comment)

Verified with unit tests.

https://gerrit.ovirt.org/#/c/50354/2/lib/vdsm/jobs.py
File lib/vdsm/jobs.py:

Line 99:'progress': self.progress,
Line 100:'job_type': self.job_type}
Line 101: 
Line 102: if self.error:
Line 103: ret['error'] = self.error.response()
> It looks like this is api change but schema is not updated.
We don't have a schema for this yet since this code is not actually exposed to 
the public.  I'll add a note in https://gerrit.ovirt.org/#/c/49450 so we 
remember to add it.
Line 104: 
Line 105: return ret
Line 106: 
Line 107: def abort(self):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Dan Kenigsberg 
Gerrit-Reviewer: Francesco Romani 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: Pablo Iranzo Gómez
Gerrit-Reviewer: Piotr Kliczewski 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-12 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-11 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 2:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-11 Thread alitke
Adam Litke has uploaded a new change for review.

Change subject: jobs: Add error property
..

jobs: Add error property

When a Job encounters an error, there should be a standardized way for
that error to be stored so that code working with Job objects has a
standard way to propagate the error.

Add an 'error' property to the job class which is None by default but
can contain an instance of utils.GeneralException or one of its
decendants.  If error is set, the dictionary returned by the call to
info() will contain an 'error' key.  The value of this key is a status
code (containing a standard vdsm code and message).

Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Signed-off-by: Adam Litke 
---
M lib/vdsm/jobs.py
M tests/jobsTests.py
2 files changed, 25 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/50354/1

diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index 5949084..fc4a0c8 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -67,6 +67,7 @@
 self._id = job_id
 self._status = STATUS.RUNNING
 self._description = description
+self._error = None
 
 @property
 def id(self):
@@ -88,13 +89,20 @@
 def job_type(self):
 return self._JOB_TYPE
 
+@property
+def error(self):
+return self._error
+
 def info(self):
-return {
-'status': self.status,
-'description': self.description,
-'progress': self.progress,
-'job_type': self.job_type
-}
+ret = {'status': self.status,
+   'description': self.description,
+   'progress': self.progress,
+   'job_type': self.job_type}
+
+if self.error:
+ret['error'] = self.error.response()
+
+return ret
 
 def abort(self):
 self._status = STATUS.ABORTED
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index 373c916..4bd6343 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -19,7 +19,7 @@
 
 import uuid
 
-from vdsm import jobs, response
+from vdsm import jobs, response, utils
 
 from testlib import VdsmTestCase, expandPermutations, permutations
 
@@ -135,3 +135,13 @@
 def test_delete_unknown_job(self):
 self.assertEqual(response.error(jobs.NoSuchJob.name),
  jobs.delete('foo'))
+
+def test_job_get_error(self):
+job = TestingJob()
+self.assertIsNone(job.error)
+self.assertNotIn('error', job.info())
+
+error = utils.GeneralException()
+job._error = error
+self.assertEqual(job.error, error)
+self.assertEqual(error.response(), job.info()['error'])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: jobs: Add error property

2015-12-11 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: jobs: Add error property
..


Patch Set 1:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 
'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3f6e27bcd69db1673e5168524b0ce94f2e9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches