summaryrefslogtreecommitdiffstats
path: root/nova/virt/hyperv/imagecache.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/virt/hyperv/imagecache.py')
-rw-r--r--nova/virt/hyperv/imagecache.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/nova/virt/hyperv/imagecache.py b/nova/virt/hyperv/imagecache.py
index 8f29a62dc..6186b81c2 100644
--- a/nova/virt/hyperv/imagecache.py
+++ b/nova/virt/hyperv/imagecache.py
@@ -66,11 +66,12 @@ class ImageCache(object):
root_vhd_size = root_vhd_size_gb * 1024 ** 3
if root_vhd_size < vhd_size:
- raise vmutils.HyperVException(_("Cannot resize the image to a "
- "size smaller than the VHD max. "
- "internal size: %(vhd_size)s. "
- "Requested disk size: "
- "%(root_vhd_size)s") % locals())
+ raise vmutils.HyperVException(
+ _("Cannot resize the image to a size smaller than the VHD "
+ "max. internal size: %(vhd_size)s. Requested disk size: "
+ "%(root_vhd_size)s") %
+ {'vhd_size': vhd_size, 'root_vhd_size': root_vhd_size}
+ )
if root_vhd_size > vhd_size:
path_parts = os.path.splitext(vhd_path)
resized_vhd_path = '%s_%s%s' % (path_parts[0],
@@ -82,10 +83,14 @@ class ImageCache(object):
if not self._pathutils.exists(resized_vhd_path):
try:
LOG.debug(_("Copying VHD %(vhd_path)s to "
- "%(resized_vhd_path)s") % locals())
+ "%(resized_vhd_path)s"),
+ {'vhd_path': vhd_path,
+ 'resized_vhd_path': resized_vhd_path})
self._pathutils.copyfile(vhd_path, resized_vhd_path)
LOG.debug(_("Resizing VHD %(resized_vhd_path)s to new "
- "size %(root_vhd_size)s") % locals())
+ "size %(root_vhd_size)s"),
+ {'resized_vhd_path': resized_vhd_path,
+ 'root_vhd_size': root_vhd_size})
self._vhdutils.resize_vhd(resized_vhd_path,
root_vhd_size)
except Exception: