summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWangpan <hzwangpan@corp.netease.com>2013-03-08 18:05:02 +0800
committerWangpan <hzwangpan@corp.netease.com>2013-03-11 11:08:01 +0800
commit786424b4561df6408128e2cd1b79b00c8b638cdc (patch)
treeca64137f444609550e83b25257de288643068f80
parent8c96d09ba3c12939d61e980474b75f9173ce6a63 (diff)
downloadnova-786424b4561df6408128e2cd1b79b00c8b638cdc.tar.gz
nova-786424b4561df6408128e2cd1b79b00c8b638cdc.tar.xz
nova-786424b4561df6408128e2cd1b79b00c8b638cdc.zip
Fixes nbd device can't be released error
When the 'mount' operation is successful but stderr is not empty during injecting key/file into image, there may be some warning messages output to stderr, so we need to discard them and continue to inject files into image. Fixes bug #1152519 Change-Id: Icc7d15196f3ee67674f9d815ddeef4378f363e2c
-rw-r--r--nova/virt/disk/mount/api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nova/virt/disk/mount/api.py b/nova/virt/disk/mount/api.py
index 3690f6ddf..85e1d109f 100644
--- a/nova/virt/disk/mount/api.py
+++ b/nova/virt/disk/mount/api.py
@@ -187,9 +187,10 @@ class Mount(object):
LOG.debug(_("Mount %(dev)s on %(dir)s") %
{'dev': self.mapped_device, 'dir': self.mount_dir})
_out, err = utils.trycmd('mount', self.mapped_device, self.mount_dir,
- run_as_root=True)
+ discard_warnings=True, run_as_root=True)
if err:
self.error = _('Failed to mount filesystem: %s') % err
+ LOG.debug(self.error)
return False
self.mounted = True