• openstack-glance上传镜像


    openstack 中怎么上传image ? 

    1. 需要我们提前准备好镜像,具体的镜像可以自己在官网下载,国内的建议在 (中科大https://mirrors.ustc.edu.cn/

    2. 在命令行通过glance 上传镜像

    命令:

    glance image-create --name "ubuntu14-04" --file ubuntu-14.04.6-server-amd64.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress

    glance 可以使用以下参数:                                              ps:这些参数不是100%都需要的我们在上传镜像更加我们需求选择相对应的参数就好了

    --id <IMAGE_ID>                   #镜像的ID
    --name <NAME>                    #镜像的名称
    --store <STORE>                   #储存的镜像上传到
    --disk-format <DISK_FORMAT>               #镜像的格式。可以接受的格式包含: ami,ari, aki, vhd, vmdk, raw, qcow2, vdi, and iso.
    --container-format <CONTAINER_FORMAT>          #镜像容器的格式。可以接受的格式包含:ami,ari, aki, bare, and ovf.
    --owner <TENANT_ID>                # 拥有该镜像的租户
    --size <SIZE>                     #镜像的大小(以bytes表示). 一般只与'--location'和'--copy_from'一起使用。
    --min-disk <DISK_GB>                 #启动镜像所需的最小硬盘空间(用gigabytes表示).
    --min-ram <DISK_RAM>                 #启动镜像所需的最小内存数量(用megabytes表示).
    --location <IMAGE_URL>                #镜像所在位置的URL。例如,如果镜像储存在swift中,
    --file <FILE>                        #在创建过程中将要被上传的本地文件(包括硬盘镜像)。另外,镜像也可以通过stdin传递给客户端。
    --checksum <CHECKSUM>             #被Glance使用的可用于认证的镜像数据的哈希值,在此请提供一个md5校验值。
    --copy-from <IMAGE_URL>                #用法和'--location'参数相似,但表明Glance服务器应该能立即从镜像所储存的地方拷贝数据并储存。
    --is-public [True|False]                 #表示镜像是否能被公众访问。
    --is-protected [True|False]              #用于避免镜像被删除。
    --property <key=value>               #与镜像有关的任意的属性。可以使用很多次。
    --human-readable                     #用对人友好的格式打印镜像的尺寸。
    --progress                       #显示上传的进度条
    

    3、样例,下载并上传centons7的操作过程                        

    下载镜像到本地 命令:wget https://mirrors.ustc.edu.cn/centos-cloud/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2

    执行过程如下:

    [root@node152 ~]# wget https://mirrors.ustc.edu.cn/centos-cloud/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2
    --2021-07-08 18:11:46--  https://mirrors.ustc.edu.cn/centos-cloud/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2
    Resolving mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)... 202.141.176.110, 2001:da8:d800:95::110
    Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.176.110|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 888995840 (848M) [application/octet-stream]
    Saving to: ‘CentOS-7-x86_64-GenericCloud-2009.qcow2’
    
    22% [======================>                                                                                 ] 198,885,082 2.73MB/s   in 68s    
    
    2021-07-08 18:27:54 (2.79 MB/s) - Read error at byte 198885082/888995840 (Success). Retrying.
    
    --2021-07-08 18:27:55--  (try: 2)  https://mirrors.ustc.edu.cn/centos-cloud/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2
    Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.176.110|:443... connected.
    HTTP request sent, awaiting response... 206 Partial Content
    Length: 888995840 (848M), 690110758 (658M) remaining [application/octet-stream]
    Saving to: ‘CentOS-7-x86_64-GenericCloud-2009.qcow2’
    
    100%[+++++++++++++++++++++++================================================================================>] 888,995,840 2.84MB/s   in 3m 55s 
    
    2021-07-08 18:31:51 (2.80 MB/s) - ‘CentOS-7-x86_64-GenericCloud-2009.qcow2’ saved [888995840/888995840]

    上传镜像到glance,命令 glance image-create --name "centos7laste" --file CentOS-7-x86_64-GenericCloud-2009.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress

    执行过程如下:

    [root@node152 ~]# glance image-create --name "centos7laste" --file CentOS-7-x86_64-GenericCloud-2009.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress
    [=============================>] 100%
    +------------------+--------------------------------------+
    | Property         | Value                                |
    +------------------+--------------------------------------+
    | checksum         | 8b9411110b8cc5596eb17c60c991ef03     |
    | container_format | bare                                 |
    | created_at       | 2021-07-08T10:36:34Z                 |
    | disk_format      | qcow2                                |
    | id               | 822e5cb0-c744-441a-b723-9f24775fb622 |
    | min_disk         | 0                                    |
    | min_ram          | 0                                    |
    | name             | centos7laste                         |
    | owner            | 8e4dd46886834371b71984245a143f58     |
    | protected        | False                                |
    | size             | 888995840                            |
    | status           | active                               |
    | tags             | []                                   |
    | updated_at       | 2021-07-08T10:36:37Z                 |
    | virtual_size     | None                                 |
    | visibility       | public                               |
    +------------------+--------------------------------------+

    验证镜像,命令openstack image list

    执行过程如下:

    [root@node152 ~]# openstack image list
    +--------------------------------------+--------------+--------+
    | ID | Name | Status |
    +--------------------------------------+--------------+--------+
    | 4ba5d2d5-7880-48ab-b383-fa8f62277aef | centos6-init | active |
    | 38e8b762-79dd-45f5-be11-73e732663614 | centos6.9 | active |
    | 822e5cb0-c744-441a-b723-9f24775fb622 | centos7laste | active |
    | 348896ad-1403-4d21-9a1d-c78526bdc6ae | cirros | active |
    +--------------------------------------+--------------+--------+
    

      

      

  • 相关阅读:
    Windows Phone 播放音频之MediaPlayer
    (转)系统架构师学习笔记_第四章(下)
    (转)系统架构师学习笔记_第二章
    (转)系统架构师学习笔记_第四章(上)
    读取properties配置文件信息
    (转)系统架构师学习笔记_第五章(上)
    (转)系统架构师学习笔记_第三章
    Struts2实现文件上传
    Struts2手工编写代码实现对Action中所有方法输入校验
    (转)系统架构师学习笔记_第五章(下)
  • 原文地址:https://www.cnblogs.com/xzlive/p/14987652.html
Copyright © 2020-2023  润新知