Libvirt/KVM snapshot , disk_format != container_format, is it a bug?
Environment : diablo-released.
steps to reproduce:
i upload some images using ec2tools, so the value of disk_format and container_format should be "ami"
start an instance
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']