Tuesday, 25 August 2015

Thursday, 23 July 2015

Host aggregates and availability zones in Openstack

 HOST AGGREGATES AND AVAILABILITY ZONES:

Host Aggregates:
It is a mechanism by which we separate hosts and form a group of hosts in Openstack cloud. this grouping decision can be made on the basis of additional arbitrary characteristics. Host aggregates are only known to administrators. So, Administrators map flavors to host aggregates by setting some metadata on the host aggregates. The scheduler is used to match user requests for the instance of given flavor of a host aggregate with the same key value pair in its metadata. 

 Availability Zones:
Unlike host aggregates, they can be explicitly exposed to user. Only administrator have this right as a option in which host aggregates can be exposed as availability zone. Administrators can configure a default availability zone where instances will be scheduled when the user fails to specify one.  

 COMMAND-LINE INTERFACE
The Nova command-line tool supports the following aggregate-related commands.
  • nova aggregate-list 
     This command will list all the aggregates
  •  nova aggregate-create <name> [availability-zone]
   Create a new aggregate named <name>, and optionally in availability zone [availability-zone] if specified. The command returns the ID of the newly created aggregate. Hosts can be made available to multiple host aggregates. Be careful when adding a host to an additional host aggregate when the host is also in an availability zone. Pay attention when using the aggregate-set-metadata and aggregate-update commands to avoid user confusion when they boot instances in different availability zones. An error occurs if you cannot add a particular host to an aggregate zone for which it is not intended.
  • nova aggregate-delete <id>
         This will delete an aggregate with id <id>
  • nova aggregate-details <id>
         Show details of the aggregate with id <id>
  • nova aggregate-add-host <id> <host>
         Add host with name <host> to aggregate with id <id>  
  •  nova aggregate-remove-host <id> <host>
Remove the host with name <host> from the aggregate with id <id>.
  • nova aggregate-set-metadata <id> <key=value> [<key=value> ...]
Add or update metadata (key-value pairs) associated with the aggregate with id <id>.
  • nova aggregate-update <id> <name> [<availability_zone>]
Update the name and availability zone (optional) for the aggregate.

  • nova host-list
List all hosts by service.
  • nova host-update --maintenance [enable | disable]
Put/resume host into/from maintenance.
  
 Configure scheduler to support host aggregates:

One
 


Available filters in Openstack Nova-scheduler

List of Available Filters:

1.  AggregateCoreFilter: 

Filters host by number of instances with a per-aggregate max_instances_per_host value. If the per-aggregate value is not found, the value falls back to the global setting. If the host is in more than one aggregate and thus more than one value is found, the minimum value will be used.

2. AggregateRamFilter:

Filters host by RAM allocation of instances with a per-aggregate ram_allocation_ratio value. If the per-aggregate value is not found, the value falls back to the global setting. If the host is in more than one aggregate and thus more than one value is found, the minimum value will be used.

3. AggregateTypeAffinityFilter:
 Filters host by per-aggregate instance_type value.

4. AllHostsFilter:
This is a no-op filter. It does not eliminate any of the available hosts.

5. AggregateImagePropertiesIsolation:

Matches properties defined in an image's metadata against those of aggregates to determine host matches:
  • If a host belongs to an aggregate and the aggregate defines one or more metadata that matches an image's properties, that host is a candidate to boot the image's instance.
  • If a host does not belong to any aggregate, it can boot instances from all images

6. AvailabilityZoneFilter:

 Filters hosts by availability zone. You must enable this filter for the scheduler to respect availability zones in requests.

7. DifferentHostFilter:

Schedules the instance on a different host from a set of instances. To take advantage of this filter, the requester must pass a scheduler hint, using different_host as the key and a list of instance UUIDs as the value. This filter is the opposite of the SameHostFilter.

There are other numerous filters as well.


Weights:








 
 

Tuesday, 21 July 2015

Research on Openstack Scheduler

Openstack Scheduling

Question:  What is nova- scheduler ?
Answer  :  The compute use this nova-scheduler service to determine how to dispatch compute requests.  So, this will determine on which host a VM(virtual machine) should be launched. The host term here refers to the physical node that has a nova-compute service running on it. Scheduler can be configured through variety of options. For example: compute node is configured with the default scheduler options in the /etc/nova/nova.conf  file.

scheduler_driver_task_period = 60
scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
scheduler_available_filters = nova.scheduler.filters.all_filters
scheduler_default_filters = RetryFilter, AvailabilityZoneFilter, RamFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter

In default configurations, scheduler_driver is configured as filter scheduler with default filters which considers only those hosts that meet all the following parameters:

Default filters:
  • Are in the requested availability zone (AvailabilityZoneFilter).
  • Have sufficient RAM available (RamFilter).
  • Can service the request (ComputeFilter).
  • Satisfy the extra specs associated with the instance type (ComputeCapabilitiesFilter).
  • Satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties (ImagePropertiesFilter).
  • Are on a different host than other instances of a group (if requested) (ServerGroupAntiAffinityFilter).
  • Are in a set of group hosts (if requested) (ServerGroupAffinityFilter).
    Have not been attempted for scheduling purposes (RetryFilter).

    { This is how scheduler caches its list of available hosts}

    Important note :  Do not configure service_down_time to be much smaller than scheduler_driver_task_period; otherwise, hosts appear to be dead while the host list is being cached.

    Other role of scheduler:
    The scheduler is responsible for selecting a new host when an instance is migrated. 
    while evacuating the instance from a host, the scheduler service consider the target host which is defined by administrator on evacuate command. But, if the target host is not defined , then the scheduler determines the target host.

    Default scheduler -Filter scheduler :

    It is a default scheduler in openstack for scheduling virtual machines instances. It supports filtering and weighting to make important decision on where a new instance should be created. Following are the few steps explaining how filters actually works:
    1.  Filter receives a request for a resource
    2.  Filters determine which hosts are eligible for consideration while dispatching a resource.
    3.  Filters are binary so either host is accepted by filter or rejected.
    4.  Host which are selected are further processed by different weighting algorithm to decide the best host for launching the VM.
    figure: Filtering 

    The scheduler_available_filters provide the list of filters to the compute service which are used by scheduler to find hosts.

    List of all available filters:

    Make your own filters:

    We can implement our own filter in python called myfilter.MyFilter  in nova.conf file.

    The scheduler_available_filters configuration option in nova.conf provides the Compute service with the list of the filters that are used by the scheduler.

    scheduler_available_filters = nova.scheduler.filters.all_filters
     
    But if I want to use both the in-built as well as my own filter then my nova.conf would look like this : 
    scheduler_available_filters = nova.scheduler.filters.all_filters
    scheduler_available_filters = myfilter.MyFilter


    and The scheduler_default_filters configuration option in nova.conf defines the list of filters that are applied by the nova-scheduler service