Skip to content

Commit adbb50a

Browse files
committed
scylla_image_setup: avoid script error when perftune.py failed
On EC2, some environments cause errors on perftune.py due to corrupted NUMA topology information. Even in such an environment, scylla_image_setup should not cause a script error. It should handle the error, print a warning message, and then continue the startup process. Related scylladb/seastar#2925
1 parent fc02fee commit adbb50a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

common/scylla_image_setup

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@
77
import os
88
import sys
99
import logging
10+
import subprocess
11+
import re
1012
from pathlib import Path
1113
from lib.log import setup_logging
1214
from lib.scylla_cloud import get_cloud_instance, is_gce, is_azure, is_redhat_variant
1315
from subprocess import run
1416

1517
LOGGER = logging.getLogger(__name__)
1618

19+
def disable_perftune():
20+
# There is no way to disable SET_CLOCKSOURCE from scylla_sysconfig_setup
21+
# once it enabled, so we have to directly editing the sysconfig file
22+
with open('/etc/default/scylla-server') as f:
23+
sysconfig = f.read()
24+
sysconfig = re.sub(r'^SET_CLOCKSOURCE=.*$', 'SET_CLOCKSOURCE=no', sysconfig, flags=re.MULTILINE)
25+
with open('/etc/default/scylla-server', 'w') as f:
26+
f.write(sysconfig)
27+
1728
if __name__ == '__main__':
1829
setup_logging()
1930
if is_azure():
@@ -32,7 +43,13 @@ if __name__ == '__main__':
3243
cloud_instance = get_cloud_instance()
3344
run('/opt/scylladb/scylla-machine-image/scylla_configure.py', shell=True, check=True)
3445

35-
run('/opt/scylladb/scripts/scylla_sysconfig_setup --nic eth0 --setup-nic', shell=True, check=True)
46+
try:
47+
run('/opt/scylladb/scripts/scylla_sysconfig_setup --nic eth0 --setup-nic', shell=True, check=True)
48+
except subprocess.CalledProcessError as e:
49+
if e.returncode == 3:
50+
disable_perftune()
51+
LOGGER.warning('Failed to enable perftune.py, continue without using it')
52+
raise e
3653
if os.path.ismount('/var/lib/scylla'):
3754
if cloud_instance.is_supported_instance_class():
3855
# We run io_setup only when ehpemeral disks are available

0 commit comments

Comments
 (0)