diff options
author | 2017-07-18 13:48:14 +0000 | |
---|---|---|
committer | 2017-07-18 13:48:14 +0000 | |
commit | 2d08ff42b777b5b0e0f7c82c32919834ae633382 (patch) | |
tree | b133de82fa64edfc89df3c3d439dcf85c92fd92d | |
parent | 0050ed771d89f6a758a387a930feeb616dceecec (diff) | |
parent | 7e17a9046eca9fe7883a9768f9f1641c9fdf4e29 (diff) |
Merge "Created new class NovaException."
-rw-r--r-- | snaps/openstack/utils/nova_utils.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/snaps/openstack/utils/nova_utils.py b/snaps/openstack/utils/nova_utils.py index bee526c..fd42c5d 100644 --- a/snaps/openstack/utils/nova_utils.py +++ b/snaps/openstack/utils/nova_utils.py @@ -79,9 +79,8 @@ def create_server(nova, neutron, glance, instance_settings, image_settings, flavor = get_flavor_by_name(nova, instance_settings.flavor) if not flavor: - raise Exception( - 'Flavor not found with name - %s', - instance_settings.flavor) + raise NovaException( + 'Flavor not found with name - %s', instance_settings.flavor) image = glance_utils.get_image(glance, image_settings.name) if image: @@ -99,7 +98,7 @@ def create_server(nova, neutron, glance, instance_settings, image_settings, return VmInst(name=server.name, inst_id=server.id, networks=server.networks) else: - raise Exception( + raise NovaException( 'Cannot create instance, image cannot be located with name %s', image_settings.name) @@ -482,3 +481,9 @@ def add_floating_ip_to_server(nova, vm, floating_ip, ip_addr): """ vm = __get_latest_server_os_object(nova, vm) vm.add_floating_ip(floating_ip.ip, ip_addr) + + +class NovaException(Exception): + """ + Exception when calls to the Keystone client cannot be served properly + """ |