[Kimchi-devel] [PATCH] Fix PUT with invalid path raising 500 error

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Feb 18 08:32:51 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Update vm disk path with a non-existent path will raise 500 error,
we need to raise invalid parameter error instead.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/model/vmstorages.py | 3 +--
 tests/test_model.py            | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index 1597d49..6f03e75 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -217,5 +217,4 @@ class VMStorageModel(object):
                 stgModel.create(vm_name, backup_params)
             except:
                 pass
-
-            raise OperationFailed("KCHCDROM0009E", {'error': e.message})
+            raise
diff --git a/tests/test_model.py b/tests/test_model.py
index 859f7bd..9ec7027 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -205,7 +205,7 @@ class ModelTests(unittest.TestCase):
 
             # update path of existing cd with
             # non existent iso
-            self.assertRaises(OperationFailed, inst.vmstorage_update,
+            self.assertRaises(InvalidParameter, inst.vmstorage_update,
                               vm_name, cdrom_dev, {'path': wrong_iso_path})
 
             # update path of existing cd with
-- 
1.8.1.2




More information about the Kimchi-devel mailing list