summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/tests/test_libvirt.py2
-rw-r--r--nova/virt/libvirt/utils.py3
2 files changed, 4 insertions, 1 deletions
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)