The nova.objects.request_spec Module

class RequestSpec(context=None, **kwargs)

Bases: nova.objects.base.NovaObject

VERSION = '1.5'
availability_zone
create(*args, **kwargs)
ephemeral_gb
fields = {'availability_zone': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'num_instances': Integer(default=1,nullable=False), 'pci_requests': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'numa_topology': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'image': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'force_nodes': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'scheduler_hints': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'flavor': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'limits': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'retry': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'instance_uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'ignore_hosts': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'instance_group': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'force_hosts': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'project_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
flavor
force_hosts
force_nodes
classmethod from_components(context, instance_uuid, image, flavor, numa_topology, pci_requests, filter_properties, instance_group, availability_zone)

Returns a new RequestSpec object hydrated by various components.

This helper is useful in creating the RequestSpec from the various objects that are assembled early in the boot process. This method creates a complete RequestSpec object with all properties set or intentionally left blank.

Parameters:
  • context – a context object
  • instance_uuid – the uuid of the instance to schedule
  • image – a dict of properties for an image or volume
  • flavor – a flavor NovaObject
  • numa_topology – InstanceNUMATopology or None
  • pci_requests – InstancePCIRequests
  • filter_properties – a dict of properties for scheduling
  • instance_group – None or an instance group NovaObject
  • availability_zone – an availability_zone string
classmethod from_primitives(context, request_spec, filter_properties)

Returns a new RequestSpec object by hydrating it from legacy dicts.

Deprecated. A RequestSpec object is created early in the boot process using the from_components method. That object will either be passed to places that require it, or it can be looked up with get_by_instance_uuid. This method can be removed when there are no longer any callers. Because the method is not remotable it is not tied to object versioning.

That helper is not intended to leave the legacy dicts kept in the nova codebase, but is rather just for giving a temporary solution for populating the Spec object until we get rid of scheduler_utils’ build_request_spec() and the filter_properties hydratation in the conductor.

Parameters:
  • context – a context object
  • request_spec – An old-style request_spec dictionary
  • filter_properties – An old-style filter_properties dictionary
classmethod get_by_instance_uuid(context, *args, **kwargs)
get_scheduler_hint(hint_name, default=None)

Convenient helper for accessing a particular scheduler hint since it is hydrated by putting a single item into a list.

In order to reduce the complexity, that helper returns a string if the requested hint is a list of only one value, and if not, returns the value directly (ie. the list). If the hint is not existing (or scheduler_hints is None), then it returns the default value.

Parameters:
  • hint_name – name of the hint
  • default – the default value if the hint is not there
id
ignore_hosts
image
instance_group
instance_uuid
limits
memory_mb
num_instances
numa_topology
pci_requests
project_id
reset_forced_destinations()

Clears the forced destination fields from the RequestSpec object.

This method is for making sure we don’t ask the scheduler to give us again the same destination(s) without persisting the modifications.

retry
root_gb
save(*args, **kwargs)
scheduler_hints
swap
to_legacy_filter_properties_dict()

Returns a legacy filter_properties dict from the RequestSpec object.

Since we need to manage backwards compatibility and rolling upgrades within our RPC API, we need to accept to provide an helper for primitiving the right RequestSpec object into a legacy dict until we drop support for old Scheduler RPC API versions. If you don’t understand why this method is needed, please don’t use it.

to_legacy_request_spec_dict()

Returns a legacy request_spec dict from the RequestSpec object.

Since we need to manage backwards compatibility and rolling upgrades within our RPC API, we need to accept to provide an helper for primitiving the right RequestSpec object into a legacy dict until we drop support for old Scheduler RPC API versions. If you don’t understand why this method is needed, please don’t use it.

vcpus
class SchedulerLimits(context=None, **kwargs)

Bases: nova.objects.base.NovaObject

VERSION = '1.0'
disk_gb
fields = {'numa_topology': Object(default=None,nullable=True), 'disk_gb': Integer(default=None,nullable=True), 'vcpu': Integer(default=None,nullable=True), 'memory_mb': Integer(default=None,nullable=True)}
classmethod from_dict(limits_dict)
memory_mb
numa_topology
to_dict()
vcpu
class SchedulerRetries(context=None, **kwargs)

Bases: nova.objects.base.NovaObject

VERSION = '1.1'
fields = {'hosts': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'num_attempts': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
classmethod from_dict(context, retry_dict)
hosts
num_attempts
to_dict()

Previous topic

The nova.objects.quotas Module

Next topic

The nova.objects.resource_provider Module

Project Source

This Page