Advertisement

云平台OpenStack(先电) dashboard -镜像服务

阅读量:

实验准备

  1. 两台虚拟机:controller(控制节点)、computer(计算节点)
  2. 安装光盘:centos7.2在这里插入图片描述
  3. 两块网卡:一块 NAT 模式,一块 Host-only 模式
  4. IP地址:
NAT Host-only
(controller节点)192.168.53.10 192.168.54.10
(computer节点)192.168.53.20 192.168.54.20

GLANCE镜像服务

  1. 概述:Glance 镜像服务实现发现、注册、获取虚拟机镜像和镜像元数据,镜像数据支持存储多种的存储系统,可以是简单文件系统、对象存储系统等。

下载镜像

  1. 检查Glance服务列表
复制代码
    [root@xiandian ~]# source /etc/keystone/admin-openrc.sh
    [root@xiandian ~]# openstack-service list |grep glance
    
    
    
      
      
      
    

在这里插入图片描述
2. 检测Glance服务是否启动

复制代码
    [root@xiandian ~]# openstack-service status |grep glance
    
    
      
    

在这里插入图片描述
3. 查询 glance-control版本(可能不一样)

复制代码
    [root@xiandian ~]# glance-control --version
    
    
      
    
在这里插入图片描述
  1. 下载镜像(CirrOS)
    先下载 wget :yum install wget -y
复制代码
    [root@xiandian ~]# mkdir /tmp/images
    [root@xiandian ~]# cd /tmp/images/
    [root@xiandian images]# wget http://183.66.192.18:66/cirros-0.3.2-x86_64-disk.img
    
    
    
      
      
      
      
    

在这里插入图片描述
5. 查看镜像文件信息

复制代码
    [root@xiandian images]# file cirros-0.3.2-x86_64-disk.img
    
    
      
    

在这里插入图片描述
6. 创建镜像
Glance 服务自带两个配置文件 ,在使用 Glance 镜像服务时需要配置 glance-api.conf 和glance-registry.conf 两个服务模块。在添加镜像到 Glance 时,需要指定虚拟镜像的磁盘格式(disk format)和容器格式(container format)

qcow2 :QEMU 模拟器支持的可动态扩展、写时复制的磁盘格式,是 kvm 虚拟机默认使用的磁盘文件格式
容器格式 是可以理解成虚拟机镜像添加元数据后重新打包的格式。
Bare :指定没有容器和元数据封装在镜像中,如果 Glance 和 OpenStack 的其他服务没有使用容器格式的字符串,为了安全,建议设置 bare。

复制代码
    [root@xiandian images]# source /etc/keystone/admin-openrc.sh
    [root@xiandian images]# glance image-create --name "cirros-0.3.2-x86_64" --disk-format qcow2 --container-format bare --progress < cirros-0.3.2-x86_64-disk.img
    
    
    
      
      
      
    

在这里插入图片描述
7. 查询镜像列表

复制代码
    [root@xiandian images]# glance image-list
    
    
      
    
在这里插入图片描述

更改、删除镜像

1.更改镜像:glance image-update

  • glance image-show : 获取镜像详细信息
    镜像的ID通过镜像列表查询得出,每个镜像的ID都不同。(也可以通过镜像名称来查询)
复制代码
    [root@xiandian images]# glance image-list
    [root@xiandian images]# glance image-show f837fedd-1d38-4f16-8708-8e9cc716de78
    
    
    
      
      
      
    
在这里插入图片描述
  • 例:修改镜像启动硬盘所需大小
复制代码
    [root@xiandian images]# glance image-update --min-disk=1 f837fedd-1d38-4f16-8708-8e9cc716de78
    
    
      
    

在这里插入图片描述
2.删除镜像:glance image-delete

复制代码
    [root@xiandian images]# glance image-delete f837fedd-1d38-4f16-8708-8e9cc716de78
    [root@xiandian images]# glance image-list
    
    
    
      
      
      
    
在这里插入图片描述

全部评论 (0)

还没有任何评论哟~