• Host aggregate分区


    需求:计算节点现在要拿出两台给单独的一个租户开虚机(虚机独占这两台计算节点),怎么做?
    https://www.ibm.com/developerworks/cn/cloud/library/1604-openstack-host-aggregate/

    问题描述:
    生产区一期环境增加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 |
    +--------------------------------------+----------------------------------+
    前者是创建的flavorid
    后者是大数据租户的tenant-id

    3.
     将模板中置上调度参数
    [root@controller-1 ~]# nova flavor-key
     e5a55a80-015e-4aed-96cc-d6ca42574cf1 set bigdata=yes

    效果:
    1. 用大数据账号,专用模板创建的虚拟机,一定且只会被调度到指定的4台主机上

    2. 其他用户看不到特殊模板,且创建的虚拟机只能被调度到剩余的主机上,也就是说,原来的用户对该改造无感





  • 相关阅读:
    Nginx系列教材 (四)- 和Tomcat进行动静分离整合
    Nginx系列教材 (三)- 反响代理Tomcat
    Nginx系列教材 (二)- 为Nginx准备的多个Tomcat
    Nginx系列教材 (一)- 教程
    Redis系列教材 (六)- Client
    Redis系列教材 (五)- Spring Data Redis 使用例子
    Redis系列教材 (四)- Jedis 教程
    Redis系列教材 (三)- 常见命令
    jq实时监听input值变化
    rem适配的代码
  • 原文地址:https://www.cnblogs.com/zhoumingang/p/5545703.html
Copyright © 2020-2023  润新知