]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
Remove unreachable code
authordineshbhor <dinesh.bhor@nttdata.com>
Tue, 1 Nov 2016 11:37:50 +0000 (17:07 +0530)
committerdineshbhor <dinesh.bhor@nttdata.com>
Tue, 1 Nov 2016 11:37:50 +0000 (17:07 +0530)
If the host list from database is empty compute_node_get_all_by_host()
db api itself raises ComputeHostNotFound exception. There is no need to
check for empty list and raise ComputeHostNotFound exception explicitly.

TrivialFix

Change-Id: Ia466f15ff8c291f7772fcde2304888f9487fa2a8

nova/compute/api.py

index 916b0b21414421af9b46cddeead6f44dff8ac406..75e8eea815ea0b479ab551cc9491d286fabfa5bc 100644 (file)
@@ -3661,8 +3661,6 @@ class API(base.Base):
         # NOTE(sbauza): Force is a boolean by the new related API version
         if force is False and host_name:
             nodes = objects.ComputeNodeList.get_all_by_host(context, host_name)
-            if not nodes:
-                raise exception.ComputeHostNotFound(host=host_name)
             # NOTE(sbauza): Unset the host to make sure we call the scheduler
             host_name = None
             # FIXME(sbauza): Since only Ironic driver uses more than one
@@ -3808,8 +3806,6 @@ class API(base.Base):
         # NOTE(sbauza): Force is a boolean by the new related API version
         if force is False and host:
             nodes = objects.ComputeNodeList.get_all_by_host(context, host)
-            if not nodes:
-                raise exception.ComputeHostNotFound(host=host)
             # NOTE(sbauza): Unset the host to make sure we call the scheduler
             host = None
             # FIXME(sbauza): Since only Ironic driver uses more than one