diff options
| author | Ken Pepple <ken.pepple@gmail.com> | 2011-04-22 14:16:16 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-04-22 14:16:16 +0000 |
| commit | 8af2a2d720b97ef17565d57a9b8b028d449a9c84 (patch) | |
| tree | 35f6a6e53d07b90abdba5912e3f7a4fd36b61771 /nova | |
| parent | f72bc1d675e3034882bf901c2fee0491d60ce638 (diff) | |
| parent | f710ad1e3fff16de696f608986f24bdc8ffc3f6b (diff) | |
clarifies error when trying to add duplicate instance_type names or flavorids via nova-manage instance_type
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/compute/instance_types.py | 4 | ||||
| -rw-r--r-- | nova/tests/test_instance_types.py | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 98b4425c8..7e7198b96 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -56,7 +56,9 @@ def create(name, memory, vcpus, local_gb, flavorid, swap=0, rxtx_cap=rxtx_cap)) except exception.DBError, e: LOG.exception(_('DB error: %s') % e) - raise exception.ApiError(_("Cannot create instance type: %s") % name) + raise exception.ApiError(_("Cannot create instance_type with " + "name %(name)s and flavorid %(flavorid)s") + % locals()) def destroy(name): diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py index 5d6d5e1f4..dd7d0737e 100644 --- a/nova/tests/test_instance_types.py +++ b/nova/tests/test_instance_types.py @@ -88,3 +88,12 @@ class InstanceTypeTestCase(test.TestCase): """Ensures that instance type creation fails with invalid args""" self.assertRaises(exception.ApiError, instance_types.destroy, "sfsfsdfdfs") + + def test_repeated_inst_types_should_raise_api_error(self): + """Ensures that instance duplicates raises ApiError""" + new_name = self.name + "dup" + instance_types.create(new_name, 256, 1, 120, self.flavorid + 1) + instance_types.destroy(new_name) + self.assertRaises( + exception.ApiError, + instance_types.create, new_name, 256, 1, 120, self.flavorid) |
