Changes to the default inode size

As per the bug report, the xfs-inode-size default value is in contradiction with the current upstream advice.
This patch removes the default value and accept the filesystem defaults for mkfs.xfs inode sizes.

Closes-Bug: #1879423
Change-Id: I9effc6052524ead9817454912284e3c48ce55901
This commit is contained in:
Francesco de Simone 2022-06-13 16:21:31 +00:00
parent c40f1d531b
commit 98c67e4d92
2 changed files with 23 additions and 5 deletions

View File

@ -23,6 +23,12 @@ from subprocess import (
call
)
from charmhelpers.core.hookenv import (
log,
WARNING,
INFO
)
def _luks_uuid(dev):
"""
@ -110,7 +116,7 @@ def is_device_mounted(device):
return bool(re.search(r'MOUNTPOINT=".+"', out))
def mkfs_xfs(device, force=False, inode_size=1024):
def mkfs_xfs(device, force=False, inode_size=None):
"""Format device with XFS filesystem.
By default this should fail if the device already has a filesystem on it.
@ -118,11 +124,19 @@ def mkfs_xfs(device, force=False, inode_size=1024):
:ptype device: tr
:param force: Force operation
:ptype: force: boolean
:param inode_size: XFS inode size in bytes
:param inode_size: XFS inode size in bytes; if set to 0 or None,
the value used will be the XFS system default
:ptype inode_size: int"""
cmd = ['mkfs.xfs']
if force:
cmd.append("-f")
if inode_size:
if inode_size >= 256 and inode_size <= 2048:
cmd += ['-i', "size={}".format(inode_size)]
else:
log("Config value xfs-inode-size={} is invalid. Using system default.".format(inode_size), level=WARNING)
else:
log("Using XFS filesystem with system default inode size.", level=INFO)
cmd += ['-i', "size={}".format(inode_size), device]
cmd += [device]
check_call(cmd)

View File

@ -239,9 +239,13 @@ options:
Encrypt block devices used by swift using dm-crypt, making use of
vault for encryption key management; requires a relation to vault.
xfs-inode-size:
default: 512
default:
type: int
description: XFS inode size to use for block devices.
description: |
XFS inode size to use for block devices;
The value must be between 256-2048.
If left unset or an invalid size is used,
the default mkfs.xfs value is selected.
storage-region:
default: 1
type: int