OpenStack 映像服务 Glance 为磁盘和服务器映像提供存储、搜索、注册和交付服务。注册表服务器是向客户机提供映像元数据信息的映像服务。映像高速缓存由映像服务用于在本地主机上获取映像,而非每次请求映像时从映像服务器重新下载映像。
下面的命令将之前部分创建的统一归档文件上载到 Glance 系统信息库中。将 raw 用作格式类型。确保指定 architecture 属性。
global# glance image-create --container-format bare --disk-format raw \ --is-public true --name "Oracle Solaris 11.2 x86 NGZ" \ --property architecture=x86_64 \ --property hypervisor_type=solariszones \ --property vm_mode=solariszones < /var/tmp/myzone.uar
glance image-create 命令可以上载映像并同时设置所有属性值。下面的脚本显示如何确保在 architecture 属性设置为当前主机的体系结构的情况下上载映像:
#!/bin/ksh # Upload Unified Archive image to glance with proper Solaris decorations arch=$(archiveadm info -p $1|grep ^archive|cut -d '|' -f 4) if [[ "$arch" == "i386" ]]; then imgarch=x86_64 else imgarch=sparc64 fi name=$(basename $1 .uar) export OS_USERNAME=glance export OS_PASSWORD=glance export OS_TENANT_NAME=service export OS_AUTH_URL=http://controller-name:5000/v2.0 glance image-create --name $name --container-format bare --disk-format raw --owner service --file $1 --is-public True --property architecture=$imgarch --property hypervisor_type=solariszones --property vm_mode=solariszones --progress