VMware: Always upload a snapshot as a preallocated disk
Currently, a snapshot operation always produces a preallocated
disk type. When the snapshot is uploaded to glance, the source
image metadata is uploaded with the new snapshot and then some
of the metadata properties are updated. The update doesn't
include the disk_type property, this can be problematic. If
the original image has a sparse disk type and a snapshot is
taken, then the snapshot which is a preallocated disk type is
uploaded to glance with the disk_type property set to sparse,
which creates a disk type mismatch and causes errors when a vm
is spawned from that snapshot. This patch addresses the issue
by correcting the image metadata used when uploading a snapshot
to glance.
Also, the image_upload function in vmwareapi/fake.py has been
modified to address the change. Any function call to
image_upload (from the unit tests) will assert that the
metadata for the image to be uploaded must have the disk_type
value to be preallocated.
Closes-Bug: 1247296
(cherry picked from commit 11e327f888a6dbde990d75196560083fddecf394)
Reviewed: https:/ /review. openstack. org/74859 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=9520b8dfc20 7d0183ef53e84a4 80270e832d6c70
Committed: https:/
Submitter: Jenkins
Branch: stable/havana
commit 9520b8dfc207d01 83ef53e84a48027 0e832d6c70
Author: Maithem <email address hidden>
Date: Mon Nov 11 16:08:02 2013 -0800
VMware: Always upload a snapshot as a preallocated disk
Currently, a snapshot operation always produces a preallocated
disk type. When the snapshot is uploaded to glance, the source
image metadata is uploaded with the new snapshot and then some
of the metadata properties are updated. The update doesn't
include the disk_type property, this can be problematic. If
the original image has a sparse disk type and a snapshot is
taken, then the snapshot which is a preallocated disk type is
uploaded to glance with the disk_type property set to sparse,
which creates a disk type mismatch and causes errors when a vm
is spawned from that snapshot. This patch addresses the issue
by correcting the image metadata used when uploading a snapshot
to glance.
Also, the image_upload function in vmwareapi/fake.py has been
modified to address the change. Any function call to
image_upload (from the unit tests) will assert that the
metadata for the image to be uploaded must have the disk_type
value to be preallocated.
Closes-Bug: 1247296 e990d7519656008 3fddecf394)
(cherry picked from commit 11e327f888a6dbd
Conflicts:
nova/ tests/virt/ vmwareapi/ test_vmwareapi. py 11abb489153292f b0d1e614765
Change-Id: I71cfa8d4d1eb79