Files
scylladb/dist/common/scripts/scylla_kernel_check
Takuya ASADA 3fefa520bd dist/common/scripts: drop run() and out(), swtich to subprocess.run()
We initially implemented run() and out() functions because we couldn't use
subprocess.run() since we were on Python 3.4.
But since we moved to relocatable python3, we don't need to implement it ourselves.
Why we keep using these functions are, because we needed to set environemnt variable to set PATH.
Since we recently moved away these codes to python thunk, we finally able to
drop run() and out(), switch to subprocess.run().
2020-11-22 17:59:27 +02:00

51 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018 ScyllaDB
#
#
# This file is part of Scylla.
#
# Scylla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Scylla is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Scylla. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import shutil
from scylla_util import *
from subprocess import run, DEVNULL
if __name__ == '__main__':
if os.getuid() > 0:
print('Requires root permission.')
sys.exit(1)
if not shutil.which('mkfs.xfs'):
pkg_install('xfsprogs')
os.makedirs('/var/tmp/mnt', exist_ok=True)
run('dd if=/dev/zero of=/var/tmp/kernel-check.img bs=1M count=128', shell=True, check=True, stdout=DEVNULL, stderr=DEVNULL)
run('mkfs.xfs /var/tmp/kernel-check.img', shell=True, check=True, stdout=DEVNULL, stderr=DEVNULL)
run('mount /var/tmp/kernel-check.img /var/tmp/mnt -o loop', shell=True, check=True, stdout=DEVNULL, stderr=DEVNULL)
ret = run('iotune --fs-check --evaluation-directory /var/tmp/mnt', shell=True).returncode
run('umount /var/tmp/mnt', shell=True, check=True)
shutil.rmtree('/var/tmp/mnt')
os.remove('/var/tmp/kernel-check.img')
if ret == 0:
print('This is a supported kernel version.')
else:
print('Please upgrade to a newer kernel version.')
print(' see https://docs.scylladb.com/troubleshooting/error_messages/kb_fs_not_qualified_aio/ for details')
sys.exit(ret)