OpenStack使用Amazon镜像(AKI\ARI\AMI)部署虚拟机操作说明

一 关于亚马逊的镜像
AKI/AMI/ARI
The AKI/AMI/ARI format was the initial image format supported by Amazon EC2. The image consists of three files:

AKI (Amazon Kernel Image)
A kernel file that the hypervisor will load initially to boot the image. For a Linux machine, this would be a vmlinuz file.

AMI (Amazon Machine Image)
This is a virtual machine image in raw format, as described above.

ARI (Amazon Ramdisk Image)
An optional ramdisk file mounted at boot time. For a Linux machine, this would be an initrd file.
二 操作步骤

1. 下载到本地以后,解压出来:
(cirros官方地址:http://download.cirros-cloud.net/)
(这里下载的版本:http://download.cirros-cloud.net/0.3.0/cirros-0.3.0-x86_64-uec.tar.gz)

# ll
total 38200
-rw-r--r-- 1 camellia 1000 25165824 Oct 20  2011 cirros-0.3.0-x86_64-blank.img
-rw-r--r-- 1 camellia 1000  2254249 Oct 20  2011 cirros-0.3.0-x86_64-initrd
-rw-r--r-- 1 root     root  6957349 Jan 10 09:29 cirros-0.3.0-x86_64-uec.tar.gz
-rw------- 1 camellia 1000  4731440 Oct 20  2011 cirros-0.3.0-x86_64-vmlinuz

2. 亚马逊格式镜像上传

glance  image-create --name cirros-0.3.0-x86_64-vmlinuz --disk-format aki --container-format aki --file /home/tmp/cirros-0.3.0-x86_64-vmlinuz --is-public True
glance  image-create --name cirros-0.3.0-x86_64-initrd --disk-format ari --container-format ari --file /home/tmp/cirros-0.3.0-x86_64-initrd --is-public True
glance  image-create --name cirros-0.3.0-x86_64-blank.img --disk-format ami --container-format ami --file /home/tmp/cirros-0.3.0-x86_64-blank.img --is-public True

注意:当disk format 为 aki ari ami 时,disk format 和 container format 一致

glance image-list

+--------------------------------------+----------------------------------------+-------------+------------------+------------+--------+

| ID                                   | Name                                   | Disk Format | Container Format | Size       | Status |

+--------------------------------------+----------------------------------------+-------------+------------------+------------+--------+

| 5f5d1f2b-06ee-4930-91c1-360376a7e51f | cirros-0.3.0-x86_64-blank.img | ami         | ami              | 25165824   | active |

| 1c16bdd2-5796-46d2-86c8-94e100a8668d | cirros-0.3.0-x86_64-initrd    | ari         | ari              | 2254249    | active |

| 16a070ba-1415-48ea-bb2c-11af91b89d5a | cirros-0.3.0-x86_64-vmlinuz   | aki         | aki              | 4731440    | active |

+--------------------------------------+----------------------------------------+-------------+------------------+------------+--------+

3. 设置镜像元数据

nova image-meta 5f5d1f2b-06ee-4930-91c1-360376a7e51f set kernel_id=16a070ba-1415-48ea-bb2c-11af91b89d5a ramdisk_id=1c16bdd2-5796-46d2-86c8-94e100a8668d

nova image-show 5f5d1f2b-06ee-4930-91c1-360376a7e51f

+----------------------+--------------------------------------+

| Property             | Value                                |

+----------------------+--------------------------------------+

| OS-EXT-IMG-SIZE:size | 25165824                             |

| created              | 2017-01-14T07:28:03Z                 |

| id                   | 5f5d1f2b-06ee-4930-91c1-360376a7e51f |

| metadata kernel_id   | 16a070ba-1415-48ea-bb2c-11af91b89d5a |

| metadata ramdisk_id  | 1c16bdd2-5796-46d2-86c8-94e100a8668d |

| minDisk              | 0                                    |

| minRam               | 0                                    |

| name                 | cirros-0.3.0-x86_64-blank.img        |

| progress             | 100                                  |

| status               | ACTIVE                               |

| updated              | 2017-01-14T07:38:04Z                 |

+----------------------+--------------------------------------+

4. 从镜像部署虚拟机

nova boot --flavor 1 --image 5f5d1f2b-06ee-4930-91c1-360376a7e51f  --nic net-id=3d7a78f0-fd63-4bb0-aed7-83643c1f1c17 test_from_img
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值