← Back to team overview

openstack team mailing list archive

[Nova] Questions about '_update_usage_from_instances'

 

Hi, guys.

I found something confused when I studied resource tracking in Nova. In resource_tracker.py, the function '_update_usage_from_instances()' made a clear reset to 'self.traced_instaces' and 'resources'. And then for each instance, function '_update_usage_from_instance()' is called to update resources stats .

There is the question:
Because  function '_update_usage_from_instances()' has made a clear reset, every instance passed to '_update_usage_from_instance()' must be a new instance(is_new_instance=True). And to a new instance, 'sign' is set to 1. This's just ok. But there are a special situation that instance may be deleted here. Other words, a instance may be meanwhile new and deleted. In my understanding, for deleted instance, We should do nothing in resources stats. But for deleted instance, 'sign' is set to -1, not my expected 0. 
Why? Is this a bug or something? 

Any help is appreciated. Thanks.

2012-11-14



hzguanqiang