diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-10 23:01:40 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-10 23:01:40 +0000 |
| commit | 0caeb8eaf20abcdc77828f5c6b79fc104619e231 (patch) | |
| tree | d4df3137ff93fdfaed8367ca07d180a946c6c107 /nova/virt | |
| parent | 22385ab381dbddfc6ecd884d9186b760c744e952 (diff) | |
| parent | 44a8aba1d5da87d54db48079103fdef946666d80 (diff) | |
Merge "Check QCOW2 image size during root disk creation"
Diffstat (limited to 'nova/virt')
| -rwxr-xr-x | nova/virt/libvirt/imagebackend.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/virt/libvirt/imagebackend.py b/nova/virt/libvirt/imagebackend.py index b6b1b88aa..2ca71cc62 100755 --- a/nova/virt/libvirt/imagebackend.py +++ b/nova/virt/libvirt/imagebackend.py @@ -21,6 +21,7 @@ import os from oslo.config import cfg +from nova import exception from nova.openstack.common import excutils from nova.openstack.common import fileutils from nova.openstack.common import lockutils @@ -255,6 +256,13 @@ class Qcow2(Image): if not os.path.exists(base): prepare_template(target=base, *args, **kwargs) + # NOTE(cfb): Having a flavor that sets the root size to 0 and having + # nova effectively ignore that size and use the size of the + # image is considered a feature at this time, not a bug. + if size and size < disk.get_disk_size(base): + LOG.error('%s virtual size larger than flavor root disk size %s' % + (base, size)) + raise exception.ImageTooLarge() if not os.path.exists(self.path): with utils.remove_path_on_error(self.path): copy_qcow2_image(base, self.path, size) |
