From 786424b4561df6408128e2cd1b79b00c8b638cdc Mon Sep 17 00:00:00 2001 From: Wangpan Date: Fri, 8 Mar 2013 18:05:02 +0800 Subject: 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 --- nova/virt/disk/mount/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit