Compare commits

...

26 Commits

Author SHA1 Message Date
fdda47e8a2 Bump version to 0.9.72 2023-09-01 16:34:45 -04:00
a5ffe373cd Add default node values to commands 2023-09-01 16:33:26 -04:00
bb2aac145d Bump version to 0.9.71 2023-09-01 00:36:38 -04:00
a7c1b91f60 [Bookworm] Correct install of manage scripts 2023-09-01 00:36:24 -04:00
ec6d3351b2 [Bookworm] Correct Celery invocation 2023-09-01 00:30:01 -04:00
22faaa9bbc [Bookworm] Correct Flask DB migration process
Move the old manage script to _legacy, and add a new _flask version with
modern Flask tooling. Decide which one to call via pvc-api-db-migrate
using /etc/debian_version call.
2023-09-01 00:29:17 -04:00
6c407d54c3 Bump version to 0.9.70 2023-08-31 14:15:54 -04:00
9ba7aa5b08 [Bookworm] Remove obsolete package 2023-08-31 14:13:05 -04:00
cb413e5ce6 [Bookworm] Fix Ceph 16 OSD stat parsing 2023-08-31 00:45:03 -04:00
123499f75f [Bookworm] Specify YAML loader explicitly 2023-08-31 00:16:19 -04:00
83b8ce7b62 Bump version to 0.9.69 (nice) 2023-08-29 22:02:13 -04:00
5e43f9bd7c Ensure Patroni failures do not block takeover 2023-08-29 22:00:11 -04:00
ed087d83c2 Found cpuload to 2 decimal places 2023-08-29 21:41:44 -04:00
83d475bd15 Bump version to 0.9.68 2023-08-27 20:59:23 -04:00
3d5cdf2b23 Fix missing function parameter 2023-08-27 20:57:27 -04:00
705ec802a3 Bump version to 0.9.67 2023-08-27 14:47:20 -04:00
47d7b23763 Fix missing re import 2023-08-27 14:45:51 -04:00
0bae729a18 Better handle empty diffs 2023-08-27 14:44:21 -04:00
b968110e9f Add missing import for difflib unified_diff 2023-08-27 14:40:52 -04:00
4898ae5082 Fix missing import of colorama Fore 2023-08-27 14:34:47 -04:00
249e1568a1 Fix incorrect echo() calls 2023-08-27 14:33:42 -04:00
0b90f37518 Bump version to 0.9.66 2023-08-27 11:41:22 -04:00
33205273dc Fix missing YAML load 2023-08-27 11:41:10 -04:00
1e083d7652 Bump version to 0.9.65 2023-08-23 01:56:57 -04:00
65d2b7869c Restore original no-connection behavior
Previously not specifying a connection when multiple were available
would error. This restores that behaviour.
2023-08-23 01:38:50 -04:00
66aee73f1d Fix incorrect short flags in node list 2023-08-22 09:26:35 -04:00
17 changed files with 264 additions and 95 deletions

View File

@ -1 +1 @@
0.9.64
0.9.72

View File

@ -1,5 +1,39 @@
## PVC Changelog
###### [v0.9.72](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.72)
* [CLI] Restores old functionality for default node value
###### [v0.9.71](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.71)
* [API] Adds API support for Debian Bookworm
###### [v0.9.70](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.70)
* [Node Daemon] Fixes several compatibility issues for Debian 12 "Bookworm"
###### [v0.9.69](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.69)
* [Node Daemon] Ensures that system load is always 2 decimal places on Bookworm
* [Node Daemon] Fixes bug blocking primary takeover at DNS Aggregator start if Patroni is down
###### [v0.9.68](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.68)
* [CLI] Fixes another bug with network info view
###### [v0.9.67](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.67)
* [CLI] Fixes several more bugs in the refactored CLI
###### [v0.9.66](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.66)
* [CLI] Fixes a missing YAML import in CLI
###### [v0.9.65](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.65)
* [CLI] Fixes a bug in the node list filtering command
* [CLI] Fixes a bug/default when no connection is specified
###### [v0.9.64](https://github.com/parallelvirtualcluster/pvc/releases/tag/v0.9.64)
**Breaking Change [CLI]**: The CLI client root commands have been reorganized. The following commands have changed:

View File

@ -11,5 +11,16 @@ if [[ ! -f ${PVC_CONFIG_FILE} ]]; then
fi
pushd /usr/share/pvc
./pvcapid-manage.py db upgrade
case "$( cat /etc/debian_version )" in
10.*|11.*)
# Debian 10 & 11
./pvcapid-manage_legacy.py db upgrade
;;
*)
# Debian 12+
flask --app ./pvcapid-manage_flask.py db upgrade
;;
esac
popd

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
# pvcapid-manage_flask.py - PVC Database management tasks (via Flask CLI)
# Part of the Parallel Virtual Cluster (PVC) system
#
# Copyright (C) 2018-2022 Joshua M. Boniface <joshua@boniface.me>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
#
###############################################################################
from pvcapid.flaskapi import app, db
from pvcapid.models import * # noqa F401,F403
from flask_migrate import Migrate
migrate = Migrate(app, db)
# Call flask --app /usr/share/pvc/pvcapid-manage_flask.py db upgrade

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# manage.py - PVC Database management tasks
# pvcapid-manage_legacy.py - PVC Database management tasks (Legacy)
# Part of the Parallel Virtual Cluster (PVC) system
#
# Copyright (C) 2018-2022 Joshua M. Boniface <joshua@boniface.me>
@ -19,8 +19,7 @@
#
###############################################################################
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand, Manager
from pvcapid.flaskapi import app, db
from pvcapid.models import * # noqa F401,F403

View File

@ -27,12 +27,8 @@ case "$( cat /etc/debian_version )" in
10.*)
CELERY_ARGS="worker --app pvcapid.flaskapi.celery --concurrency 1 --loglevel INFO"
;;
11.*)
CELERY_ARGS="--app pvcapid.flaskapi.celery worker --concurrency 1 --loglevel INFO"
;;
*)
echo "Invalid Debian version found!"
exit 1
CELERY_ARGS="--app pvcapid.flaskapi.celery worker --concurrency 1 --loglevel INFO"
;;
esac

View File

@ -27,7 +27,7 @@ from ssl import SSLContext, TLSVersion
from distutils.util import strtobool as dustrtobool
# Daemon version
version = "0.9.64"
version = "0.9.72"
# API version
API_VERSION = 1.0

View File

@ -19,6 +19,8 @@
#
###############################################################################
from colorama import Fore
from difflib import unified_diff
from functools import wraps
from json import dump as jdump
from json import dumps as jdumps
@ -26,7 +28,9 @@ from json import loads as jloads
from os import environ, makedirs, path
from pkg_resources import get_distribution
from lxml.etree import fromstring, tostring
from re import sub
from re import sub, match
from yaml import load as yload
from yaml import SafeLoader as SafeYAMLLoader
from pvc.cli.helpers import *
from pvc.cli.waiters import *
@ -565,7 +569,7 @@ def cli_node():
short_help="Set node as primary coordinator.",
)
@connection_req
@click.argument("node")
@click.argument("node", default=DEFAULT_NODE_HOSTNAME)
@click.option(
"-w",
"--wait",
@ -615,7 +619,7 @@ NOTE: There are currently {len(tasks_retdata)} active or queued provisioner task
short_help="Set node as secondary coordinator.",
)
@connection_req
@click.argument("node")
@click.argument("node", default=DEFAULT_NODE_HOSTNAME)
@click.option(
"-w",
"--wait",
@ -667,7 +671,7 @@ NOTE: There are currently {len(tasks_retdata)} active or queued provisioner task
short_help="Take node out of service.",
)
@connection_req
@click.argument("node")
@click.argument("node", default=DEFAULT_NODE_HOSTNAME)
@click.option(
"-w",
"--wait",
@ -705,7 +709,7 @@ def cli_node_flush(
short_help="Restore node to service.",
)
@connection_req
@click.argument("node")
@click.argument("node", default=DEFAULT_NODE_HOSTNAME)
@click.option(
"-w",
"--wait",
@ -743,7 +747,7 @@ def cli_node_ready(
short_help="View node daemon logs.",
)
@connection_req
@click.argument("node")
@click.argument("node", default=DEFAULT_NODE_HOSTNAME)
@click.option(
"-l",
"--lines",
@ -850,14 +854,14 @@ def cli_node_info(
help="Limit list to nodes in the specified daemon state.",
)
@click.option(
"-ds",
"-cs",
"--coordinator-state",
"coordinator_state_filter",
default=None,
help="Limit list to nodes in the specified coordinator state.",
)
@click.option(
"-ds",
"-vs",
"--domain-state",
"domain_state_filter",
default=None,
@ -1194,7 +1198,7 @@ def cli_vm_modify(
text=current_vm_cfgfile, require_save=True, extension=".xml"
)
if new_vm_cfgfile is None:
echo("Aborting with no modifications.")
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
else:
new_vm_cfgfile = new_vm_cfgfile.strip()
@ -1206,16 +1210,14 @@ def cli_vm_modify(
cfgfile.close()
echo(
CLI_CONFIG,
'Replacing configuration of VM "{}" with file "{}".'.format(
dom_name, cfgfile.name
)
),
)
# Show a diff and confirm
echo("Pending modifications:")
echo("")
diff = list(
difflib.unified_diff(
unified_diff(
current_vm_cfgfile.split("\n"),
new_vm_cfgfile.split("\n"),
fromfile="current",
@ -1226,16 +1228,23 @@ def cli_vm_modify(
lineterm="",
)
)
if len(diff) < 1:
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
# Show a diff and confirm
echo(CLI_CONFIG, "Pending modifications:")
echo(CLI_CONFIG, "")
for line in diff:
if re.match(r"^\+", line) is not None:
echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
elif re.match(r"^\-", line) is not None:
echo(colorama.Fore.RED + line + colorama.Fore.RESET)
elif re.match(r"^\^", line) is not None:
echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
if match(r"^\+", line) is not None:
echo(CLI_CONFIG, Fore.GREEN + line + Fore.RESET)
elif match(r"^\-", line) is not None:
echo(CLI_CONFIG, Fore.RED + line + Fore.RESET)
elif match(r"^\^", line) is not None:
echo(CLI_CONFIG, Fore.BLUE + line + Fore.RESET)
else:
echo(line)
echo("")
echo(CLI_CONFIG, line)
echo(CLI_CONFIG, "")
# Verify our XML is sensible
try:
@ -3592,7 +3601,7 @@ def cli_storage_volume_upload(pool, name, image_format, image_file):
"""
if not os.path.exists(image_file):
echo("ERROR: File '{}' does not exist!".format(image_file))
echo(CLI_CONFIG, "ERROR: File '{}' does not exist!".format(image_file))
exit(1)
retcode, retmsg = pvc.lib.storage.ceph_volume_upload(
@ -4430,7 +4439,8 @@ def cli_provisioner_template_storage_disk_add(
if source_volume and (size or filesystem or mountpoint):
echo(
'The "--source-volume" option is not compatible with the "--size", "--filesystem", or "--mountpoint" options.'
CLI_CONFIG,
'The "--source-volume" option is not compatible with the "--size", "--filesystem", or "--mountpoint" options.',
)
exit(1)
@ -4510,9 +4520,9 @@ def cli_provisioner_userdata_add(name, filename):
userdata = filename.read()
filename.close()
try:
yaml.load(userdata, Loader=yaml.SafeLoader)
yload(userdata, Loader=SafeYAMLLoader)
except Exception as e:
echo("Error: Userdata document is malformed")
echo(CLI_CONFIG, "Error: Userdata document is malformed")
cleanup(False, e)
params = dict()
@ -4549,7 +4559,7 @@ def cli_provisioner_userdata_modify(name, filename, editor):
# Grab the current config
retcode, retdata = pvc.lib.provisioner.userdata_info(CLI_CONFIG, name)
if not retcode:
echo(retdata)
echo(CLI_CONFIG, retdata)
exit(1)
current_userdata = retdata["userdata"].strip()
@ -4557,16 +4567,14 @@ def cli_provisioner_userdata_modify(name, filename, editor):
text=current_userdata, require_save=True, extension=".yaml"
)
if new_userdata is None:
echo("Aborting with no modifications.")
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
else:
new_userdata = new_userdata.strip()
# Show a diff and confirm
echo("Pending modifications:")
echo("")
diff = list(
difflib.unified_diff(
unified_diff(
current_userdata.split("\n"),
new_userdata.split("\n"),
fromfile="current",
@ -4577,16 +4585,22 @@ def cli_provisioner_userdata_modify(name, filename, editor):
lineterm="",
)
)
if len(diff) < 1:
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
echo(CLI_CONFIG, "Pending modifications:")
echo(CLI_CONFIG, "")
for line in diff:
if re.match(r"^\+", line) is not None:
echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
elif re.match(r"^\-", line) is not None:
echo(colorama.Fore.RED + line + colorama.Fore.RESET)
elif re.match(r"^\^", line) is not None:
echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
if match(r"^\+", line) is not None:
echo(CLI_CONFIG, Fore.GREEN + line + Fore.RESET)
elif match(r"^\-", line) is not None:
echo(CLI_CONFIG, Fore.RED + line + Fore.RESET)
elif match(r"^\^", line) is not None:
echo(CLI_CONFIG, Fore.BLUE + line + Fore.RESET)
else:
echo(line)
echo("")
echo(CLI_CONFIG, line)
echo(CLI_CONFIG, "")
click.confirm("Write modifications to cluster?", abort=True)
@ -4599,9 +4613,9 @@ def cli_provisioner_userdata_modify(name, filename, editor):
filename.close()
try:
yaml.load(userdata, Loader=yaml.SafeLoader)
yload(userdata, Loader=SafeYAMLLoader)
except Exception as e:
echo("Error: Userdata document is malformed")
echo(CLI_CONFIG, "Error: Userdata document is malformed")
cleanup(False, e)
params = dict()
@ -4739,22 +4753,20 @@ def cli_provisioner_script_modify(name, filename, editor):
# Grab the current config
retcode, retdata = pvc.lib.provisioner.script_info(CLI_CONFIG, name)
if not retcode:
echo(retdata)
echo(CLI_CONFIG, retdata)
exit(1)
current_script = retdata["script"].strip()
new_script = click.edit(text=current_script, require_save=True, extension=".py")
if new_script is None:
echo("Aborting with no modifications.")
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
else:
new_script = new_script.strip()
# Show a diff and confirm
echo("Pending modifications:")
echo("")
diff = list(
difflib.unified_diff(
unified_diff(
current_script.split("\n"),
new_script.split("\n"),
fromfile="current",
@ -4765,16 +4777,22 @@ def cli_provisioner_script_modify(name, filename, editor):
lineterm="",
)
)
if len(diff) < 1:
echo(CLI_CONFIG, "Aborting with no modifications.")
exit(0)
echo(CLI_CONFIG, "Pending modifications:")
echo(CLI_CONFIG, "")
for line in diff:
if re.match(r"^\+", line) is not None:
echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
elif re.match(r"^\-", line) is not None:
echo(colorama.Fore.RED + line + colorama.Fore.RESET)
elif re.match(r"^\^", line) is not None:
echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
if match(r"^\+", line) is not None:
echo(CLI_CONFIG, Fore.GREEN + line + Fore.RESET)
elif match(r"^\-", line) is not None:
echo(CLI_CONFIG, Fore.RED + line + Fore.RESET)
elif match(r"^\^", line) is not None:
echo(CLI_CONFIG, Fore.BLUE + line + Fore.RESET)
else:
echo(line)
echo("")
echo(CLI_CONFIG, line)
echo(CLI_CONFIG, "")
click.confirm("Write modifications to cluster?", abort=True)
@ -4895,7 +4913,7 @@ def cli_provisioner_ova_upload(name, filename, pool):
"""
if not os.path.exists(filename):
echo("ERROR: File '{}' does not exist!".format(filename))
echo(CLI_CONFIG, "ERROR: File '{}' does not exist!".format(filename))
exit(1)
params = dict()
@ -5600,11 +5618,8 @@ def cli(
global CLI_CONFIG
store_data = get_store(store_path)
# If no connection is specified, use the first connection in the store
if _connection is None:
CLI_CONFIG = get_config(store_data, list(store_data.keys())[0])
# If the connection isn't in the store, mark it bad but pass the value
elif _connection not in store_data.keys():
if _connection is not None and _connection not in store_data.keys():
CLI_CONFIG = {"badcfg": True, "connection": _connection}
else:
CLI_CONFIG = get_config(store_data, _connection)

View File

@ -700,7 +700,7 @@ def format_info(config, network_information, long_output):
ainformation.append("")
if retcode:
dhcp4_reservations_string = format_list_dhcp(
dhcp4_reservations_list
config, dhcp4_reservations_list
)
for line in dhcp4_reservations_string.split("\n"):
ainformation.append(line)

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name="pvc",
version="0.9.64",
version="0.9.72",
packages=["pvc.cli", "pvc.lib"],
install_requires=[
"Click",

50
debian/changelog vendored
View File

@ -1,3 +1,53 @@
pvc (0.9.72-0) unstable; urgency=high
* [CLI] Restores old functionality for default node value
-- Joshua M. Boniface <joshua@boniface.me> Fri, 01 Sep 2023 16:34:45 -0400
pvc (0.9.71-0) unstable; urgency=high
* [API] Adds API support for Debian Bookworm
-- Joshua M. Boniface <joshua@boniface.me> Fri, 01 Sep 2023 00:30:42 -0400
pvc (0.9.70-0) unstable; urgency=high
* [Node Daemon] Fixes several compatibility issues for Debian 12 "Bookworm"
-- Joshua M. Boniface <joshua@boniface.me> Thu, 31 Aug 2023 14:15:54 -0400
pvc (0.9.69-0) unstable; urgency=high
* [Node Daemon] Ensures that system load is always 2 decimal places on Bookworm
* [Node Daemon] Fixes bug blocking primary takeover at DNS Aggregator start if Patroni is down
-- Joshua M. Boniface <joshua@boniface.me> Tue, 29 Aug 2023 22:01:22 -0400
pvc (0.9.68-0) unstable; urgency=high
* [CLI] Fixes another bug with network info view
-- Joshua M. Boniface <joshua@boniface.me> Sun, 27 Aug 2023 20:59:23 -0400
pvc (0.9.67-0) unstable; urgency=high
* [CLI] Fixes several more bugs in the refactored CLI
-- Joshua M. Boniface <joshua@boniface.me> Sun, 27 Aug 2023 14:47:20 -0400
pvc (0.9.66-0) unstable; urgency=high
* [CLI] Fixes a missing YAML import in CLI
-- Joshua M. Boniface <joshua@boniface.me> Sun, 27 Aug 2023 11:36:05 -0400
pvc (0.9.65-0) unstable; urgency=high
* [CLI] Fixes a bug in the node list filtering command
* [CLI] Fixes a bug/default when no connection is specified
-- Joshua M. Boniface <joshua@boniface.me> Wed, 23 Aug 2023 01:56:57 -0400
pvc (0.9.64-0) unstable; urgency=high
**Breaking Change [CLI]**: The CLI client root commands have been reorganized. The following commands have changed:

2
debian/control vendored
View File

@ -16,7 +16,7 @@ Description: Parallel Virtual Cluster node daemon (Python 3)
Package: pvc-daemon-api
Architecture: all
Depends: systemd, pvc-daemon-common, python3-yaml, python3-flask, python3-flask-restful, python3-celery, python-celery-common, python3-distutils, redis, python3-redis, python3-lxml, python3-flask-migrate, python3-flask-script, fio
Depends: systemd, pvc-daemon-common, python3-yaml, python3-flask, python3-flask-restful, python3-celery, python-celery-common, python3-distutils, redis, python3-redis, python3-lxml, python3-flask-migrate, fio
Description: Parallel Virtual Cluster API daemon (Python 3)
A KVM/Zookeeper/Ceph-based VM and private cloud manager
.

View File

@ -1,5 +1,5 @@
api-daemon/pvcapid.py usr/share/pvc
api-daemon/pvcapid-manage.py usr/share/pvc
api-daemon/pvcapid-manage*.py usr/share/pvc
api-daemon/pvc-api-db-upgrade usr/share/pvc
api-daemon/pvcapid.sample.yaml etc/pvc
api-daemon/pvcapid usr/share/pvc

View File

@ -49,7 +49,7 @@ import re
import json
# Daemon version
version = "0.9.64"
version = "0.9.72"
##########################################################

View File

@ -77,7 +77,7 @@ def connect_zookeeper():
with open(pvcnoded_config_file, "r") as cfgfile:
try:
o_config = yaml.load(cfgfile)
o_config = yaml.load(cfgfile, yaml.SafeLoader)
except Exception as e:
print(
"ERROR: Failed to parse configuration file: {}".format(e),

View File

@ -620,9 +620,12 @@ class NodeInstance(object):
for network in self.d_network:
self.d_network[network].startDHCPServer()
# 9. Start DNS aggregator; just continue if we fail
if not patroni_failed:
self.dns_aggregator.start_aggregator()
else:
try:
if not patroni_failed:
self.dns_aggregator.start_aggregator()
else:
raise
except Exception:
self.logger.out(
"Not starting DNS aggregator due to Patroni failures", state="e"
)

View File

@ -338,8 +338,21 @@ def collect_ceph_stats(logger, config, zkhandler, this_node, queue):
line = re.sub(r"\x1b(\[.*?[@-~]|\].*?(\x07|\x1b\\))", "", line)
# Split it for parsing
line = line.split()
if len(line) > 1 and line[1].isdigit():
# This is an OSD line so parse it
# Ceph 14 format:
# ['|', '0', '|', 'hv1.p.u.bonilan.net', '|', '318G', '|', '463G', '|', '213', '|', '1430k', '|', '22', '|', '124k', '|', 'exists,up', '|']
# Ceph 16 format:
# ['0', 'hv1.t.u.bonilan.net', '2489M', '236G', '0', '0', '0', '0', 'exists,up']
# Bypass obviously invalid lines
if len(line) < 1:
continue
elif line[0] == "+":
continue
# If line begins with | and second entry is a digit (i.e. OSD ID)
if line[0] == "|" and line[1].isdigit():
# Parse the line in Ceph 14 format
osd_id = line[1]
node = line[3].split(".")[0]
used = line[5]
@ -349,20 +362,39 @@ def collect_ceph_stats(logger, config, zkhandler, this_node, queue):
rd_ops = line[13]
rd_data = line[15]
state = line[17]
osd_status.update(
{
str(osd_id): {
"node": node,
"used": used,
"avail": avail,
"wr_ops": wr_ops,
"wr_data": wr_data,
"rd_ops": rd_ops,
"rd_data": rd_data,
"state": state,
}
# If first entry is a digit (i.e. OSD ID)
elif line[0].isdigit():
# Parse the line in Ceph 16 format
osd_id = line[0]
node = line[1].split(".")[0]
used = line[2]
avail = line[3]
wr_ops = line[4]
wr_data = line[5]
rd_ops = line[6]
rd_data = line[7]
state = line[8]
# Otherwise, it's the header line and is ignored
else:
continue
# I don't know why 2018 me used this construct instead of a normal
# dictionary update, but it works so not changing it.
# ref: bfbe9188ce830381f3f2fa1da11f1973f08eca8c
osd_status.update(
{
str(osd_id): {
"node": node,
"used": used,
"avail": avail,
"wr_ops": wr_ops,
"wr_data": wr_data,
"rd_ops": rd_ops,
"rd_data": rd_data,
"state": state,
}
)
}
)
# Merge them together into a single meaningful dict
if debug:
@ -753,7 +785,7 @@ def node_keepalive(logger, config, zkhandler, this_node, monitoring_instance):
this_node.memtotal = int(psutil.virtual_memory().total / 1024 / 1024)
this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024)
this_node.memfree = int(psutil.virtual_memory().free / 1024 / 1024)
this_node.cpuload = os.getloadavg()[0]
this_node.cpuload = round(os.getloadavg()[0], 2)
# Join against running threads
if config["enable_hypervisor"]: