From 05130daeaa490070c52499c9fac26dd16c38074d Mon Sep 17 00:00:00 2001 From: yaguang tang Date: Wed, 6 Jun 2012 00:26:17 +0800 Subject: fix bug lp:1009041,add option "-F" to make mkfs non-interactive. Change-Id: Ic8be1657dbad0cd91fdb5176f17f7b1ba034c2e0 --- nova/tests/test_libvirt.py | 2 +- nova/virt/libvirt/utils.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 62ab9efc4..596d6d1f1 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -2311,7 +2311,7 @@ disk size: 4.4M''', '')) def test_mkfs(self): self.mox.StubOutWithMock(utils, 'execute') - utils.execute('mkfs', '-t', 'ext4', '/my/block/dev') + utils.execute('mkfs', '-t', 'ext4', '-F', '/my/block/dev') utils.execute('mkswap', '/my/swap/block/dev') self.mox.ReplayAll() diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index 9f63c13c1..40b8d98d5 100644 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -150,6 +150,9 @@ def mkfs(fs, path, label=None): execute('mkswap', path) else: args = ['mkfs', '-t', fs] + #add -F to force no interactive excute on non-block device. + if fs in ['ext3', 'ext4']: + args.extend(['-F']) if label: args.extend(['-n', label]) args.append(path) -- cgit