From 7c5c8a743c21733120c85fdefb84b4357f5848d0 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Tue, 20 Nov 2012 13:25:36 -0500 Subject: Xenapi: Don't resize down if not auto_disk_config It is not safe to resize down an instance if the filesystem has not been resized first, but with auto_disk_config == False there's no guarantee that it has happened. And not resizing down the disk space with the instance allows for users to have more space on their instance than the type should allow. Fixes bug 1081225 Change-Id: I980c0699dfc272155e274a96d6e08e131c1372d9 --- nova/virt/xenapi/vmops.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 4915804a9..a68c9eb8d 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -770,8 +770,10 @@ class VMOps(object): """ vm_ref = self._get_vm_opaque_ref(instance) sr_path = vm_utils.get_sr_path(self._session) - resize_down = (instance['auto_disk_config'] and - instance['root_gb'] > instance_type['root_gb']) + resize_down = instance['root_gb'] > instance_type['root_gb'] + if resize_down and not instance['auto_disk_config']: + reason = _('Resize down not allowed without auto_disk_config') + raise exception.ResizeError(reason=reason) # 0. Zero out the progress to begin self._update_instance_progress(context, instance, -- cgit