【OpenStack】OpenStack系列4之Glance详解

  1. 下载安装
    1. http://www.it165.net/os/html/201402/7246.html

      http://www.21ops.com/cloud-computing/openstack/8488.html

    2. git clone -b stable/icehouse https://github.com/openstack/glance.git

      pip install -r requirements.txt

      python setup.py install

      yum install gcc libffi-devel python-devel openssl-devel

    3. glance架构

    4. 配置glance数据库连接

      glance-api.conf、glance-registry.conf,mysql://glance:openstack@controller0/glance

      mysql -uroot -popenstack -e "CREATE DATABASE glance;"

      mysql -uroot -popenstack -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'openstack';"

      mysql -uroot -popenstack -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'controller0' IDENTIFIED BY 'openstack';"

      mysql -uroot -popenstack -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'openstack';"

       

      mkdir /etc/glance

      mkdir /var/log/glance

      mkdir /var/lib/glance

      pip install mysql-python

      glance-manage db_sync

    5. 创建用户角色服务endpoint等

      参考:

      https://github.com/yongluo2013/osf-openstack-training/blob/master/installation/openstack-icehouse-for-centos65.md

    6. 修改glance api 和 register 配置文件,参考:如上。
    7. 启动glance的两个服务,glance-api、glance-registry。

      glance-control all start

      监听端口分别是9191、9292。

  2. 安装glance-client
    1. pip install -r requirements.txt

      python setup.py install

    2. 上传查看镜像

      glance image-create --progress --name="CirrOS 0.3.0" --disk-format=qcow2 --container-format=ovf --is-public=true < image/cirros-0.3.0-x86_64-disk.img

      glance image-list

       

      wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img

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

       

      glance image-create --name "cirros-0.3.0-x86_64" --file IMG_DIR/cirros-0.3.0-x86_64-disk.img --disk-format qcow2 --container-format ovf --is-public=true –progress

      glance image-download --file img-download-test/cirros-0.3.0-x86_64.img cirros-0.3.0-x86_64

       

      https://raymii.org/s/tutorials/Openstack_Glance_Image_Download.html

  3. Glance源码分析
    1. http://www.tuicool.com/articles/auQbmeI

      http://blog.chinaunix.net/uid-20940095-id-3504622.html

    2. 性能优化:使用swift、使用本地缓存
  4. 对接swift
    1. 默认存储后端:文件系统-FileSystem
    2. 对接swift参考swift详解相关章节
原文地址:https://www.cnblogs.com/junneyang/p/5257227.html