Table Of Contents

Previous topic

API Endpoint

Next topic

Fake Drivers

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.1 docs or all OpenStack docs too.

Scheduler

The nova.scheduler.manager Module

Scheduler Service

class nova.scheduler.manager.SchedulerManager(scheduler_driver=None, *args, **kwargs)

Bases: nova.manager.Manager

Chooses a host to run instances on.

SchedulerManager.get_zone_capabilities(context=None, service=None)

Get the normalized set of capabilites for this zone, or for a particular service.

SchedulerManager.get_zone_list(context=None)

Get a list of zones from the ZoneManager.

SchedulerManager.periodic_tasks(context=None)

Poll child zones periodically to get status.

SchedulerManager.show_host_resources(context, host, *args)

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}

SchedulerManager.update_service_capabilities(context=None, service_name=None, host=None, capabilities={})

Process a capability update from a service node.

The nova.scheduler.driver Module

Scheduler base class that all Schedulers should inherit from

exception nova.scheduler.driver.NoValidHost(message=None)

Bases: nova.exception.Error

There is no valid host for the command.

class nova.scheduler.driver.Scheduler

Bases: object

The base class that all Scheduler clases should inherit from.

Scheduler.assert_compute_node_has_enough_resources(context, instance_ref, dest)

Checks if destination host has enough resource for live migration.

Currently, only memory checking has been done. If storage migration(block migration, meaning live-migration without any shared storage) will be available, local storage checking is also necessary.

Parameters:
  • context – security context
  • instance_ref – nova.db.sqlalchemy.models.Instance object
  • dest – destination host
Scheduler.hosts_up(context, topic)

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

Scheduler.mounted_on_same_shared_storage(context, instance_ref, dest)

Check if the src and dest host mount same shared storage.

At first, dest host creates temp file, and src host can see it if they mounts same shared storage. Then src host erase it.

Parameters:
  • context – security context
  • instance_ref – nova.db.sqlalchemy.models.Instance object
  • dest – destination host
Scheduler.schedule(context, topic, *_args, **_kwargs)

Must override at least this method for scheduler to work.

Scheduler.schedule_live_migration(context, instance_id, dest)

Live migration scheduling method.

Parameters:
  • context
  • instance_id
  • dest – destination host
Returns:

The host where instance is running currently. Then scheduler send request that host.

static Scheduler.service_is_up(service)

Check whether a service is up based on last heartbeat.

Scheduler.set_zone_manager(zone_manager)

Called by the Scheduler Service to supply a ZoneManager.

exception nova.scheduler.driver.WillNotSchedule(message=None)

Bases: nova.exception.Error

The specified host is not up or doesn’t exist.

The nova.scheduler.chance Driver

Chance (Random) Scheduler implementation

class nova.scheduler.chance.ChanceScheduler

Bases: nova.scheduler.driver.Scheduler

Implements Scheduler as a random node selector.

ChanceScheduler.schedule(context, topic, *_args, **_kwargs)

Picks a host that is up at random.

The nova.scheduler.simple Driver

Simple Scheduler

class nova.scheduler.simple.SimpleScheduler

Bases: nova.scheduler.chance.ChanceScheduler

Implements Naive Scheduler that tries to find least loaded host.

SimpleScheduler.schedule_create_volume(context, volume_id, *_args, **_kwargs)

Picks a host that is up and has the fewest volumes.

SimpleScheduler.schedule_run_instance(context, instance_id, *_args, **_kwargs)

Picks a host that is up and has the fewest running instances.

SimpleScheduler.schedule_set_network_host(context, *_args, **_kwargs)

Picks a host that is up and has the fewest networks.

Tests

The scheduler_unittest Module