Openstack-glance镜像服务_第1张图片


Openstack-glance镜像服务




教程大纲

      

1. glance的服务组件介绍
2. glance的安装部署

3. 上传镜像测试





1.创建glance的数据库


mysql -u root -p -e "create database glance;"

mysql -u root -p -e "grant all privileges on glance.* to 'glance'@'localhost' identified by 'glance';"

mysql -u root -p -e "grant all privileges on glance.* to 'glance'@'%' identified by 'glance';"



2.安装glance的组件


yum install openstack-glance




3.修改 glance-api的配置


verbose = true

connection = mysql://glance:[email protected]/glance

stores = file,http

default_store = file

filesystem_store_datadir = /var/lib/glance/p_w_picpaths

auth_uri = http://192.168.100.40:5000

auth_url = http://192.168.100.40:35357

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = glance

password = glance

flavor = keystone




4.修改 glance-registry.conf


connection = mysql://glance:[email protected]/glance

auth_uri = http://192.168.100.40:5000

auth_url = http://192.168.100.40:35357

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = glance

password = glance

flavor = keystone




5.同步glance数据库


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




6.启动glance服务 


 

systemctl enable openstack-glance-api.service \

   openstack-glance-registry.service

   systemctl start openstack-glance-api.service \

   openstack-glance-registry.service




7.创建glance用户


 openstack user create --domain default --password-prompt glance

 将glance 加入服务中

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




8.注册glance 的服务(如果想用glance 必须在keystone上做注册)   


 

openstack service create --name glance \

  --description "OpenStack Image" p_w_picpath



9.创建glance服务



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




10.创建glance的三个端点


openstack endpoint create --region RegionOne p_w_picpath public http://192.168.100.40:9292


    openstack endpoint create --region RegionOne p_w_picpath internal http://192.168.100.40:9292

     

    openstack endpoint create --region RegionOne p_w_picpath admin http://192.168.100.40:9292




11.上传镜像测试


(如果没有镜像就可以 wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img)



创建系统镜像的glance命令

      openstack p_w_picpath create "cirros" \

     --file cirros-0.3.4-x86_64-disk.img \

     --disk-format qcow2 --container-format bare \

     --public



查看镜像的存放目录

    ls /var/lib/glance/p_w_picpaths/



13.验证glance 的节点


glance  p_w_picpath-list


Openstack-glance镜像服务_第2张图片

请观看视屏




视屏会在腾讯课堂和优酷、56视屏网站中上传。请大家搜索中祥课堂即可观看


Openstack-glance镜像服务_第3张图片

Openstack-glance镜像服务_第4张图片