问题描述:
生产区一期环境增加4台计算结点,希望被大数据租户独占
1. 该大数据用户创建的虚拟机必须被调度到这4个计算结点
2. 其他租户创建虚拟机禁止调度到这4台机器
标黄的需要自行根据情况修改
解决方案:
创建ha分区
1. 将4台计算结点置为一个ha分区
[root@controller-1 ~]# nova aggregate-create bigdata
+----+---------+-------------------+-------+----------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------+----------+
| 9 | bigdata | - | | |
+----+---------+-------------------+-------+----------+
1. 将4台计算结点加入这个ha分区
[root@controller-1 ~]# nova aggregate-add-host 9 compute-2
Host compute-3 has been successfully added for aggregate 9
+----+---------+-------------------+-------------+----------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+----------+
| 9 | bigdata | - | 'compute-2' | |
+----+---------+-------------------+-------------+----------+
(执行4次)
1. 增加ha区调度属性
[root@controller-1 ~]# nova aggregate-set-metadata 9 bigdata=yes
Metadata has been successfully updated for aggregate 9.
+----+---------+-------------------+-------------+---------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+---------------+
| 9 | bigdata | - | 'compute-2' | 'bigdata=yes' |
+----+---------+-------------------+-------------+---------------+
bigdata=yes 是写死的,不能修改
4. 增加调度属性2:
[root@controller-1 ~]# nova aggregate-set-metadata 9 filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef
Metadata has been successfully updated for aggregate 9.
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
| 9 | bigdata | - | 'compute-2' | 'bigdata=yes', 'filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef' |
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef 等号后面的填写大数据租户的tenant-id
此时,ha分区创建完毕
修改调度策略
1. 修改三台控制结点的nova.conf
修改:
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
为:
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter, ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,AggregateMultiTenancyIsolation,AggregateInstanceExtraSpecsFilter
1. 重启nova-scheduler
service openstack-nova-scheduler restart
创建大数据组独享的flavor(模板)
1. 创建一个私有的模板(用admin租户的身份创建)
[root@controller-1 ~]# nova flavor-create lihao1234 auto 1024 20 1 --is-public false
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| e5a55a80-015e-4aed-96cc-d6ca42574cf1 | lihao1234 | 1024 | 20 | 0 | | 1 | 1.0 | False |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
2. 将该模板给大数据租户使用
[root@controller-1 ~]# nova flavor-access-add e5a55a80-015e-4aed-96cc-d6ca42574cf1 7b597e8e774c41d9bcc92d494c0ad6ef
+--------------------------------------+----------------------------------+
| Flavor_ID | Tenant_ID |
+--------------------------------------+----------------------------------+
| e5a55a80-015e-4aed-96cc-d6ca42574cf1 | 7b597e8e774c41d9bcc92d494c0ad6ef |
+--------------------------------------+----------------------------------+
前者是创建的flavor的id
后者是大数据租户的tenant-id
3. 将模板中置上调度参数
[root@controller-1 ~]# nova flavor-key e5a55a80-015e-4aed-96cc-d6ca42574cf1 set bigdata=yes
效果:
1. 用大数据账号,专用模板创建的虚拟机,一定且只会被调度到指定的4台主机上
生产区一期环境增加4台计算结点,希望被大数据租户独占
1. 该大数据用户创建的虚拟机必须被调度到这4个计算结点
2. 其他租户创建虚拟机禁止调度到这4台机器
标黄的需要自行根据情况修改
解决方案:
创建ha分区
1. 将4台计算结点置为一个ha分区
[root@controller-1 ~]# nova aggregate-create bigdata
+----+---------+-------------------+-------+----------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------+----------+
| 9 | bigdata | - | | |
+----+---------+-------------------+-------+----------+
1. 将4台计算结点加入这个ha分区
[root@controller-1 ~]# nova aggregate-add-host 9 compute-2
Host compute-3 has been successfully added for aggregate 9
+----+---------+-------------------+-------------+----------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+----------+
| 9 | bigdata | - | 'compute-2' | |
+----+---------+-------------------+-------------+----------+
(执行4次)
1. 增加ha区调度属性
[root@controller-1 ~]# nova aggregate-set-metadata 9 bigdata=yes
Metadata has been successfully updated for aggregate 9.
+----+---------+-------------------+-------------+---------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+---------------+
| 9 | bigdata | - | 'compute-2' | 'bigdata=yes' |
+----+---------+-------------------+-------------+---------------+
bigdata=yes 是写死的,不能修改
4. 增加调度属性2:
[root@controller-1 ~]# nova aggregate-set-metadata 9 filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef
Metadata has been successfully updated for aggregate 9.
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
| 9 | bigdata | - | 'compute-2' | 'bigdata=yes', 'filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef' |
+----+---------+-------------------+-------------+--------------------------------------------------------------------+
filter_tenant_id=7b597e8e774c41d9bcc92d494c0ad6ef 等号后面的填写大数据租户的tenant-id
此时,ha分区创建完毕
修改调度策略
1. 修改三台控制结点的nova.conf
修改:
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
为:
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter, ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,AggregateMultiTenancyIsolation,AggregateInstanceExtraSpecsFilter
1. 重启nova-scheduler
service openstack-nova-scheduler restart
创建大数据组独享的flavor(模板)
1. 创建一个私有的模板(用admin租户的身份创建)
[root@controller-1 ~]# nova flavor-create lihao1234 auto 1024 20 1 --is-public false
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| e5a55a80-015e-4aed-96cc-d6ca42574cf1 | lihao1234 | 1024 | 20 | 0 | | 1 | 1.0 | False |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
2. 将该模板给大数据租户使用
[root@controller-1 ~]# nova flavor-access-add e5a55a80-015e-4aed-96cc-d6ca42574cf1 7b597e8e774c41d9bcc92d494c0ad6ef
+--------------------------------------+----------------------------------+
| Flavor_ID | Tenant_ID |
+--------------------------------------+----------------------------------+
| e5a55a80-015e-4aed-96cc-d6ca42574cf1 | 7b597e8e774c41d9bcc92d494c0ad6ef |
+--------------------------------------+----------------------------------+
前者是创建的flavor的id
后者是大数据租户的tenant-id
3. 将模板中置上调度参数
[root@controller-1 ~]# nova flavor-key e5a55a80-015e-4aed-96cc-d6ca42574cf1 set bigdata=yes
效果:
1. 用大数据账号,专用模板创建的虚拟机,一定且只会被调度到指定的4台主机上
2. 其他用户看不到特殊模板,且创建的虚拟机只能被调度到剩余的主机上,也就是说,原来的用户对该改造无感