Use consistent naming of components
Rename "pvcd" to "pvcnoded", and "pvc-api" to "pvcapid" so names for the daemons are fully consistent. Update the names of the configuration files as well to match this new formatting. References #79
This commit is contained in:
parent
83704d8677
commit
ce985234c3
|
@ -1,16 +0,0 @@
|
||||||
# Parallel Virtual Cluster Provisioner client worker unit file
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description = Parallel Virtual Cluster Provisioner worker
|
|
||||||
After = network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type = simple
|
|
||||||
WorkingDirectory = /usr/share/pvc
|
|
||||||
Environment = PYTHONUNBUFFERED=true
|
|
||||||
Environment = PVC_CONFIG_FILE=/etc/pvc/pvc-api.yaml
|
|
||||||
ExecStart = /usr/bin/celery worker -A pvc-api.celery --concurrency 1 --loglevel INFO
|
|
||||||
Restart = on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy = multi-user.target
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Parallel Virtual Cluster Provisioner API provisioner worker unit file
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description = Parallel Virtual Cluster API provisioner worker
|
||||||
|
After = network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type = simple
|
||||||
|
WorkingDirectory = /usr/share/pvc
|
||||||
|
Environment = PYTHONUNBUFFERED=true
|
||||||
|
Environment = PVC_CONFIG_FILE=/etc/pvc/pvcapid.yaml
|
||||||
|
ExecStart = /usr/bin/celery worker -A pvcapid.celery --concurrency 1 --loglevel INFO
|
||||||
|
Restart = on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
|
@ -37,8 +37,8 @@ from flask_restful import Resource, Api, reqparse, abort
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
from celery.task.control import inspect
|
from celery.task.control import inspect
|
||||||
|
|
||||||
import api_lib.pvcapi_helper as api_helper
|
import pvcapid.helper as api_helper
|
||||||
import api_lib.pvcapi_provisioner as api_provisioner
|
import pvcapid.provisioner as api_provisioner
|
||||||
|
|
||||||
API_VERSION = 1.0
|
API_VERSION = 1.0
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ API_VERSION = 1.0
|
||||||
try:
|
try:
|
||||||
pvc_config_file = os.environ['PVC_CONFIG_FILE']
|
pvc_config_file = os.environ['PVC_CONFIG_FILE']
|
||||||
except:
|
except:
|
||||||
print('Error: The "PVC_CONFIG_FILE" environment variable must be set before starting pvc-api.')
|
print('Error: The "PVC_CONFIG_FILE" environment variable must be set before starting pvcapid.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
print('Starting PVC API daemon')
|
print('Starting PVC API daemon')
|
|
@ -1,11 +1,11 @@
|
||||||
---
|
---
|
||||||
# pvc-api client configuration file example
|
# pvcapid configuration file example
|
||||||
#
|
#
|
||||||
# This configuration file specifies details for the PVC API client running on
|
# This configuration file specifies details for the PVC API daemon running on
|
||||||
# this machine. Default values are not supported; the values in this sample
|
# this machine. Default values are not supported; the values in this sample
|
||||||
# configuration are considered defaults and can be used as-is.
|
# configuration are considered defaults and can be used as-is.
|
||||||
#
|
#
|
||||||
# Copy this example to /etc/pvc/pvc-api.conf and edit to your needs
|
# Copy this example to /etc/pvc/pvcapid.conf and edit to your needs
|
||||||
|
|
||||||
pvc:
|
pvc:
|
||||||
# debug: Enable/disable API debug mode
|
# debug: Enable/disable API debug mode
|
|
@ -8,8 +8,8 @@ After = network-online.target
|
||||||
Type = simple
|
Type = simple
|
||||||
WorkingDirectory = /usr/share/pvc
|
WorkingDirectory = /usr/share/pvc
|
||||||
Environment = PYTHONUNBUFFERED=true
|
Environment = PYTHONUNBUFFERED=true
|
||||||
Environment = PVC_CONFIG_FILE=/etc/pvc/pvc-api.yaml
|
Environment = PVC_CONFIG_FILE=/etc/pvc/pvcapid.yaml
|
||||||
ExecStart = /usr/share/pvc/pvc-api.py
|
ExecStart = /usr/share/pvc/pvcapid.py
|
||||||
Restart = on-failure
|
Restart = on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# pvcapi_helper.py - PVC HTTP API functions
|
# helper.py - PVC HTTP API helper functions
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# pvcapi_provisioner.py - PVC Provisioner functions
|
# provisioner.py - PVC API Provisioner functions
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -36,7 +36,7 @@ import daemon_lib.vm as pvc_vm
|
||||||
import daemon_lib.network as pvc_network
|
import daemon_lib.network as pvc_network
|
||||||
import daemon_lib.ceph as pvc_ceph
|
import daemon_lib.ceph as pvc_ceph
|
||||||
|
|
||||||
import api_lib.libvirt_schema as libvirt_schema
|
import pvcapid.libvirt_schema as libvirt_schema
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exceptions (used by Celery tasks)
|
# Exceptions (used by Celery tasks)
|
|
@ -29,7 +29,8 @@ for HOST in ${HOSTS[@]}; do
|
||||||
ssh $HOST mkdir /tmp/pvc
|
ssh $HOST mkdir /tmp/pvc
|
||||||
scp ../*.deb $HOST:/tmp/pvc/
|
scp ../*.deb $HOST:/tmp/pvc/
|
||||||
ssh $HOST $SUDO dpkg -i /tmp/pvc/*.deb
|
ssh $HOST $SUDO dpkg -i /tmp/pvc/*.deb
|
||||||
ssh $HOST $SUDO systemctl restart pvcd
|
ssh $HOST $SUDO systemctl restart pvcnoded
|
||||||
|
ssh $HOST $SUDO systemctl restart pvcapid
|
||||||
ssh $HOST rm -rf /tmp/pvc
|
ssh $HOST rm -rf /tmp/pvc
|
||||||
echo "****"
|
echo "****"
|
||||||
echo "Waiting 10s for host ${HOST} to stabilize"
|
echo "Waiting 10s for host ${HOST} to stabilize"
|
||||||
|
|
|
@ -48,7 +48,7 @@ myhostname = socket.gethostname().split('.')[0]
|
||||||
zk_host = ''
|
zk_host = ''
|
||||||
|
|
||||||
default_store_data = {
|
default_store_data = {
|
||||||
'cfgfile': '/etc/pvc/pvc-api.yaml' # pvc/api/listen_address, pvc/api/listen_port
|
'cfgfile': '/etc/pvc/pvcapid.yaml' # pvc/api/listen_address, pvc/api/listen_port
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -335,7 +335,7 @@ def cli_node():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -484,7 +484,7 @@ def cli_vm():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -965,7 +965,7 @@ def cli_network():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1201,7 +1201,7 @@ def net_dhcp():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1290,7 +1290,7 @@ def net_acl():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1419,7 +1419,7 @@ def cli_storage():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1460,7 +1460,7 @@ def ceph_osd():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1618,7 +1618,7 @@ def ceph_pool():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1702,7 +1702,7 @@ def ceph_volume():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1848,7 +1848,7 @@ def ceph_volume_snapshot():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1966,7 +1966,7 @@ def cli_provisioner():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1979,7 +1979,7 @@ def provisioner_template():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2009,7 +2009,7 @@ def provisioner_template_system():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2134,7 +2134,7 @@ def provisioner_template_network():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2237,7 +2237,7 @@ def provisioner_template_network_vni():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2300,7 +2300,7 @@ def provisioner_template_storage():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2371,7 +2371,7 @@ def provisioner_template_storage_disk():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2489,7 +2489,7 @@ def provisioner_userdata():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2647,7 +2647,7 @@ def provisioner_script():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2806,7 +2806,7 @@ def provisioner_profile():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -3086,7 +3086,7 @@ def cli_maintenance():
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -3127,7 +3127,7 @@ def status_cluster(oformat):
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
retcode, retdata = pvc_cluster.get_info(config)
|
retcode, retdata = pvc_cluster.get_info(config)
|
||||||
|
@ -3150,7 +3150,7 @@ def init_cluster(confirm_flag):
|
||||||
"""
|
"""
|
||||||
# Abort commands under this group if config is bad
|
# Abort commands under this group if config is bad
|
||||||
if config.get('badcfg', None):
|
if config.get('badcfg', None):
|
||||||
click.echo('No cluster specified and no local pvc-api.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
click.echo('No cluster specified and no local pvcapid.yaml configuration found. Use "pvc cluster" to add a cluster API to connect to.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not confirm_flag:
|
if not confirm_flag:
|
||||||
|
@ -3186,7 +3186,7 @@ def cli(_cluster, _debug):
|
||||||
"PVC_CLUSTER": Set the cluster to access instead of using --cluster/-c
|
"PVC_CLUSTER": Set the cluster to access instead of using --cluster/-c
|
||||||
|
|
||||||
If no PVC_CLUSTER/--cluster is specified, attempts first to load the "local" cluster, checking
|
If no PVC_CLUSTER/--cluster is specified, attempts first to load the "local" cluster, checking
|
||||||
for an API configuration in "/etc/pvc/pvc-api.yaml". If this is also not found, abort.
|
for an API configuration in "/etc/pvc/pvcapid.yaml". If this is also not found, abort.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
global config
|
global config
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
api-daemon/pvc-api.py usr/share/pvc
|
api-daemon/pvcapid.py usr/share/pvc
|
||||||
api-daemon/pvc-api.sample.yaml etc/pvc
|
api-daemon/pvcapid.sample.yaml etc/pvc
|
||||||
api-daemon/api_lib usr/share/pvc
|
api-daemon/pvcapid usr/share/pvc
|
||||||
api-daemon/pvc-api.service lib/systemd/system
|
api-daemon/pvcapid.service lib/systemd/system
|
||||||
api-daemon/pvc-provisioner-worker.service lib/systemd/system
|
api-daemon/pvcapid-worker.service lib/systemd/system
|
||||||
api-daemon/provisioner usr/share/pvc
|
api-daemon/provisioner usr/share/pvc
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Install client binary to /usr/bin via symlink
|
# Install client binary to /usr/bin via symlink
|
||||||
ln -s /usr/share/pvc/api.py /usr/bin/pvc-api
|
ln -s /usr/share/pvc/api.py /usr/bin/pvcapid
|
||||||
|
|
||||||
# Reload systemd's view of the units
|
# Reload systemd's view of the units
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
# Restart the main daemon (or warn on first install)
|
# Restart the main daemon (or warn on first install)
|
||||||
if systemctl is-active --quiet pvc-api.service; then
|
if systemctl is-active --quiet pvcapid.service; then
|
||||||
systemctl restart pvc-api.service
|
systemctl restart pvcapid.service
|
||||||
else
|
else
|
||||||
echo "NOTE: The PVC client API daemon (pvc-api.service) has not been started; create a config file at /etc/pvc/pvc-api.yaml then start it."
|
echo "NOTE: The PVC client API daemon (pvcapid.service) has not been started; create a config file at /etc/pvc/pvcapid.yaml then start it."
|
||||||
fi
|
fi
|
||||||
# Restart the worker daemon (or warn on first install)
|
# Restart the worker daemon (or warn on first install)
|
||||||
if systemctl is-active --quiet pvc-provisioner-worker.service; then
|
if systemctl is-active --quiet pvcapid-worker.service; then
|
||||||
systemctl restart pvc-provisioner-worker.service
|
systemctl restart pvcapid-worker.service
|
||||||
else
|
else
|
||||||
echo "NOTE: The PVC provisioner worker daemon (pvc-provisioner-worker.service) has not been started; create a config file at /etc/pvc/pvc-api.yaml then start it."
|
echo "NOTE: The PVC provisioner worker daemon (pvcapid-worker.service) has not been started; create a config file at /etc/pvc/pvcapid.yaml then start it."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Remove client binary symlink
|
# Remove client binary symlink
|
||||||
rm -f /usr/bin/pvc-api
|
rm -f /usr/bin/pvcapid
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
node-daemon/pvcd.py usr/share/pvc
|
node-daemon/pvcnoded.py usr/share/pvc
|
||||||
node-daemon/pvcd.sample.yaml etc/pvc
|
node-daemon/pvcnoded.sample.yaml etc/pvc
|
||||||
node-daemon/pvcd usr/share/pvc
|
node-daemon/pvcnoded usr/share/pvc
|
||||||
node-daemon/pvcd.target lib/systemd/system
|
node-daemon/pvcnoded.target lib/systemd/system
|
||||||
node-daemon/pvcd.service lib/systemd/system
|
node-daemon/pvcnoded.service lib/systemd/system
|
||||||
node-daemon/pvc-flush.service lib/systemd/system
|
node-daemon/pvc-flush.service lib/systemd/system
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
# Enable the service and target
|
# Enable the service and target
|
||||||
systemctl enable /lib/systemd/system/pvcd.service
|
systemctl enable /lib/systemd/system/pvcnoded.service
|
||||||
systemctl enable /lib/systemd/system/pvcd.target
|
systemctl enable /lib/systemd/system/pvc.target
|
||||||
|
|
||||||
# Inform administrator of the autoflush daemon if it is not enabled
|
# Inform administrator of the autoflush daemon if it is not enabled
|
||||||
if ! systemctl is-active --quiet pvc-flush.service; then
|
if ! systemctl is-active --quiet pvc-flush.service; then
|
||||||
|
@ -13,8 +13,8 @@ if ! systemctl is-active --quiet pvc-flush.service; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Inform administrator of the service restart/startup not occurring automatically
|
# Inform administrator of the service restart/startup not occurring automatically
|
||||||
if systemctl is-active --quiet pvcd.service; then
|
if systemctl is-active --quiet pvcnoded.service; then
|
||||||
echo "NOTE: The PVC node daemon (pvcd.service) has not been restarted; this is up to the administrator."
|
echo "NOTE: The PVC node daemon (pvcnoded.service) has not been restarted; this is up to the administrator."
|
||||||
else
|
else
|
||||||
echo "NOTE: The PVC node daemon (pvcd.service) has not been started; create a config file at /etc/pvc/pvcd.yaml then start it."
|
echo "NOTE: The PVC node daemon (pvcnoded.service) has not been started; create a config file at /etc/pvc/pvcnoded.yaml then start it."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Disable the services
|
# Disable the services
|
||||||
systemctl disable pvcd.service
|
systemctl disable pvcnoded.service
|
||||||
systemctl disable pvcd.target
|
systemctl disable pvc.target
|
||||||
|
|
|
@ -50,7 +50,7 @@ The API client uses a dedicated, independent set of functions to perform the act
|
||||||
|
|
||||||
### CLI client
|
### CLI client
|
||||||
|
|
||||||
The CLI client interface is a Click application, which provides a convenient CLI interface to the API client. It supports connecting to multiple clusters, over both HTTP and HTTPS and with authentication, including a special "local" cluster if the client determines that an `/etc/pvc/pvc-api.yaml` configuration exists on the host.
|
The CLI client interface is a Click application, which provides a convenient CLI interface to the API client. It supports connecting to multiple clusters, over both HTTP and HTTPS and with authentication, including a special "local" cluster if the client determines that an `/etc/pvc/pvcapid.yaml` configuration exists on the host.
|
||||||
|
|
||||||
The CLI client is self-documenting using the `-h`/`--help` arguments, though a short manual can be found at the [CLI manual page](/manuals/cli).
|
The CLI client is self-documenting using the `-h`/`--help` arguments, though a short manual can be found at the [CLI manual page](/manuals/cli).
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,15 @@ During startup, the system scans the Zookeeper database and sets up the required
|
||||||
|
|
||||||
## Startup sequence
|
## Startup sequence
|
||||||
|
|
||||||
The daemon startup sequence is documented below. The main daemon entry-point is `Daemon.py` inside the `pvcd` folder, which is called from the `pvcd.py` stub file.
|
The daemon startup sequence is documented below. The main daemon entry-point is `Daemon.py` inside the `pvcnoded` folder, which is called from the `pvcnoded.py` stub file.
|
||||||
|
|
||||||
0. The configuration is read from `/etc/pvc/pvcd.yaml` and the configuration object set up.
|
0. The configuration is read from `/etc/pvc/pvcnoded.yaml` and the configuration object set up.
|
||||||
|
|
||||||
0. Any required filesystem directories, mostly dynamic directories, are created.
|
0. Any required filesystem directories, mostly dynamic directories, are created.
|
||||||
|
|
||||||
0. The logger is set up. If file logging is enabled, this is the state when the first log messages are written.
|
0. The logger is set up. If file logging is enabled, this is the state when the first log messages are written.
|
||||||
|
|
||||||
0. Host networking is configured based on the `pvcd.yaml` configuration file. In a normal cluster, this is the point where the node will become reachable on the network as all networking is handled by the PVC node daemon.
|
0. Host networking is configured based on the `pvcnoded.yaml` configuration file. In a normal cluster, this is the point where the node will become reachable on the network as all networking is handled by the PVC node daemon.
|
||||||
|
|
||||||
0. Sysctl tweaks are applied to the host system, to enable routing/forwarding between nodes via the host.
|
0. Sysctl tweaks are applied to the host system, to enable routing/forwarding between nodes via the host.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ The [`pvc-ansible`](https://github.com/parallelvirtualcluster/pvc-ansible) frame
|
||||||
|
|
||||||
### SSL
|
### SSL
|
||||||
|
|
||||||
The API accepts SSL certificate and key files via the `pvc-api.yaml` configuration to enable SSL support for the API, which protects the data and query values from snooping or tampering. SSL is strongly recommended if using the API outside of a trusted local area network.
|
The API accepts SSL certificate and key files via the `pvcapid.yaml` configuration to enable SSL support for the API, which protects the data and query values from snooping or tampering. SSL is strongly recommended if using the API outside of a trusted local area network.
|
||||||
|
|
||||||
### API authentication
|
### API authentication
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ curl -X GET http://localhost:7370/api/v1/provisioner/status/<task-id>
|
||||||
|
|
||||||
## API Daemon Configuration
|
## API Daemon Configuration
|
||||||
|
|
||||||
The API is configured using a YAML configuration file which is passed in to the API process by the environment variable `PVC_CONFIG_FILE`. When running with the default package and SystemD unit, this file is located at `/etc/pvc/pvc-api.yaml`.
|
The API is configured using a YAML configuration file which is passed in to the API process by the environment variable `PVC_CONFIG_FILE`. When running with the default package and SystemD unit, this file is located at `/etc/pvc/pvcapid.yaml`.
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ The API is configured using a YAML configuration file which is passed in to the
|
||||||
|
|
||||||
* Settings may `depends` on other settings. This indicates that, if one setting is enabled, the other setting is very likely `required` by that setting.
|
* Settings may `depends` on other settings. This indicates that, if one setting is enabled, the other setting is very likely `required` by that setting.
|
||||||
|
|
||||||
### `pvc-api.yaml`
|
### `pvcapid.yaml`
|
||||||
|
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ The PVC CLI client is built with Click, a Python framework for creating self-doc
|
||||||
|
|
||||||
Use the `-h` option at any level of the `pvc` CLI command to receive help about the available commands and options.
|
Use the `-h` option at any level of the `pvc` CLI command to receive help about the available commands and options.
|
||||||
|
|
||||||
Before using the CLI on a non-PVC node system, at least one cluster must be added using the `pvc cluster` subcommands. Running the CLI on hosts which also run the PVC API (via its configuration at `/etc/pvc/pvc-api.yaml`) uses the special `local` cluster, reading information from the API configuration, by default.
|
Before using the CLI on a non-PVC node system, at least one cluster must be added using the `pvc cluster` subcommands. Running the CLI on hosts which also run the PVC API (via its configuration at `/etc/pvc/pvcapid.yaml`) uses the special `local` cluster, reading information from the API configuration, by default.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ The PVC node daemon ins build with Python 3 and is run directly on nodes. For de
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The Daemon is configured using a YAML configuration file which is passed in to the API process by the environment variable `PVCD_CONFIG_FILE`. When running with the default package and SystemD unit, this file is located at `/etc/pvc/pvcd.yaml`.
|
The Daemon is configured using a YAML configuration file which is passed in to the API process by the environment variable `PVCD_CONFIG_FILE`. When running with the default package and SystemD unit, this file is located at `/etc/pvc/pvcnoded.yaml`.
|
||||||
|
|
||||||
For most deployments, the management of the configuration file is handled entirely by the [PVC Ansible framework](/manuals/ansible) and should not be modified directly. Many options from the Ansible framework map directly into the configuration options in this file.
|
For most deployments, the management of the configuration file is handled entirely by the [PVC Ansible framework](/manuals/ansible) and should not be modified directly. Many options from the Ansible framework map directly into the configuration options in this file.
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ For most deployments, the management of the configuration file is handled entire
|
||||||
|
|
||||||
* Settings may `depends` on other settings. This indicates that, if one setting is enabled, the other setting is very likely `required` by that setting.
|
* Settings may `depends` on other settings. This indicates that, if one setting is enabled, the other setting is very likely `required` by that setting.
|
||||||
|
|
||||||
### `pvcd.yaml`
|
### `pvcnoded.yaml`
|
||||||
|
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
os.environ['PVC_CONFIG_FILE'] = "./api-daemon/pvc-api.sample.yaml"
|
os.environ['PVC_CONFIG_FILE'] = "./api-daemon/pvcapid.sample.yaml"
|
||||||
|
|
||||||
sys.path.append('api-daemon')
|
sys.path.append('api-daemon')
|
||||||
|
|
||||||
pvc_api = __import__('pvc-api')
|
pvc_api = __import__('pvcapid')
|
||||||
|
|
||||||
swagger_file = "docs/manuals/swagger.json"
|
swagger_file = "docs/manuals/swagger.json"
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description = Parallel Virtual Cluster autoflush daemon
|
Description = Parallel Virtual Cluster autoflush daemon
|
||||||
After = pvcd.service
|
After = pvcnoded.service
|
||||||
PartOf = pvcd.target
|
PartOf = pvc.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type = oneshot
|
Type = oneshot
|
||||||
|
@ -15,4 +15,4 @@ ExecStop = /usr/bin/pvc -c local node flush --wait
|
||||||
ExecStopPost = /bin/sleep 30
|
ExecStopPost = /bin/sleep 30
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy = pvcd.target
|
WantedBy = pvc.target
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# pvcd.py - Node daemon startup stub
|
# pvcnoded.py - Node daemon startup stub
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -20,4 +20,4 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import pvcd.Daemon
|
import pvcnoded.Daemon
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
# pvcd cluster configuration file example
|
# pvcnoded configuration file example
|
||||||
#
|
#
|
||||||
# This configuration file specifies details for this node in PVC. Multiple node
|
# This configuration file specifies details for this node in PVC. Multiple node
|
||||||
# blocks can be added but only the one matching the current system nodename will
|
# blocks can be added but only the one matching the current system nodename will
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
# this sample configuration are considered defaults and, with adjustment of the
|
# this sample configuration are considered defaults and, with adjustment of the
|
||||||
# nodename section and coordinators list, can be used as-is on a Debian system.
|
# nodename section and coordinators list, can be used as-is on a Debian system.
|
||||||
#
|
#
|
||||||
# Copy this example to /etc/pvc/pvcd.conf and edit to your needs
|
# Copy this example to /etc/pvc/pvcnoded.conf and edit to your needs
|
||||||
|
|
||||||
pvc:
|
pvc:
|
||||||
# node: The (short) hostname of the node, set during provisioning
|
# node: The (short) hostname of the node, set during provisioning
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description = Parallel Virtual Cluster node daemon
|
Description = Parallel Virtual Cluster node daemon
|
||||||
After = network-online.target libvirtd.service zookeeper.service
|
After = network-online.target zookeeper.service
|
||||||
PartOf = pvcd.target
|
PartOf = pvc.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type = simple
|
Type = simple
|
||||||
WorkingDirectory = /usr/share/pvc
|
WorkingDirectory = /usr/share/pvc
|
||||||
Environment = PYTHONUNBUFFERED=true
|
Environment = PYTHONUNBUFFERED=true
|
||||||
Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcd.yaml
|
Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcnoded.yaml
|
||||||
ExecStart = /usr/share/pvc/pvcd.py
|
ExecStart = /usr/share/pvc/pvcnoded.py
|
||||||
Restart = on-failure
|
Restart = on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy = pvcd.target
|
WantedBy = pvc.target
|
|
@ -25,9 +25,9 @@ import ast
|
||||||
import json
|
import json
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
class CephOSDInstance(object):
|
class CephOSDInstance(object):
|
||||||
def __init__(self, zk_conn, this_node, osd_id):
|
def __init__(self, zk_conn, this_node, osd_id):
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# DNSAggregatorInstance.py - Class implementing a DNS aggregator and run by pvcd
|
# DNSAggregatorInstance.py - Class implementing a DNS aggregator and run by pvcnoded
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -28,9 +28,9 @@ import dns.zone
|
||||||
import dns.query
|
import dns.query
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
class DNSAggregatorInstance(object):
|
class DNSAggregatorInstance(object):
|
||||||
# Initialization function
|
# Initialization function
|
|
@ -44,17 +44,17 @@ import apscheduler.schedulers.background
|
||||||
|
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.fencing as fencing
|
import pvcnoded.fencing as fencing
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
import pvcd.VMInstance as VMInstance
|
import pvcnoded.VMInstance as VMInstance
|
||||||
import pvcd.NodeInstance as NodeInstance
|
import pvcnoded.NodeInstance as NodeInstance
|
||||||
import pvcd.VXNetworkInstance as VXNetworkInstance
|
import pvcnoded.VXNetworkInstance as VXNetworkInstance
|
||||||
import pvcd.DNSAggregatorInstance as DNSAggregatorInstance
|
import pvcnoded.DNSAggregatorInstance as DNSAggregatorInstance
|
||||||
import pvcd.CephInstance as CephInstance
|
import pvcnoded.CephInstance as CephInstance
|
||||||
import pvcd.MetadataAPIInstance as MetadataAPIInstance
|
import pvcnoded.MetadataAPIInstance as MetadataAPIInstance
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# PVCD - node daemon startup program
|
# PVCD - node daemon startup program
|
||||||
|
@ -99,9 +99,9 @@ def stopKeepaliveTimer():
|
||||||
|
|
||||||
# Get the config file variable from the environment
|
# Get the config file variable from the environment
|
||||||
try:
|
try:
|
||||||
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
|
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
|
||||||
except:
|
except:
|
||||||
print('ERROR: The "PVCD_CONFIG_FILE" environment variable must be set before starting pvcd.')
|
print('ERROR: The "PVCD_CONFIG_FILE" environment variable must be set before starting pvcnoded.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# Set local hostname and domain variables
|
# Set local hostname and domain variables
|
||||||
|
@ -126,10 +126,10 @@ staticdata.append(subprocess.run(['uname', '-o'], stdout=subprocess.PIPE).stdout
|
||||||
staticdata.append(subprocess.run(['uname', '-m'], stdout=subprocess.PIPE).stdout.decode('ascii').strip())
|
staticdata.append(subprocess.run(['uname', '-m'], stdout=subprocess.PIPE).stdout.decode('ascii').strip())
|
||||||
|
|
||||||
# Read and parse the config file
|
# Read and parse the config file
|
||||||
def readConfig(pvcd_config_file, myhostname):
|
def readConfig(pvcnoded_config_file, myhostname):
|
||||||
print('Loading configuration from file "{}"'.format(pvcd_config_file))
|
print('Loading configuration from file "{}"'.format(pvcnoded_config_file))
|
||||||
|
|
||||||
with open(pvcd_config_file, 'r') as cfgfile:
|
with open(pvcnoded_config_file, 'r') as cfgfile:
|
||||||
try:
|
try:
|
||||||
o_config = yaml.load(cfgfile)
|
o_config = yaml.load(cfgfile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -272,7 +272,7 @@ def readConfig(pvcd_config_file, myhostname):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
# Get the config object from readConfig()
|
# Get the config object from readConfig()
|
||||||
config = readConfig(pvcd_config_file, myhostname)
|
config = readConfig(pvcnoded_config_file, myhostname)
|
||||||
debug = config['debug']
|
debug = config['debug']
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG MODE ENABLED')
|
print('DEBUG MODE ENABLED')
|
||||||
|
@ -335,7 +335,7 @@ logger.out(' CPUs: {}'.format(staticdata[0]))
|
||||||
logger.out(' Arch: {}'.format(staticdata[3]))
|
logger.out(' Arch: {}'.format(staticdata[3]))
|
||||||
logger.out(' OS: {}'.format(staticdata[2]))
|
logger.out(' OS: {}'.format(staticdata[2]))
|
||||||
logger.out(' Kernel: {}'.format(staticdata[1]))
|
logger.out(' Kernel: {}'.format(staticdata[1]))
|
||||||
logger.out('Starting pvcd on host {}'.format(myfqdn), state='s')
|
logger.out('Starting pvcnoded on host {}'.format(myfqdn), state='s')
|
||||||
|
|
||||||
# Define some colours for future messages if applicable
|
# Define some colours for future messages if applicable
|
||||||
if config['log_colours']:
|
if config['log_colours']:
|
||||||
|
@ -421,7 +421,7 @@ if enable_networking:
|
||||||
common.run_os_command('ip route add default via {} dev {}'.format(upstream_gateway, 'brupstream'))
|
common.run_os_command('ip route add default via {} dev {}'.format(upstream_gateway, 'brupstream'))
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# PHASE 2b - Prepare sysctl for pvcd
|
# PHASE 2b - Prepare sysctl for pvcnoded
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
if enable_networking:
|
if enable_networking:
|
||||||
|
@ -553,7 +553,7 @@ def cleanup():
|
||||||
# Set shutdown state in Zookeeper
|
# Set shutdown state in Zookeeper
|
||||||
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'shutdown' })
|
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'shutdown' })
|
||||||
|
|
||||||
logger.out('Terminating pvcd and cleaning up', state='s')
|
logger.out('Terminating pvcnoded and cleaning up', state='s')
|
||||||
|
|
||||||
# Stop keepalive thread
|
# Stop keepalive thread
|
||||||
try:
|
try:
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# NodeInstance.py - Class implementing a PVC node in pvcd
|
# NodeInstance.py - Class implementing a PVC node in pvcnoded
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -28,9 +28,9 @@ import time
|
||||||
import libvirt
|
import libvirt
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
class NodeInstance(object):
|
class NodeInstance(object):
|
||||||
# Initialization function
|
# Initialization function
|
||||||
|
@ -471,9 +471,9 @@ class NodeInstance(object):
|
||||||
# 6. Start client API (and provisioner worker)
|
# 6. Start client API (and provisioner worker)
|
||||||
if self.config['enable_api']:
|
if self.config['enable_api']:
|
||||||
self.logger.out('Starting PVC API client service', state='i')
|
self.logger.out('Starting PVC API client service', state='i')
|
||||||
common.run_os_command("systemctl start pvc-api.service")
|
common.run_os_command("systemctl start pvcapid.service")
|
||||||
self.logger.out('Starting PVC Provisioner Worker service', state='i')
|
self.logger.out('Starting PVC Provisioner Worker service', state='i')
|
||||||
common.run_os_command("systemctl start pvc-provisioner-worker.service")
|
common.run_os_command("systemctl start pvcapid-worker.service")
|
||||||
# 7. Start metadata API; just continue if we fail
|
# 7. Start metadata API; just continue if we fail
|
||||||
self.metadata_api.start()
|
self.metadata_api.start()
|
||||||
# 8. Start DHCP servers
|
# 8. Start DHCP servers
|
||||||
|
@ -525,7 +525,7 @@ class NodeInstance(object):
|
||||||
# 3. Stop client API
|
# 3. Stop client API
|
||||||
if self.config['enable_api']:
|
if self.config['enable_api']:
|
||||||
self.logger.out('Stopping PVC API client service', state='i')
|
self.logger.out('Stopping PVC API client service', state='i')
|
||||||
common.run_os_command("systemctl stop pvc-api.service")
|
common.run_os_command("systemctl stop pvcapid.service")
|
||||||
# 4. Stop metadata API
|
# 4. Stop metadata API
|
||||||
self.metadata_api.stop()
|
self.metadata_api.stop()
|
||||||
time.sleep(0.1) # Time for new writer to acquire the lock
|
time.sleep(0.1) # Time for new writer to acquire the lock
|
|
@ -32,8 +32,8 @@ from collections import deque
|
||||||
import fcntl
|
import fcntl
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
|
|
||||||
class VMConsoleWatcherInstance(object):
|
class VMConsoleWatcherInstance(object):
|
||||||
# Initialization function
|
# Initialization function
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# VMInstance.py - Class implementing a PVC virtual machine in pvcd
|
# VMInstance.py - Class implementing a PVC virtual machine in pvcnoded
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -30,11 +30,11 @@ import libvirt
|
||||||
import kazoo.client
|
import kazoo.client
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
import pvcd.VMConsoleWatcherInstance as VMConsoleWatcherInstance
|
import pvcnoded.VMConsoleWatcherInstance as VMConsoleWatcherInstance
|
||||||
|
|
||||||
def flush_locks(zk_conn, logger, dom_uuid):
|
def flush_locks(zk_conn, logger, dom_uuid):
|
||||||
logger.out('Flushing RBD locks for VM "{}"'.format(dom_uuid), state='i')
|
logger.out('Flushing RBD locks for VM "{}"'.format(dom_uuid), state='i')
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# VXNetworkInstance.py - Class implementing a PVC VM network and run by pvcd
|
# VXNetworkInstance.py - Class implementing a PVC VM network and run by pvcnoded
|
||||||
# Part of the Parallel Virtual Cluster (PVC) system
|
# Part of the Parallel Virtual Cluster (PVC) system
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
|
||||||
|
@ -25,9 +25,9 @@ import sys
|
||||||
import time
|
import time
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
|
|
||||||
class VXNetworkInstance(object):
|
class VXNetworkInstance(object):
|
||||||
# Initialization function
|
# Initialization function
|
||||||
|
@ -637,10 +637,10 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
|
||||||
)
|
)
|
||||||
|
|
||||||
# Recreate the environment we need for dnsmasq
|
# Recreate the environment we need for dnsmasq
|
||||||
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
|
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
|
||||||
dhcp_environment = {
|
dhcp_environment = {
|
||||||
'DNSMASQ_BRIDGE_INTERFACE': self.bridge_nic,
|
'DNSMASQ_BRIDGE_INTERFACE': self.bridge_nic,
|
||||||
'PVCD_CONFIG_FILE': pvcd_config_file
|
'PVCD_CONFIG_FILE': pvcnoded_config_file
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define the dnsmasq config fragments
|
# Define the dnsmasq config fragments
|
||||||
|
@ -658,7 +658,7 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
|
||||||
'--log-dhcp',
|
'--log-dhcp',
|
||||||
'--keep-in-foreground',
|
'--keep-in-foreground',
|
||||||
'--leasefile-ro',
|
'--leasefile-ro',
|
||||||
'--dhcp-script={}/pvcd/dnsmasq-zookeeper-leases.py'.format(os.getcwd()),
|
'--dhcp-script={}/pvcnoded/dnsmasq-zookeeper-leases.py'.format(os.getcwd()),
|
||||||
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
|
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
|
||||||
'--bind-interfaces',
|
'--bind-interfaces',
|
||||||
]
|
]
|
|
@ -27,8 +27,8 @@ import os
|
||||||
import time
|
import time
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcnoded.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
|
|
||||||
class OSDaemon(object):
|
class OSDaemon(object):
|
||||||
def __init__(self, command_string, environment, logfile):
|
def __init__(self, command_string, environment, logfile):
|
|
@ -61,12 +61,12 @@ def get_client_id():
|
||||||
def connect_zookeeper():
|
def connect_zookeeper():
|
||||||
# We expect the environ to contain the config file
|
# We expect the environ to contain the config file
|
||||||
try:
|
try:
|
||||||
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
|
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
|
||||||
except:
|
except:
|
||||||
# Default place
|
# Default place
|
||||||
pvcd_config_file = '/etc/pvc/pvcd.yaml'
|
pvcnoded_config_file = '/etc/pvc/pvcnoded.yaml'
|
||||||
|
|
||||||
with open(pvcd_config_file, 'r') as cfgfile:
|
with open(pvcnoded_config_file, 'r') as cfgfile:
|
||||||
try:
|
try:
|
||||||
o_config = yaml.load(cfgfile)
|
o_config = yaml.load(cfgfile)
|
||||||
except Exception as e:
|
except Exception as e:
|
|
@ -23,9 +23,9 @@
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcnoded.zkhandler as zkhandler
|
||||||
import pvcd.common as common
|
import pvcnoded.common as common
|
||||||
import pvcd.VMInstance as VMInstance
|
import pvcnoded.VMInstance as VMInstance
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fence thread entry function
|
# Fence thread entry function
|
|
@ -23,8 +23,6 @@
|
||||||
import kazoo.client
|
import kazoo.client
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
#import pvcd.log as log
|
|
||||||
|
|
||||||
# Child list function
|
# Child list function
|
||||||
def listchildren(zk_conn, key):
|
def listchildren(zk_conn, key):
|
||||||
children = zk_conn.get_children(key)
|
children = zk_conn.get_children(key)
|
Loading…
Reference in New Issue