Nova Update Available Resource
Currently Nova tracks available resources by using a resource tracker (nova/compute/resource_tracker.py) to audit available resources using instance information from the DB. The function update_available_resource uses the available resources stats reported from the compute driver, subtracts instance usage and reports the stats to the DB. Although usage stats are are also reported from the driver, the resource driver ignores these values. Essentially, Nova ignores the hypervisor's view of resource usage. As a result, there can be cases where incorrect stats about available resources are exposed to the scheduler. For example, any software updates to the hypervisor that result in extra consumption of disk/memory are not accounted for at all.
In order to achieve more correctness for available resource stats, the usage stats returned from the compute driver must be honored (hypervisor view of resources). The proposal enables the resource tracker to have the option to derive usage stats directly from the compute driver without auditing. As a result, more efficiency and correctness are achieved. Since usage stats are not computed twice.
There will be a flag variable in the nova.conf file that enables this functionality. A new function will be added to nova/compute/resource_tracker.py to use the stats returned by the compute driver directly and will honor memory reservations, in order to update available resources. Additionally, some minor adjustments might be required to different compute drivers.