Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions common/scylla_image_setup
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@

import os
import sys
import logging
import subprocess
import re
from pathlib import Path
from lib.scylla_cloud import get_cloud_instance, is_gce, is_azure, is_redhat_variant
from lib.log import setup_logging
from lib.scylla_cloud import get_cloud_instance, is_ec2, is_gce, is_azure, is_redhat_variant
from subprocess import run

LOGGER = logging.getLogger(__name__)

def disable_perftune():
# There is no way to disable SET_CLOCKSOURCE from scylla_sysconfig_setup
# once it enabled, so we have to directly editing the sysconfig file
with open('/etc/default/scylla-server') as f:
sysconfig = f.read()
sysconfig = re.sub(r'^SET_CLOCKSOURCE=.*$', 'SET_CLOCKSOURCE=no', sysconfig, flags=re.MULTILINE)
with open('/etc/default/scylla-server', 'w') as f:
f.write(sysconfig)

if __name__ == '__main__':
setup_logging()
if is_azure():
swap_directory = Path('/mnt')
swap_unit = Path('/etc/systemd/system/mnt-swapfile.swap')
Expand All @@ -27,7 +43,19 @@ if __name__ == '__main__':
cloud_instance = get_cloud_instance()
run('/opt/scylladb/scylla-machine-image/scylla_configure.py', shell=True, check=True)

run('/opt/scylladb/scripts/scylla_sysconfig_setup --nic eth0 --setup-nic', shell=True, check=True)
try:
run('/opt/scylladb/scripts/scylla_sysconfig_setup --nic eth0 --setup-nic', shell=True, check=True)
except subprocess.CalledProcessError as e:
# There are kernel bug on some aarch64 instance types on EC2, it does not provide NUMA topology
# information, perftune crashes because of that.
# Only possible workaround is disable perftune for these instance types, for now.
# see: scylladb/seastar#2925
affected_instance_types = ['im4gn.8xlarge', 'im4gn.16xlarge']
if e.returncode == 3 and is_ec2() and cloud_instance.instancetype in affected_instance_types:
disable_perftune()
LOGGER.warning('Failed to enable perftune.py, continue without using it')
else:
raise e
if os.path.ismount('/var/lib/scylla'):
if cloud_instance.is_supported_instance_class():
# We run io_setup only when ehpemeral disks are available
Expand All @@ -44,5 +72,5 @@ if __name__ == '__main__':
run('systemctl is-active -q fstrim.timer && systemctl disable fstrim.timer', shell=True, check=True)

if not os.path.ismount('/var/lib/scylla') and not cloud_instance.is_dev_instance_type():
print('Failed to initialize RAID volume!')
LOGGER.error('Failed to initialize RAID volume!')
machine_image_configured.touch()