【问题标题】:Is it possible to create an ami from an openstack image?是否可以从 openstack 图像创建 ami?
【发布时间】:2013-03-05 06:34:23
【问题描述】:

我正在从 OpenStack 中正在运行的实例创建映像

nova image-create <server-name>

我只是想知道,这张图片可以上传到 ec2 吗?还是我需要从中创建一个 ami?

有人可以指导我如何去做吗?

【问题讨论】:

    标签: amazon-ec2 openstack ec2-ami ec2-api-tools


    【解决方案1】:

    一目了然,openstack 图像服务能够存储多种图像类型:

    Raw
    Machine (kernel/ramdisk outside of image, a.k.a. AMI)
    VHD (Hyper-V)
    VDI (VirtualBox)
    qcow2 (Qemu/KVM)
    VMDK (VMWare)
    OVF (VMWare, others)
    

    参考:http://www.openstack.org/projects/image-service/

    基本上是这样。您可以直接将 AMI 上传到 openstack。

    例子:

    KERNEL_ID=`glance image-create --name="tty-linux-kernel" --disk-format=aki --container-format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz | awk '/ id / { print $4 }'`
    INITRD_ID=`glance image-create --name="tty-linux-ramdisk" --disk-format=ari --container-format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader | awk '/ id / { print $4 }'`
    glance image-create --name="tty-linux" --disk-format=ami --container-format=ami --property kernel_id=${KERNEL_ID} --property ramdisk_id=${INITRD_ID} < ttylinux-uec-amd64-12.1_2.6.35-22_1.img
    

    对正在运行的实例执行映像创建时

    如果 Compute 配置为使用 qcow2 > 图像,则只能从正在运行的实例创建图像,这是默认设置。您可以通过在 nova.conf 中添加以下行来显式启用 qcow2 图像 >:

    但假设您是这样配置的,是的,它将以 AMI 格式输出。

    参考:

    http://docs.openstack.org/trunk/openstack-compute/admin/content/creating-images-from-running-instances.html

    【讨论】:

    • 那么,不可能将图像转换为 AMI 使其可在 EC2 中运行?
    • openstack 没有任何集成的图像转换功能。因此,如果图像一开始不是 qcow,则无法将其转换为 ami。如果图像是 qcow,它将被快照为 AMI 兼容图像。
    • 但是存储在 /opt/stack/data/glance/images 中的图像是 qemu qcow 图像。所以这可以在 ec2 中通过将其转换为 AMI 来启动实例?
    猜你喜欢
    • 2017-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    • 2014-04-16
    相关资源
    最近更新 更多