Merge "Format filesystem fixes"
This commit is contained in:
commit
b9b3987103
|
@ -181,8 +181,8 @@ class Btrfs(Filesystem):
|
|||
handle to access it.
|
||||
"""
|
||||
device = brick_device.dev_path
|
||||
arg_list = ["mkfs.btrfs", "-m", self.metadata_profile,
|
||||
"-l", self.leaf_size, "-n", self.node_size,
|
||||
arg_list = ["mkfs.btrfs", "-m", str(self.metadata_profile),
|
||||
"-l", self.leaf_size, "-n", str(self.node_size),
|
||||
device]
|
||||
# Check if mkfs.btrfs is installed
|
||||
if not os.path.exists("/sbin/mkfs.btrfs"):
|
||||
|
@ -225,10 +225,10 @@ class Ext4(Filesystem):
|
|||
handle to access it.
|
||||
"""
|
||||
device = brick_device.dev_path
|
||||
arg_list = ["mkfs.ext4", "-m", self.reserved_blocks_percentage]
|
||||
arg_list = ["mkfs.ext4", "-m", str(self.reserved_blocks_percentage)]
|
||||
if self.inode_size is not None:
|
||||
arg_list.append("-I")
|
||||
arg_list.append(self.inode_size)
|
||||
arg_list.append(str(self.inode_size))
|
||||
|
||||
if self.stride is not None:
|
||||
arg_list.append("-E")
|
||||
|
|
|
@ -227,7 +227,7 @@ def finish_initialization(device_path: str) -> Result:
|
|||
log("device_info: {}".format(device_info.value), INFO)
|
||||
|
||||
# Zfs automatically handles mounting the device
|
||||
if filesystem_type is not Zfs:
|
||||
if filesystem_type is not filesystem_type.Zfs:
|
||||
log("Mounting block device {} at {}".format(device_path, mount_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
|
@ -354,7 +354,7 @@ def initialize_storage(device: BrickDevice) -> Result:
|
|||
inode_size = config("inode_size")
|
||||
|
||||
# Format with the default XFS unless told otherwise
|
||||
if filesystem_type is Xfs:
|
||||
if filesystem_type is FilesystemType.Xfs:
|
||||
log("Formatting block device with XFS: {}".format(device.dev_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
|
@ -368,7 +368,7 @@ def initialize_storage(device: BrickDevice) -> Result:
|
|||
stripe_width=stripe_width,
|
||||
)
|
||||
return Ok(xfs.format(brick_device=device))
|
||||
elif filesystem_type is Ext4:
|
||||
elif filesystem_type is FilesystemType.Ext4:
|
||||
log("Formatting block device with Ext4: {}".format(device.dev_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
|
@ -383,7 +383,7 @@ def initialize_storage(device: BrickDevice) -> Result:
|
|||
)
|
||||
return Ok(ext4.format(brick_device=device))
|
||||
|
||||
elif filesystem_type is Btrfs:
|
||||
elif filesystem_type is FilesystemType.Btrfs:
|
||||
log("Formatting block device with Btrfs: {}".format(device.dev_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
|
@ -395,7 +395,7 @@ def initialize_storage(device: BrickDevice) -> Result:
|
|||
node_size=0,
|
||||
metadata_profile=MetadataProfile.Single)
|
||||
return Ok(btrfs.format(brick_device=device))
|
||||
elif filesystem_type is Zfs:
|
||||
elif filesystem_type is FilesystemType.Zfs:
|
||||
log("Formatting block device with ZFS: {:}".format(device.dev_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
|
@ -407,7 +407,9 @@ def initialize_storage(device: BrickDevice) -> Result:
|
|||
)
|
||||
return Ok(zfs.format(brick_device=device))
|
||||
else:
|
||||
log("Formatting block device with XFS: {}".format(device.dev_path),
|
||||
log(
|
||||
"Unknown filesystem. Defaulting to formatting with XFS: {}".format(
|
||||
device.dev_path),
|
||||
INFO)
|
||||
status_set(workload_state="maintenance",
|
||||
message="Formatting block device with XFS: {}".format(
|
||||
|
|
Loading…
Reference in New Issue