diff options
| author | Ken Pepple <ken.pepple@gmail.com> | 2011-02-11 13:53:54 -0800 |
|---|---|---|
| committer | Ken Pepple <ken.pepple@gmail.com> | 2011-02-11 13:53:54 -0800 |
| commit | 40ec6d45a25bf997ae62dbbf08494aa39f047e33 (patch) | |
| tree | 5566bf6bd6379fbb2a76b55ff69c26e874843aa5 /nova/compute | |
| parent | e4061a0f5d06dfd6136c5dda94945214cc9a2cf5 (diff) | |
updated tests and added more error checking
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/instance_types.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 0cec4812e..f0b3fe473 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -48,7 +48,7 @@ def create(name, memory, vcpus, local_gb, flavorid): flavorid=flavorid)) except exception.DBError: raise exception.ApiError(_("Cannot create instance type: %s"), - instance_type, "Invalid") + name) def destroy(name): @@ -59,9 +59,9 @@ def destroy(name): else: try: db.instance_type_destroy(context.get_admin_context(), name) - except exception.DBError: + except exception.NotFound: raise exception.ApiError(_("Unknown instance type: %s"), - instance_type, "Invalid") + name) def get_all_types(inactive=0): @@ -86,7 +86,7 @@ def get_instance_type(name): return inst_type except exception.DBError: raise exception.ApiError(_("Unknown instance type: %s"), - instance_type, "Invalid") + name) def get_by_type(instance_type): @@ -99,7 +99,7 @@ def get_by_type(instance_type): return inst_type['name'] except exception.DBError: raise exception.ApiError(_("Unknown instance type: %s"), - instance_type, "Invalid") + instance_type) def get_by_flavor_id(flavor_id): @@ -112,4 +112,4 @@ def get_by_flavor_id(flavor_id): return flavor['name'] except exception.DBError: raise exception.ApiError(_("Unknown flavor: %s"), - flavor_id, "Invalid") + flavor_id) |
