Commit Graph

492 Commits

Author SHA1 Message Date
Takuya ASADA
8504332e17 scylla_setup: skip offline warnings on nonroot mode
Since most of the scripts requires root privilege, we don't shows up offline
warning on nonroot mode.

Fixes #7286

Closes #7287
2020-09-29 13:30:13 +03:00
Pekka Enberg
1adf2cc848 Revert "scylla_ntp_setup: use chrony on all distributions"
This reverts commit 8366d2231d because it
causes the following "scylla_setup" failure on Ubuntu 16.04:

  Command: 'sudo /usr/lib/scylla/scylla_setup --nic ens5 --disks /dev/nvme0n1  --swap-directory / '
  Exit code: 1
  Stdout:
  Setting up libtomcrypt0:amd64 (1.17-7ubuntu0.1) ...
  Setting up chrony (2.1.1-1ubuntu0.1) ...
  Creating '_chrony' system user/group for the chronyd daemon…
  Creating config file /etc/chrony/chrony.conf with new version
  Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
  Processing triggers for ureadahead (0.100.0-19.1) ...
  Processing triggers for systemd (229-4ubuntu21.29) ...
  501 Not authorised
  NTP setup failed.
  Stderr:
  chrony.service is not a native service, redirecting to systemd-sysv-install
  Executing /lib/systemd/systemd-sysv-install enable chrony
  Traceback (most recent call last):
  File "/opt/scylladb/scripts/libexec/scylla_ntp_setup", line 63, in <module>
  run('chronyc makestep')
  File "/opt/scylladb/scripts/scylla_util.py", line 504, in run
  return subprocess.run(cmd, stdout=stdout, stderr=stderr, shell=shell, check=exception, env=scylla_env).returncode
  File "/opt/scylladb/python3/lib64/python3.8/subprocess.py", line 512, in run
  raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['chronyc', 'makestep']' returned non-zero exit status 1.
2020-09-29 11:23:23 +03:00
Takuya ASADA
8366d2231d scylla_ntp_setup: use chrony on all distributions
To simplify scylla_ntp_setup, use chrony on all distributions.
2020-09-27 12:30:02 +03:00
Takuya ASADA
eae2aa58fa dist/common/scripts: move back get_set_nic_and_disks_config_value to scylla_util.py
The function mistakenly moved to scylla_sysconfig_setup but it also referenced
from scylla_prepare, move back to scylla_util.py

Fixes #7276

Closes #7280
2020-09-25 13:05:43 +03:00
Pekka Enberg
9a19c028e4 scylla_kernel_check: Switch to os.mkdirs() function
Commit 8e1f7d4fc7 ("dist/common/scripts: drop makedirs(), use
os.makedirs()") dropped the "mkdirs()" function, but forgot to convert
the caller in scylla_kernel_check to os.mkdirs().

Message-Id: <20200923104510.230244-1-penberg@scylladb.com>
2020-09-23 13:54:43 +03:00
Takuya ASADA
f243ccfa89 scylla_cpuscaling_setup: add Install section for scylla-cpupower.service
Install section requires for enable/disable services.

Fixes #7230
2020-09-22 10:18:01 +02:00
Takuya ASADA
48223022f7 scylla_util.py: de-duplicate code on parse_scylla_dirs_with_default() and get_scylla_dirs()
Seems like parse_scylla_dirs_with_default() and get_scylla_dirs() shares most of
the code, de-duplicate it.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
2020-09-20 00:50:37 +09:00
Takuya ASADA
f8321bc66a scylla_util.py: remove rmtree() and redhat_version() since these are unused 2020-09-20 00:50:05 +09:00
Takuya ASADA
8e1f7d4fc7 dist/common/scripts: drop makedirs(), use os.makedirs()
Since os.makedirs() has exist_ok option, no need to create wrapper function.
2020-09-20 00:48:06 +09:00
Takuya ASADA
85f76e80b4 dist/common/scripts: drop hex2list.py since it's nolonger used
Signed-off-by: Takuya ASADA <syuu@scylladb.com>
2020-09-20 00:45:25 +09:00
Takuya ASADA
0f5c83f73d dist/common/scripts: drop is_systemd() since we nolonger support non-systemd environment 2020-09-20 00:45:02 +09:00
Takuya ASADA
82701dc5ed dist/common/scripts: drop dist_name() and dist_ver()
It can be replaced with distro.name() and distro.version().

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
2020-09-20 00:42:27 +09:00
Takuya ASADA
79d8192dc7 dist/common/scripts: move functions that are only called from single file
scylla_util.py is a library for common functions across setup scripts,
it should not include private function of single file.
So move all those functions to caller file.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
2020-09-20 00:42:19 +09:00
Avi Kivity
12ca7f7ace Merge 'dist/common/scripts: skip internet access on offline installation' from Takuya ASADA
We need to skip internet access on offline installation.
To do this we need following changes:
 - prevent running yum/apt for each script
 - set default "NO" for scripts it requires package installation
 - set default "NO" for scripts it requires internet access, such as NTP

See #7153

Closes #7224

* syuu1228-offline_setup:
  dist/common/scripts: skip internet access on offline installation
  scylla_ntp_setup: use shutil.witch() to lookup command
2020-09-17 12:14:20 +03:00
Bentsi Magidovich
12e018ad04 scylla_util.py: added GCE instance/image support 2020-09-16 11:32:57 +03:00
Bentsi Magidovich
5aef44fc82 scylla_util.py: make max_retries as a curl function argument 2020-09-16 11:25:01 +03:00
Bentsi Magidovich
1f31e976cc scylla_util.py: adding timeout to curl function 2020-09-16 11:25:01 +03:00
Bentsi Magidovich
f5d97afaa2 scylla_util.py: styling fixes to curl function
- rename deprecated logging.warn to logging.warning
- remove redundant round brackets in the if statement
2020-09-16 11:25:01 +03:00
Bentsi Magidovich
a24ec2686f scylla_util.py: change default value for headers argument in curl function
- It was set to {} that is incorrect and can lead to unexpected behavior
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
- Order of the arguments changed to more convinient way
2020-09-16 11:25:01 +03:00
Takuya ASADA
db9e6f50f3 dist/common/scripts: skip internet access on offline installation
We need to skip internet access on offline installation.
To do this we need following changes:
 - prevent running yum/apt for each script
 - set default "NO" for scripts it requires package installation
 - set default "NO" for scripts it requires internet access, such as NTP

See #7153
Fixes #7182
2020-09-16 10:05:20 +09:00
Takuya ASADA
ca8f0ff588 scylla_ntp_setup: use shutil.witch() to lookup command
The command installed directory may different between distributions,
we can abstract the difference using shutil.witch().
Also the script become simpler than passing full path to os.path.exists().
2020-09-16 10:04:23 +09:00
Takuya ASADA
5f541fbdc5 scylla_setup: drop hugepages package installation
hugepages and libhugetlbfs-bin packages is only required for DPDK mode,
and unconditionally installation causes error on offline mode, so drop it.

Fixes #7182
2020-09-14 17:05:09 +03:00
Takuya ASADA
e1b15ba09e dist/common/scripts: abort scylla_prepare with better error message
When configuration files for perftune contain invalid parameter, scylla_prepare
may cause traceback because error handling is not eough.

Throw all errors from create_perftune_conf(), catch them on scylla_prepare,
print user understandable error.

Fixes #6847
2020-09-08 23:39:34 +03:00
Takuya ASADA
4deb245198 scylla_ntp_setup: don't install ntpd package when it's already exists
Don't install ntpd package when it's already exists.

Related with #7153
2020-09-08 13:59:04 +03:00
Takuya ASADA
cb221ac393 scylla_setup: verify package correctly on offline install
do_verify_package written only for .rpm/.deb, does not working correctly
for offline install(including nonroot).
We should check file existance for the environment, not by package existance
using rpm/dpkg.

Fixes #7075
2020-08-24 20:10:36 +09:00
Takuya ASADA
c71e5f244a scylla_util.py: implement is_offline() to detect offline installed image
Like is_nonroot(), detect offline installed image using install.sh.
2020-08-24 20:10:36 +09:00
Takuya ASADA
7cccb018b8 aws: update enhanced networking supported instance list
Sync enhanced networking supported instance list to latest one.

Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html

Fixes #6991
2020-08-12 15:43:17 +03:00
Takuya ASADA
6fbbe836c1 scylla_raid_setup: use mdadm.service on older Debian variants
On older Debian variants does not have mdmonitor.service, we should use
mdadm.service instead.

Fixes #7000
2020-08-11 12:52:24 +03:00
Avi Kivity
f9aea94c5c Merge 'add out of box configs for GCP VMs with nvmes' from Lubos
"
not recommended setups will still run iotune
fixes #6631
"

* tarzanek-gcp-iosetup:
  scylla_io_setup: Supported GCP VMs with NVMEs get out of box I/O configs
  scylla_util.py: add support for gcp instances
  scylla_util.py: support http headers in curl function
  scylla_io_setup: refactor iotune run to a function
2020-08-10 18:17:38 +03:00
Takuya ASADA
48944adc72 scylla_setup: add swap size interactive prompt on swap setup
Fixes #6947
2020-08-10 13:53:20 +03:00
Takuya ASADA
e9f688b0e8 scylla_swap_setup: add --swap-size option to specify swap size
Add --swap-size option to allow user to customize swap size.
2020-08-10 13:53:20 +03:00
Takuya ASADA
1fa0886ac0 scylla_swap_setup: limit swapfile size to half of diskspace
We should not fill entire disk space with swapfile, it's safer to limit
swap size 50% of diskspace.
Also, if 50% of diskspace <= 1GB, abort setup since it's out of disk space.
2020-08-10 13:53:20 +03:00
Takuya ASADA
7f5c8d6553 scylla_swap_setup: calculate in bytes instead of GB
Converting memory & disk sizes to an int value of N gigabytes was too rough,
it become problematic in low memory size / low disk size environment, such as
some types of EC2 instances.
We should calculate in bytes.
2020-08-10 13:53:19 +03:00
Takuya ASADA
b21bed701b scylla_swap_setup: use psutil to get memtotal and disk free
To get better API of memory & disk statistics, switch to psutil.
With the library we don't need to parse /proc/meminfo.

[avi: regenerate tools/toolchain/image for new python3-psutils package]
2020-08-10 13:50:09 +03:00
Lubos Kosco
c203b6bb1f scylla_io_setup: Supported GCP VMs with NVMEs get out of box I/O configs
Iotune isn't run for supported/recommended GCP instances anymore,
we set the I/O properties now based on GCP tables or our
measurements(where applicable).
Not recommended/supported setups will still run iotune.

Fixes #6631
2020-08-08 11:05:28 +02:00
Lubos Kosco
125a84d7c5 scylla_util.py: add support for gcp instances
GCP VMs with NVMEs that are recommended can be recognized now.
Detection is done using resolving of internal GCP metadata server.
We recommend 2 cpu instances at least. For more than 16 disks
we mandate at least 32 cpus. 50:1 disk to ram ratio also has to be
kept.
Instances that use NVMEs as root disks are also considered as unsupported.

Supported instances for NVMEs are n1, n2, n2d, c2 and m1-megamem-96.
All others are unsupported now.
2020-08-08 11:04:37 +02:00
Lubos Kosco
97e3ab739b scylla_util.py: support http headers in curl function 2020-08-08 10:58:59 +02:00
Lubos Kosco
0c5dbb4c4f scylla_io_setup: refactor iotune run to a function 2020-08-08 10:57:31 +02:00
Takuya ASADA
c0b2933106 scylla_setup: skip RAID prompt when var-lib-scylla.mount already exists
Since scylla_raid_setup always cause error when var-lib-scylla.mount already
exists, it's better to skip RAID prompt.

See #6965
2020-08-03 17:44:02 +03:00
Takuya ASADA
cff3e60f98 scylla_raid_setup: check var-lib-scylla.mount existance before formatting RAID
We should run var-lib-scyllla.mount existance check before formatting RAID.

Fixes #6965
2020-08-03 17:44:02 +03:00
Takuya ASADA
9e5d548f75 scylla_raid_setup: initialize MDRAID before mounting data volume
var-lib-scylla.mount should wait for MDRAID initilization, so we need to add
'After=mdmonitor.service'.
However, currently mdmonitor.service fails to start due to no mail address
specified, we need to add the entry on mdadm.conf.

Fixes #6876
2020-07-31 06:33:52 +09:00
Takuya ASADA
a19a62e6f6 scylla_util.py: always use relocatable CLI tools
On some CLI tools, command options may different between latest version
vs older version.
To maximize compatibility of setup scripts, we should always use
relocatable CLI tools instead of distribution version of the tool.

Related #6954
2020-07-31 04:17:01 +09:00
Takuya ASADA
d7de9518fe scylla_setup: skip boot partition
On GCE, /dev/sda14 reported as unused disk but it's BIOS boot partition,
should not use for scylla data partition, also cannot use for it since it's
too small.

It's better to exclude such partiotion from unsed disk list.

Fixes #6636
2020-07-28 12:19:55 +03:00
Takuya ASADA
97fa17b17b scylla_setup: remove square bracket from disk prompt selected list
Selected list on disk prompt is looks like an alternatives, it's better to use
single quote.

Fixes #6760
2020-07-27 14:50:31 +03:00
Takuya ASADA
0ffa0e8745 dist_util.py: use correct ID value to detect Amazon Linux 2
On 2d63acdd6a we replaced 'ol' and 'amzn'
to 'oracle' and 'amazon', but distro.id() actually returns 'amzn' for
Amazon Linux 2, so we need to revert the change.

Fixes #6882
2020-07-27 12:46:21 +03:00
Pekka Enberg
0b8c9668e3 scylla_setup: Add '--io-setup ENABLE' command line option
To make the "scylla_setup" interface similar to Docker image, let's add
a "--io-setup ENABLE" command line option. The old "--no-io-setup"
option is retained for compatibility.
2020-07-21 14:48:01 +03:00
Takuya ASADA
c99f31f770 scylla_setup: abort RAID disk prompt when no free disks available
Fixes #6860
2020-07-19 14:48:59 +03:00
Takuya ASADA
9b5f28a2e3 scylla_raid_setup: fix incorrect block device path
To use UUID, we need a tag "UUID=<uuid>".

reference: https://www.freedesktop.org/software/systemd/man/systemd.mount.html
reference: https://man7.org/linux/man-pages/man8/mount.8.html
2020-07-15 18:22:46 +03:00
Takuya ASADA
e6e4359414 scylla_raid_setup: switch to systemd mount unit
Since we already use systemd unit file for coredump bind mount and swapfile,
we should move to systemd mount unit for data partition as well.
2020-07-13 17:14:44 +03:00
Pekka Enberg
f2b4c1a212 scylla_prepare: Improve error message on missing CPU features
Let's report each missing CPU feature individually, and improve the
error message a bit. For example, if the "clmul" instruction is missing,
the report looks as follows:

  ERROR: You will not be able to run Scylla on this machine because its CPU lacks the following features: pclmulqdq

  If this is a virtual machine, please update its CPU feature configuration or upgrade to a newer hypervisor.

Fixes #6528
2020-07-13 11:39:29 +03:00