Fix raise on Snapshot initialization

We were calling "raise" directly when initialization of a Snapshot
failed due to the backend provided, but we were not within an "Except"
caluse, so it was incorrect.

This patch ensure we raise an appropriate ValueError exception.
This commit is contained in:
Gorka Eguileor 2019-02-18 17:01:44 +01:00
parent 44dd49643b
commit 3c80321dd2
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,13 @@
History
=======
0.3.9 (2019-02-18)
------------------
- Bug fixes:
- Incorrect raise on Snapshot initialization backend errors.
0.3.8 (2019-02-15)
------------------

View File

@ -860,10 +860,10 @@ class Snapshot(NamedObject, LazyVolumeAttr):
backend = param_backend and param_backend.id
if not (backend or param_backend):
raise
raise ValueError('Backend not provided')
if backend and param_backend and param_backend.id != backend:
raise
raise ValueError("Multiple backends provided and they don't match")
super(Snapshot, self).__init__(backend=param_backend or backend,
**kwargs)