OpenStack filter应用(G版)

来源:互联网 发布:上海软件开发有限公司 编辑:程序博客网 时间:2024/05/16 18:44

AggregateInstanceExtraSpecsFilter

Filter behavior for native OpenStack

1) Matches properties defined in an instance type's extra specs against admin-defined properties on a host aggregate
2) Customer need to put AggregateInstanceExtraSpecsFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) nova-scheduler need to be restarted once /etc/nova/nova.conf related to openstack scheduler filter has been updated.

How to use this filter with native openstack cluster

Create a host aggregate

root@devstack11:/opt/stack/nova/nova/scheduler# nova aggregate-create group1 nova+----+--------+-------------------+-------+----------+| Id | Name   | Availability Zone | Hosts | Metadata |+----+--------+-------------------+-------+----------+| 1  | group1 | nova              |       |          |+----+--------+-------------------+-------+----------+

 Add a host to host aggregate

root@devstack11:/opt/stack/nova/nova/scheduler# nova aggregate-add-host 1 devstack11Aggregate 1 has been successfully updated.+----+--------+-------------------+-----------------+----------+| Id | Name   | Availability Zone | Hosts           | Metadata |+----+--------+-------------------+-----------------+----------+| 1  | group1 | nova              | [u'devstack11'] | {}       |+----+--------+-------------------+-----------------+----------+

Get host aggregate details

root@devstack11:/opt/stack/nova/nova/scheduler# nova aggregate-details 1+----+--------+-------------------+-----------------+----------+| Id | Name   | Availability Zone | Hosts           | Metadata |+----+--------+-------------------+-----------------+----------+| 1  | group1 | nova              | [u'devstack11'] | {}       |+----+--------+-------------------+-----------------+----------+

Set meta data for host aggregate

root@devstack11:/opt/stack/nova/nova/scheduler# nova  aggregate-set-metadata 1 location=xianAggregate 1 has been successfully updated.+----+--------+-------------------+-----------------+------------------------+| Id | Name   | Availability Zone | Hosts           | Metadata               |+----+--------+-------------------+-----------------+------------------------+| 1  | group1 | nova              | [u'devstack11'] | {u'location': u'xian'} |+----+--------+-------------------+-----------------+------------------------+

Set flavor extra_spec for flavors

root@devstack11:/opt/stack/nova/nova/scheduler# nova flavor-key 1 set location=xian

Get flavor details

root@devstack11:/opt/stack/nova/nova/scheduler# nova flavor-show   1+----------------------------+------------------------+| Property                   | Value                  |+----------------------------+------------------------+| OS-FLV-DISABLED:disabled   | False                  || OS-FLV-EXT-DATA:ephemeral  | 0                      || disk                       | 0                      || extra_specs                | {u'location': u'xian'} || id                         | 1                      || name                       | m1.tiny                || os-flavor-access:is_public | True                   || ram                        | 512                    || rxtx_factor                | 1.0                    || swap                       |                        || vcpus                      | 1                      |+----------------------------+------------------------+

Create new instance with this flavor

The flavor has extra_spec with location=xian, this filter will only select hypervisor hosts which has metadata with location=xian

root@devstack11:/opt/stack/nova/nova/scheduler# nova boot --image 90ba3c7e-c367-4b32-b667-d3376c8699cc --flavor 1 --availability-zone nova vm1+-------------------------------------+--------------------------------------+| Property                            | Value                                |+-------------------------------------+--------------------------------------+| OS-DCF:diskConfig                   | MANUAL                               || OS-EXT-SRV-ATTR:host                | None                                 || OS-EXT-SRV-ATTR:hypervisor_hostname | None                                 || OS-EXT-SRV-ATTR:instance_name       | instance-00000034                    || OS-EXT-STS:power_state              | 0                                    || OS-EXT-STS:task_state               | scheduling                           || OS-EXT-STS:vm_state                 | building                             || accessIPv4                          |                                      || accessIPv6                          |                                      || adminPass                           | JNxnQpuGi69v                         || config_drive                        |                                      || created                             | 2012-10-10T00:29:58Z                 || flavor                              | m1.tiny                              || hostId                              |                                      || id                                  | 874e088a-4fd5-4ebf-8468-b05357f24142 || image                               | cirros-0.3.0-x86_64-uec              || key_name                            | None                                 || metadata                            | {}                                   || name                                | vm1                                  || progress                            | 0                                    || security_groups                     | [{u'name': u'default'}]              || status                              | BUILD                                || tenant_id                           | af9248a2bc4b41409c8e1d26c1dc5a75     || updated                             | 2012-10-10T00:29:58Z                 || user_id                             | 4f28da23c98b456aa3520c88dd7c2b8c     |+-------------------------------------+--------------------------------------+

ComputeFilter

Filter behavior for native OpenStack

1) Passes the hosts that capabilities was enabled and nova-compute service was up.
2) If capabilities did not set for the host capabilities, ComputeFilter will set its value as True.
3) Customer need to put ComputeFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

ComputeCapabilitiesFilter

Filter behavior for native OpenStack

1) Checks that the capabilities provided by nova-compute service satisfy any extra specifications associated with the instance type
2) Customer need to put ComputeCapabilitiesFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

How to use this filter with native openstack cluster.

root@devstack11:~# nova flavor-key 1 set vcpus='>= 6'root@devstack11:~# nova flavor-key 1 set vcpus_used='== 0'root@devstack11:~# nova flavor-show 1+----------------------------+---------------------------------------------+| Property                   | Value                                       |+----------------------------+---------------------------------------------+| OS-FLV-DISABLED:disabled   | False                                       || OS-FLV-EXT-DATA:ephemeral  | 0                                           || disk                       | 0                                           || extra_specs                | {u'vcpus': u'>= 6', u'vcpus_used': u'== 0'} | | id                         | 1                                           || name                       | m1.tiny                                     || os-flavor-access:is_public | True                                        || ram                        | 512                                         || rxtx_factor                | 1.0                                         || swap                       |                                             || vcpus                      | 1                                           |+----------------------------+---------------------------------------------+root@devstack11:~# nova boot --image cirros-0.3.0-x86_64-uec --flavor 1 vm1+-------------------------------------+--------------------------------------+| Property                            | Value                                |+-------------------------------------+--------------------------------------+| OS-DCF:diskConfig                   | MANUAL                               || OS-EXT-SRV-ATTR:host                | None                                 || OS-EXT-SRV-ATTR:hypervisor_hostname | None                                 || OS-EXT-SRV-ATTR:instance_name       | instance-0000008d                    || OS-EXT-STS:power_state              | 0                                    || OS-EXT-STS:task_state               | scheduling                           || OS-EXT-STS:vm_state                 | building                             || accessIPv4                          |                                      || accessIPv6                          |                                      || adminPass                           | RLMtQeQgtX5D                         || config_drive                        |                                      || created                             | 2012-11-15T05:35:21Z                 || flavor                              | m1.tiny                              || hostId                              |                                      || id                                  | 3e440fe5-0419-401a-bcde-dd6ac2bfeace || image                               | cirros-0.3.0-x86_64-uec              || key_name                            | None                                 || metadata                            | {}                                   || name                                | vm1                                  || progress                            | 0                                    || security_groups                     | [{u'name': u'default'}]              || status                              | BUILD                                || tenant_id                           | aa6aefa203974efcaa5ab627f48b3175     || updated                             | 2012-11-15T05:35:21Z                 || user_id                             | cd181f707602470c92901affd0954e02     |+-------------------------------------+--------------------------------------+

CoreFilter

Filter behavior for native OpenStack

1) Only schedule instances on hosts if there are sufficient CPU cores available. If this filter is set, host cores can be over committed
2) Customer need to put CoreFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) Corefilter was controlled by FLAGS.cpu_allocation_ratio. The default value of FLAGS.cpu_allocation_ratio is 16.0. This means that if there is only 1 CPU core for the hypervisor, then the VM instances can use up 16 virtual vcpus.

RamFilter

Filter behavior for native OpenStack

1) Only schedule instances on hosts if there is sufficient RAM available. If this filter is set, host RAM can be over committed
2) Ramfilter was controlled by FLAGS. ram_allocation_ratio. The default value of FLAGS. ram_allocation_ratio is 1.5. This means that if there are 1024M RAM for the hypervisor, then the VM instances can use up 1536M RAM.
3) Customer need to put RamFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

DiskFilter

Filter behavior for native OpenStack

1) Only schedule instances on hosts if there is sufficient disk available. If this filter is set, host disk can be over committed
2) Diskfilter was controlled by FLAGS. disk_allocation_ratio. The default value of FLAGS. disk_allocation_ratio is 1. If customer set this value as 2, it means that if there are 10G disk for the hypervisor, then the VM instances can use 20G disks.
3)  Customer need to put DiskFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

SameHostFilter

Filter behavior for native OpenStack

1) Deploy VM instance on to same hypervisor host with current exist VM instance(s).
2) Customer need to put SameHostFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

How to use this filter with native openstack cluster.

1)

nova boot --image 90ba3c7e-c367-4b32-b667-d3376c8699cc --flavor 1 --hint same_host='1ecae5f8-f256-4d1e-871f-68f237f368ad' vm2

2) The above command means that customer want to create a new VM instance named as vm2 and deploy the VM instance on the same hypervisor host with current exist VM instance ‘1ecae5f8-f256-4d1e-871f-68f237f368ad’
3) SameHostFilter is a MUST if customer create VM instance with same_host option, this means that if openstack scheduler cannot deploy the new VM instance on the same node with current exist VM instance, then the request will be failed.

DifferentHostFilter

Filter behavior for native OpenStack

1) Deploy VM instance on to different hypervisor host with current exist VM instance(s).
2) Customer need to put DifferentHostFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

How to use this filter with native openstack cluster.

1)

nova boot --image 90ba3c7e-c367-4b32-b667-d3376c8699cc --flavor 1 --hint different_host='1ecae5f8-f256-4d1e-871f-68f237f368ad' vm2

2) The above command means that customer want to create a new VM instance named as vm2 and deploy the VM instance on to different hypervisor host with current exist VM instance ‘1ecae5f8-f256-4d1e-871f-68f237f368ad’
3) DifferentHostFilter is a MUST if customer create VM instance with different_host option, this means that if openstack scheduler cannot deploy the new VM instance on to different node with current exist VM instance, then the request will be failed.

SimpleCIDRAffinityFilter

Filter behavior for native OpenStack

1) Allows to put a new instance on a host within the same IP block
2) Customer need to put SimpleCIDRAffinityFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

How to use this filter with native openstack cluster.

1)

nova boot --image 90ba3c7e-c367-4b32-b667-d3376c8699cc --flavor 1 --hint build_near_host_ip=’172.17.9.0’ –hint cidr=’/24’ vm1

2) The above command means that customer want to create a new VM instance named as vm1 and the VM instance should be created on the hypervisor hosts whose IP address with same IP mask as172.17.9.0/24.

ImagePropertiesFilter

Filter behavior for native OpenStack

1) Filters hosts based on properties defined on the instance's image, the properties include architecture, hypervisor_type and vm_mode. If the hypervisor host matches all the properties for the image, then the VM instance can be deployed on this hypervisor node.
2) Customer need to put ImagePropertiesFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) Suppose a hypervisor node supported_instances (map to image properties) were [u'i686', u'qemu', u'hvm'], [u'x86_64', u'qemu', u'hvm'] and the image properties for the requested VM instance was [u'x86_64', u'qemu', u'hvm'], then the VM instance can be deployed on this hypervisor node.
4) If the image properties for the requested VM instance was just a subset of one of the supported_instances, the VM instance can also be deployed on this hypervisor host. Suppose the image properties was  [u'x86_64', u'hvm'], the VM instance can be deployed on the hypervisor host whose supported instance were [u'i686', u'qemu', u'hvm'], [u'x86_64', u'qemu', u'hvm']

IsolatedHostsFilter

Filter behavior for native OpenStack

1) There can be some special hosts reserved for specific images. These hosts are called isolated. So the images to run on the isolated hosts are also called isolated. The scheduler plugin will check whether the image_isolated flag specified in instance specifications is the same as the host has.
2) Put IsolatedHostsFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) Put isolated_images to /etc/nova/nova.conf
4) Put isolated_hosts to /etc/nova/nova.conf

isolated_hosts=devstack11isolated_images=90ba3c7e-c367-4b32-b667-d3376c8699ccscheduler_default_filters=IsolatedHostsFilter

JsonFilter

Filter behavior for native OpenStack

1) This filter provides the opportunity to write complicated queries for the hosts capabilities filtering, based on simple JSON-like syntax. There can be used the following operations for the host states properties: ‘=’, ‘<’, ‘>’, ‘in’, ‘<=’, ‘>=’, that can be combined with the following logical operations: ‘not’, ‘or’, ‘and’.
2) Customer need to put JsonFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) For example, there is the query you can find in tests. This query will filter all hosts with free RAM greater or equal than 1024 MB and at the same time with free disk space greater or equal than 200 GB.
['and',    ['>=', '$free_ram_mb', 1024],    ['>=', '$free_disk_mb', 200 * 1024],]

 How to use this filter with native openstack cluster.

nova boot --image cirros-0.3.0-x86_64-uec  --flavor 1 --hint query=['>=','$free_ram_mb',1024] vm1

The above command means that customer want to create a new VM instance which will be deployed on the hypervisor host which has more than 1024M RAM

RetryFilter

Filter behavior for native OpenStack

1) The RetryFilter filters hosts that have already been attempted for scheduling. It only passes hosts that have not been previously attempted.
2) Customer need to put RetryFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.
3) Set scheduler_max_attempts in /etc/nova/nova.conf, the default value is 3, this means that the VM instance request can be re-scheduled at most 3 times.

TypeAffinityFilter

Filter behavior for native OpenStack

1) TypeAffinityFilter do not allow more than one VM type per hypervisor host. With this filter, all VM instance on a specified hypervisor node would be with same instance type (flavor).
2) Customer need to put TypeAffinityFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

AggregateTypeAffinityFilter

Filter behavior for native OpenStack

1) VM instance can only be deployed on the hypervisor host whose metadata attribute instace_type include the VM instance type.
2) Customer need to put AggregateTypeAffinityFilter to /etc/nova/nova.conf for the parameter of scheduler_default_filters if want to use this filter in OpenStack scheduler.

How to use this filter with native openstack cluster.

root@devstack11:/opt/stack/nova/nova/scheduler# nova aggregate-set-metadata 1 instance_type=m1.tinyAggregate 1 has been successfully updated.+----+--------+-------------------+-----------------+-----------------------------------------------------------------------------------------------+| Id | Name   | Availability Zone | Hosts           | Metadata                                                                                      |+----+--------+-------------------+-----------------+-----------------------------------------------------------------------------------------------+| 1  | group1 | nova              | [u'devstack11'] | {u'instance_type': u'm1.tiny', u'location': u'xian', u'cpu': u'4 5 6 7', u'memSize': u'4096'} |+----+--------+-------------------+-----------------+-----------------------------------------------------------------------------------------------+

原创粉丝点击