Skip to content

Commit

Permalink
Add no btrfs build
Browse files Browse the repository at this point in the history
  • Loading branch information
badrogger committed Jun 13, 2024
1 parent 2fe74ca commit 1f6d4d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
3 changes: 2 additions & 1 deletion node_cli/configs/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
'DEFAULT_GAS_PRICE_WEI': '',
'SKIP_DOCKER_CONFIG': '',
'ENFORCE_BTRFS': '',
'SKIP_DOCKER_CLEANUP': ''
'SKIP_DOCKER_CLEANUP': '',
'NO_BTRFS': ''
}


Expand Down
12 changes: 10 additions & 2 deletions node_cli/operations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,13 @@ def init_sync(
download_contracts(env)

generate_nginx_config()
no_btrfs = env.get('NO_BTRFS') == 'True'
enforce_btrfs = env.get('ENFORCE_BTRFS') == 'True'

prepare_block_device(
env['DISK_MOUNTPOINT'],
force=env['ENFORCE_BTRFS'] == 'True'
force=enforce_btrfs,
btrfs_enabled=no_btrfs
)

update_meta(
Expand Down Expand Up @@ -247,9 +251,13 @@ def update_sync(env_filepath: str, env: Dict) -> bool:
backup_old_contracts()
download_contracts(env)

no_btrfs = env.get('NO_BTRFS') == 'True'
enforce_btrfs = env.get('ENFORCE_BTRFS') == 'True'

prepare_block_device(
env['DISK_MOUNTPOINT'],
force=env['ENFORCE_BTRFS'] == 'True'
force=enforce_btrfs,
btrfs_enabled=no_btrfs
)
generate_nginx_config()

Expand Down
33 changes: 17 additions & 16 deletions node_cli/operations/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,23 @@ def mount_device(block_device, mountpoint):
run_cmd(['mount', block_device, mountpoint])


def prepare_block_device(block_device, force=False):
filesystem = None
try:
filesystem = get_block_device_filesystem(block_device)
except Exception as e:
logger.info('Cannot get filesystem type %s', e)
logger.debug('Cannot get filesystem type', exc_info=True)
if not force:
raise

if filesystem == 'btrfs':
logger.info('%s already formatted as btrfs', block_device)
ensure_btrfs_for_all_space(block_device)
else:
logger.info('%s contains %s filesystem', block_device, filesystem)
format_as_btrfs(block_device)
def prepare_block_device(block_device, force=False, btrfs_enabled=True):
if btrfs_enabled:
filesystem = None
try:
filesystem = get_block_device_filesystem(block_device)
except Exception as e:
logger.info('Cannot get filesystem type %s', e)
logger.debug('Cannot get filesystem type', exc_info=True)
if not force:
raise

if filesystem == 'btrfs':
logger.info('%s already formatted as btrfs', block_device)
ensure_btrfs_for_all_space(block_device)
else:
logger.info('%s contains %s filesystem', block_device, filesystem)
format_as_btrfs(block_device)
mount_device(block_device, SCHAINS_MNT_DIR_SYNC)


Expand Down

0 comments on commit 1f6d4d3

Please sign in to comment.