The nova.compute.resources.base Module

class Resource

Bases: object

This base class defines the interface used for compute resource plugins. It is not necessary to use this base class, but all compute resource plugins must implement the abstract methods found here. An instance of the plugin object is instantiated when it is loaded by calling __init__() with no parameters.

add_instance(usage)

Update resource information adding allocation according to the given resource usage.

Parameters:usage – the resource usage of the instance being added
Returns:None
remove_instance(usage)

Update resource information removing allocation according to the given resource usage.

Parameters:usage – the resource usage of the instance being removed
Returns:None
report_free()

Log free resources.

This method logs how much free resource is held by the resource plugin.

Returns:None
reset(resources, driver)

Set the resource to an initial state based on the resource view discovered from the hypervisor.

test(usage, limits)

Test to see if we have sufficient resources to allocate for an instance with the given resource usage.

Parameters:
  • usage – the resource usage of the instances
  • limits – limits to apply
Returns:

None if the test passes or a string describing the reason why the test failed

write(resources)

Write resource data to populate resources.

Parameters:resources – the resources data to be populated
Returns:None

Previous topic

The nova.compute.resource_tracker Module

Next topic

The nova.compute.rpcapi Module

Project Source

This Page