Skip to content

Commit

Permalink
fix bug lp:1009041,add option "-F" to make mkfs non-interactive.
Browse files Browse the repository at this point in the history
Change-Id: Ic8be1657dbad0cd91fdb5176f17f7b1ba034c2e0
  • Loading branch information
yaguangtang committed Jun 5, 2012
1 parent 1334ce8 commit 05130da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nova/tests/test_libvirt.py
Expand Up @@ -2311,7 +2311,7 @@ def test_copy_image(self):

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()

Expand Down
3 changes: 3 additions & 0 deletions nova/virt/libvirt/utils.py
Expand Up @@ -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)
Expand Down

0 comments on commit 05130da

Please sign in to comment.