Libvirt/KVM snapshot , disk_format != container_format, is it a bug?

asked 2011-10-07 10:01:55 -0600

Environment : diablo-released.

steps to reproduce:

  1. i upload some images using ec2tools, so the value of disk_format and container_format should be "ami"

  2. start an instance

  3. snapshot it (direct request to osAPI ) and exception is thrown

Command: qemu-img convert -f qcow2 -O ami -s aa03c01c0c4e4abbb31eca029e268dee /srv/lib/instances/instance-0000000b/disk /tmp/tmpxw9snQ/aa03c01c0c4e4abbb31eca029e268dee

(nova.rpc): TRACE: Exit code: 1 (nova.rpc): TRACE: Stdout: '' (nova.rpc): TRACE: Stderr: "qemu-img: Unknown file format 'ami'\n"

after digging into the code, i found the function here assume that the previous value of image_format must be raw, qcow2, vmdk, vdi.

if i set "qcow2" in FLAGS.snapshot_image_format, the disk_format will be different with container_format.

it's not a big deal since i can fix it easily with some small changes.

My question is :

is this a bug or i can't use it with ec2 style ?

  #  orginal image here 
   base = image_service.show(context, image_id)
    (snapshot_image_service, snapshot_image_id) = \
        thor.image.get_image_service(context, image_href)


   .............

   # image_format is "ami"
    image_format = FLAGS.snapshot_image_format or source_format
    if FLAGS.use_cow_images:
        source_format = 'qcow2'
    metadata['disk_format'] = image_format

    if 'container_format' in base:
        metadata['container_format'] = base['container_format']
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2011-10-25 11:38:48 -0600

Is this bug already fixed?

edit flag offensive delete link more
0

answered 2011-10-07 18:16:41 -0600

vishvananda gravatar image

This is a bug. Glance requires disk_format == container_format for ami, so we should be checking for ami and using raw for the qemu-img command, but upload the disk / container format as ami.

Vish

On Oct 7, 2011, at 3:05 AM, ezzzehxx wrote:

New question #173526 on OpenStack Compute (nova): https://answers.launchpad.net/nova/+q...

Environment : diablo-released.

steps to reproduce:

  1. i upload some images using ec2tools, so the value of disk_format and container_format should be "ami"

  2. start an instance

  3. snapshot it (direct request to osAPI ) and exception is thrown

Command: qemu-img convert -f qcow2 -O ami -s aa03c01c0c4e4abbb31eca029e268dee /srv/lib/instances/instance-0000000b/disk /tmp/tmpxw9snQ/aa03c01c0c4e4abbb31eca029e268dee

(nova.rpc): TRACE: Exit code: 1 (nova.rpc): TRACE: Stdout: '' (nova.rpc): TRACE: Stderr: "qemu-img: Unknown file format 'ami'\n"

after digging into the code, i found the function here assume that the previous value of image_format must be raw, qcow2, vmdk, vdi.

if i set "qcow2" in FLAGS.snapshot_image_format, the disk_format will be different with container_format.

it's not a big deal since i can fix it easily with some small changes.

My question is :

is this a bug or i can't use it with ec2 style ?

 #  orginal image here 
  base = image_service.show(context, image_id)
   (snapshot_image_service, snapshot_image_id) = \
       thor.image.get_image_service(context, image_href)


  .............

  # image_format is "ami"
   image_format = FLAGS.snapshot_image_format or source_format
   if FLAGS.use_cow_images:
       source_format = 'qcow2'
   metadata['disk_format'] = image_format

   if 'container_format' in base:
       metadata['container_format'] = base['container_format']

You received this question notification because you are a member of Nova Core, which is an answer contact for OpenStack Compute (nova).

edit flag offensive delete link more
0

answered 2011-11-10 02:56:27 -0600

Thanks Vish Ishaya, that solved my question.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-10-07 10:01:55 -0600

Seen: 60 times

Last updated: Nov 10 '11