zoukankan      html  css  js  c++  java
  • OpenStack Train版-3.安装glance镜像服务

    安装glance镜像服务

    创建数据库并授权

    mysql -u root 
    create database glance;
    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
    flush privileges;

    创建glance用户

    source ~/admin-openrc
    openstack user create --domain default --password GLANCE_PASS glance

    将管理员admin用户添加到glance用户和项目中

    openstack role add --project service --user glance admin

    创建glance服务实体

    openstack service create --name glance --description "OpenStack Image" image

    创建glance服务API端点,OpenStack使用三种API端点变种代表每种服务:admin、internal、public

    openstack endpoint create --region RegionOne image public http://controller:9292
    openstack endpoint create --region RegionOne image internal http://controller:9292
    openstack endpoint create --region RegionOne image admin http://controller:9292

    安装glance软件包

    yum install openstack-glance -y

    编辑glance配置文件 /etc/glance/glance-api.conf

    cp -a /etc/glance/glance-api.conf{,.bak}
    grep -Ev '^$|#' /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
    
    openstack-config --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
    
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken www_authenticate_uri http://controller:5000
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:5000
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers controller:11211
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_type password
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance
    openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password GLANCE_PASS
    openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
    
    openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http
    openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
    openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/

    编辑镜像服务的另一个组件文件 /etc/glance/glance-registry.conf

    cp -a /etc/glance/glance-registry.conf{,.bak}
    grep -Ev '^$|#' /etc/glance/glance-registry.conf.bak > /etc/glance/glance-registry.conf
    
    openstack-config --set /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
    
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken www_authenticate_uri http://controller:5000
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://controller:5000
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers controller:11211
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type password
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name Default
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name Default
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance
    openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password GLANCE_PASS
    openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone

    同步写入镜像数据库

    su -s /bin/sh -c "glance-manage db_sync" glance

    启动glance服务并设置开机自启

    systemctl enable openstack-glance-api.service openstack-glance-registry.service
    systemctl restart openstack-glance-api.service openstack-glance-registry.service
    lsof -i:9292

    赋予openstack-glance-api.service服务对存储设备的可写权限

    chown -hR glance:glance /var/lib/glance/

    下载cirros镜像验证glance服务

    wget -c http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img

    上传镜像

    #这里不要使用官方文档里面的glance image-create这样的写法,新版本的OpenStack已经不支持,尽量统一使用以openstack开头的命令写法
    openstack image create --file ~/cirros-0.5.1-x86_64-disk.img --disk-format qcow2 --container-format bare --public cirros

    查看镜像

    openstack image list
    glance image-list
    
    #查看镜像的物理文件
    ll /var/lib/glance/images/
    
    ##删除镜像的命令
    openstack image delete <ID>
  • 相关阅读:
    lpc4357第一个实验,串口(中断)
    移植UCOS-II时堆栈增长方向的疑问
    ARM Cortex-M4_寄存器介绍(-Part5)
    ARM Cortex-M4内核流水线和总线介绍 (-Part4_)
    从ARM 中的 指令对齐 到 bala bala········
    外部Nor Flash的初始化文件名为Prog_Ext_NOR.ini
    LPC4357,NOR FLAHS 仿真初始化文件Dbg_Ext_NOR.ini
    KEIL、uVision、RealView、MDK、KEIL C51之间的关系纠葛(比较区别)
    nand flash 和 nor flash
    c里面取地址和引用的 区别··········
  • 原文地址:https://www.cnblogs.com/Wang-Hongwei/p/13097926.html
Copyright © 2011-2022 走看看