The nova.compute.resource_tracker Module

Track resources like memory and disk for a compute host. Provides the scheduler with useful information about availability through the ComputeNode model.

class Claim(instance, timeout)

Bases: object

A declaration that a compute host operation will require free resources.

This information will be used to help keep the local compute hosts’s ComputeNode model in sync to aid the scheduler in making efficient / more correct decisions with respect to host selection.

claim_id
disk_gb
is_expired()

Determine if this adjustment is old enough that we can assume it’s no longer needed.

memory_mb
vcpus
class ResourceContextManager(context, claim, tracker)

Bases: object

class ResourceTracker(host, driver)

Bases: object

Compute helper class for keeping track of resource usage as instances are built and destroyed.

abort_resource_claim(*args, **kwargs)

Indicate that the operation that claimed the resources identified by ‘claim_id’ has either failed or been aborted and the resources are no longer needed.

Parameters:claim – A claim ticket indicating a set of resources that were previously claimed.
begin_resource_claim(*args, **kwargs)

Indicate that some resources are needed for an upcoming compute instance build operation.

This should be called before the compute node is about to perform an instance build operation that will consume additional resources.

Parameters:
  • context – security context
  • instance_ref – instance to reserve resources for
  • limits – Dict of oversubscription limits for memory, disk, and CPUs.
  • timeout – How long, in seconds, the operation that requires these resources should take to actually allocate what it needs from the hypervisor. If the timeout is exceeded, the new resource claim will assume caller before releasing the resources.
Returns:

An integer ‘claim ticket’. This should be turned into finalize a resource claim or free resources after the compute operation is finished. Returns None if the claim failed.

disabled
finish_resource_claim(*args, **kwargs)

Indicate that the compute operation that previously claimed the resources identified by ‘claim’ has now completed and the resources have been allocated at the virt layer.

Calling this keeps the available resource data more accurate and timely than letting the claim timeout elapse and waiting for update_available_resource to reflect the changed usage data.

Parameters:claim – A claim indicating a set of resources that were previously claimed.
resource_claim(context, instance_ref, limits=None)
update_available_resource(*args, **kwargs)

Override in-memory calculations of compute node resource usage based on data audited from the hypervisor layer.

Add in resource claims in progress to account for operations that have declared a need for resources, but not necessarily retrieved them from the hypervisor layer yet.

update_usage(*args, **kwargs)

Update the resource usage and stats after a change in an instance

Previous topic

The nova.compute.power_state Module

Next topic

The nova.compute.rpcapi Module

This Page