yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #87172
[Bug 1943795] [NEW] unnecessary if condition in nova/cmd/manage.py
Public bug reported:
In 'nova/cmd/manage.py' file, the function
'_check_orphaned_allocations_for_provider()' inside 'PlacementCommands'
class has below if condition:
-------------------
class PlacementCommands(object):
...
...
def _check_orphaned_allocations_for_provider(self, ctxt, placement,
output, provider,
delete):
...
...
# We reset the consumer type for each allocation
consumer_type = None
# This is an allocation for Nova resources
# We need to guess whether the instance was deleted
# or if the instance is currently migrating
if not (consumer_uuid in inst_uuids or
consumer_uuid in mig_uuids):
# By default we suspect the orphaned allocation was for a
# migration...
consumer_type = 'migration'
if not(consumer_uuid in inst_uuids):
# ... but if we can't find it either for an instance,
# that means it was for this.
consumer_type = 'instance'
...
--------------------
Refer:
https://github.com/openstack/nova/blob/master/nova/cmd/manage.py#L2546-L2554
The first 'if' condition will be 'true' only when :
1. 'consumer_uuid' is not present in 'inst_uuids' and
2. 'consumer_uuid' is not present in 'mig_uuids'
Once this is true, the 'if' condition inside will always be 'true'. So,
the 'consumer_type' will always be set to 'instance'. It will never be
set to 'migration'.
** Affects: nova
Importance: Undecided
Status: New
** Tags: nova-manage
** Tags added: nova-manage
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1943795
Title:
unnecessary if condition in nova/cmd/manage.py
Status in OpenStack Compute (nova):
New
Bug description:
In 'nova/cmd/manage.py' file, the function
'_check_orphaned_allocations_for_provider()' inside
'PlacementCommands' class has below if condition:
-------------------
class PlacementCommands(object):
...
...
def _check_orphaned_allocations_for_provider(self, ctxt, placement,
output, provider,
delete):
...
...
# We reset the consumer type for each allocation
consumer_type = None
# This is an allocation for Nova resources
# We need to guess whether the instance was deleted
# or if the instance is currently migrating
if not (consumer_uuid in inst_uuids or
consumer_uuid in mig_uuids):
# By default we suspect the orphaned allocation was for a
# migration...
consumer_type = 'migration'
if not(consumer_uuid in inst_uuids):
# ... but if we can't find it either for an instance,
# that means it was for this.
consumer_type = 'instance'
...
--------------------
Refer:
https://github.com/openstack/nova/blob/master/nova/cmd/manage.py#L2546-L2554
The first 'if' condition will be 'true' only when :
1. 'consumer_uuid' is not present in 'inst_uuids' and
2. 'consumer_uuid' is not present in 'mig_uuids'
Once this is true, the 'if' condition inside will always be 'true'.
So, the 'consumer_type' will always be set to 'instance'. It will
never be set to 'migration'.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1943795/+subscriptions