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
This commit is contained in:
Wangpan 2013-03-08 18:05:02 +08:00
parent 8c96d09ba3
commit 786424b456
1 changed files with 2 additions and 1 deletions

View File

@ -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