unnecessary if condition in nova/cmd/manage.py
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
In Progress
|
Low
|
Rajesh Tailor |
Bug Description
In 'nova/cmd/
-------------------
class PlacementComman
...
...
def _check_
...
...
# We reset the consumer type for each allocation
# 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
# By default we suspect the orphaned allocation was for a
# 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.
...
-------
Refer: https:/
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'.
tags: | added: nova-manage |
Changed in nova: | |
assignee: | nobody → Rajesh Tailor (ratailor) |
Analysis looks correct. Feel free to propose a small patch to remove the unnecessary if.