summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-07-05 13:49:02 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-07-05 13:55:02 +0100
commitccdb02105acf32a4a0c81d688749475d8abedf4b (patch)
tree917c44046cc9f719d8cb0017105fbeee779e3260
parent980c76266629ea66bc23fddb02f5be61c51d873c (diff)
downloadnova-ccdb02105acf32a4a0c81d688749475d8abedf4b.tar.gz
nova-ccdb02105acf32a4a0c81d688749475d8abedf4b.tar.xz
nova-ccdb02105acf32a4a0c81d688749475d8abedf4b.zip
Don't catch & ignore exceptions when setting up LXC container filesystems
The 'setup_container' method in nova/disk/api.py may well raise an exception if something goes wrong when setting up the LXC container's root filesystem. Currently it just catches & logs any exception. The caller thus always thinks everything worked & goes onto boot the container despite there being no root filesystem available for it. The fix is to simply remove the bogus exception catching completely Change-Id: I2691713f11cced1561f347819875f490b8aaafef Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--nova/virt/disk/api.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py
index 3e66cd2a7..766c9ebd7 100644
--- a/nova/virt/disk/api.py
+++ b/nova/virt/disk/api.py
@@ -271,14 +271,15 @@ def setup_container(image, container_dir=None, use_cow=False):
LXC does not support qcow2 images yet.
"""
- try:
- img = _DiskImage(image=image, use_cow=use_cow, mount_dir=container_dir)
- if img.mount():
- return img
- else:
- raise exception.NovaException(img.errors)
- except Exception, exn:
- LOG.exception(_('Failed to mount filesystem: %s'), exn)
+ img = _DiskImage(image=image, use_cow=use_cow, mount_dir=container_dir)
+ if img.mount():
+ return img
+ else:
+ LOG.error(_("Failed to mount container filesystem '%(image)s' "
+ "on '%(target)s': %(errors)s") %
+ {"image": img, "target": container_dir,
+ "errors": img.errors})
+ raise exception.NovaException(img.errors)
def destroy_container(img):
@@ -293,7 +294,7 @@ def destroy_container(img):
if img:
img.umount()
except Exception, exn:
- LOG.exception(_('Failed to remove container: %s'), exn)
+ LOG.exception(_('Failed to unmount container filesystem: %s'), exn)
def inject_data_into_fs(fs, key, net, metadata, admin_password, execute):