Scheduler

The nova.scheduler.manager Module

Scheduler Service

class SchedulerManager(scheduler_driver=None, *args, **kwargs)

Bases: nova.manager.Manager

Chooses a host to run instances on.

create_volume(context, volume_id, snapshot_id, reservations=None, image_id=None)
get_backdoor_port(context)
live_migration(*args, **kwargs)
prep_resize(context, image, request_spec, filter_properties, instance, instance_type, reservations)

Tries to call schedule_prep_resize on the driver. Sets instance vm_state to ACTIVE on NoHostFound Sets vm_state to ERROR on other exceptions

run_instance(context, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties, legacy_bdm_in_spec=True)

Tries to call schedule_run_instance on the driver. Sets instance vm_state to ERROR on exceptions

select_destinations(*args, **kwargs)
select_hosts(*args, **kwargs)
show_host_resources(context, host)

Shows the physical/usage resource given by hosts.

Parameters:
  • context – security context
  • host – hostname
Returns:

example format is below:

{'resource':D, 'usage':{proj_id1:D, proj_id2:D}}
D: {'vcpus': 3, 'memory_mb': 2048, 'local_gb': 2048,
    'vcpus_used': 12, 'memory_mb_used': 10240,
    'local_gb_used': 64}

target = <Target version=2.9>

The nova.scheduler.driver Module

Scheduler base class that all Schedulers should inherit from

class Scheduler

Bases: object

The base class that all Scheduler classes should inherit from.

hosts_up(context, topic)

Return the list of hosts that have a running service for topic.

run_periodic_tasks(context)

Manager calls this so drivers can perform periodic tasks.

schedule_run_instance(context, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties, legacy_bdm_in_spec)

Must override schedule_run_instance method for scheduler to work.

select_destinations(context, request_spec, filter_properties)

Must override select_destinations method.

Returns:A list of dicts with ‘host’, ‘nodename’ and ‘limits’ as keys that satisfies the request_spec and filter_properties.
handle_schedule_error(context, ex, instance_uuid, request_spec)

On run_instance failure, update instance state and send notifications.

instance_update_db(context, instance_uuid, extra_values=None)

Clear the host and node - set the scheduled_at field of an Instance.

Returns:An Instance with the updated fields set properly.

The nova.scheduler.chance Driver

Chance (Random) Scheduler implementation

class ChanceScheduler(*args, **kwargs)

Bases: nova.scheduler.driver.Scheduler

Implements Scheduler as a random node selector.

schedule_run_instance(context, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties, legacy_bdm_in_spec)

Create and run an instance or instances.

select_destinations(context, request_spec, filter_properties)

Selects random destinations.

Tests

The scheduler_unittest Module

Table Of Contents

Previous topic

API Endpoint

Next topic

Fake Drivers

This Page