From ebb53d62431dfdd335dfc57452868cbb447817ea Mon Sep 17 00:00:00 2001 From: Vladik Romanovsky Date: Thu, 26 Sep 2013 16:21:22 -0400 Subject: [PATCH] Merging two mkfs commands. nova.disk.api.mkfs will use nova.utils.mkfs, unless an arbitrary mkfs command has been provided by the user. Preserving the default filesystem to be used for each os_type. Also, adding run_as_root parameter to utils.mkfs, to allow it handle block devices. Change-Id: I3ca21e0ee80caa7e1152ebae56d73ed3c14844c0 --- nova/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nova/utils.py b/nova/utils.py index 629ce7483..0ac2aab74 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -850,7 +850,7 @@ class UndoManager(object): self._rollback() -def mkfs(fs, path, label=None): +def mkfs(fs, path, label=None, run_as_root=False): """Format a file or block device :param fs: Filesystem type (examples include 'swap', 'ext3', 'ext4' @@ -863,7 +863,7 @@ def mkfs(fs, path, label=None): else: args = ['mkfs', '-t', fs] #add -F to force no interactive execute on non-block device. - if fs in ('ext3', 'ext4'): + if fs in ('ext3', 'ext4', 'ntfs'): args.extend(['-F']) if label: if fs in ('msdos', 'vfat'): @@ -872,7 +872,7 @@ def mkfs(fs, path, label=None): label_opt = '-L' args.extend([label_opt, label]) args.append(path) - execute(*args) + execute(*args, run_as_root=run_as_root) def last_bytes(file_like_object, num):