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:
2020-02-08 19:16:19 -05:00
parent 83704d8677
commit ce985234c3
43 changed files with 158 additions and 159 deletions

View File

@ -2,8 +2,8 @@
[Unit]
Description = Parallel Virtual Cluster autoflush daemon
After = pvcd.service
PartOf = pvcd.target
After = pvcnoded.service
PartOf = pvc.target
[Service]
Type = oneshot
@ -15,4 +15,4 @@ ExecStop = /usr/bin/pvc -c local node flush --wait
ExecStopPost = /bin/sleep 30
[Install]
WantedBy = pvcd.target
WantedBy = pvc.target

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# pvcd.py - Node daemon startup stub
# pvcnoded.py - Node daemon startup stub
# Part of the Parallel Virtual Cluster (PVC) system
#
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
@ -20,4 +20,4 @@
#
###############################################################################
import pvcd.Daemon
import pvcnoded.Daemon

View File

@ -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
# 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
# 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:
# node: The (short) hostname of the node, set during provisioning

View File

@ -2,16 +2,16 @@
[Unit]
Description = Parallel Virtual Cluster node daemon
After = network-online.target libvirtd.service zookeeper.service
PartOf = pvcd.target
After = network-online.target zookeeper.service
PartOf = pvc.target
[Service]
Type = simple
WorkingDirectory = /usr/share/pvc
Environment = PYTHONUNBUFFERED=true
Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcd.yaml
ExecStart = /usr/share/pvc/pvcd.py
Environment = PVCD_CONFIG_FILE=/etc/pvc/pvcnoded.yaml
ExecStart = /usr/share/pvc/pvcnoded.py
Restart = on-failure
[Install]
WantedBy = pvcd.target
WantedBy = pvc.target

View File

@ -25,9 +25,9 @@ import ast
import json
import psutil
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
class CephOSDInstance(object):
def __init__(self, zk_conn, this_node, osd_id):

View File

@ -1,6 +1,6 @@
#!/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
#
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
@ -28,9 +28,9 @@ import dns.zone
import dns.query
import psycopg2
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
class DNSAggregatorInstance(object):
# Initialization function

View File

@ -44,17 +44,17 @@ import apscheduler.schedulers.background
from distutils.util import strtobool
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.fencing as fencing
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.fencing as fencing
import pvcnoded.common as common
import pvcd.VMInstance as VMInstance
import pvcd.NodeInstance as NodeInstance
import pvcd.VXNetworkInstance as VXNetworkInstance
import pvcd.DNSAggregatorInstance as DNSAggregatorInstance
import pvcd.CephInstance as CephInstance
import pvcd.MetadataAPIInstance as MetadataAPIInstance
import pvcnoded.VMInstance as VMInstance
import pvcnoded.NodeInstance as NodeInstance
import pvcnoded.VXNetworkInstance as VXNetworkInstance
import pvcnoded.DNSAggregatorInstance as DNSAggregatorInstance
import pvcnoded.CephInstance as CephInstance
import pvcnoded.MetadataAPIInstance as MetadataAPIInstance
###############################################################################
# PVCD - node daemon startup program
@ -99,9 +99,9 @@ def stopKeepaliveTimer():
# Get the config file variable from the environment
try:
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
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)
# 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())
# Read and parse the config file
def readConfig(pvcd_config_file, myhostname):
print('Loading configuration from file "{}"'.format(pvcd_config_file))
def readConfig(pvcnoded_config_file, myhostname):
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:
o_config = yaml.load(cfgfile)
except Exception as e:
@ -272,7 +272,7 @@ def readConfig(pvcd_config_file, myhostname):
return config
# Get the config object from readConfig()
config = readConfig(pvcd_config_file, myhostname)
config = readConfig(pvcnoded_config_file, myhostname)
debug = config['debug']
if debug:
print('DEBUG MODE ENABLED')
@ -335,7 +335,7 @@ logger.out(' CPUs: {}'.format(staticdata[0]))
logger.out(' Arch: {}'.format(staticdata[3]))
logger.out(' OS: {}'.format(staticdata[2]))
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
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'))
###############################################################################
# PHASE 2b - Prepare sysctl for pvcd
# PHASE 2b - Prepare sysctl for pvcnoded
###############################################################################
if enable_networking:
@ -553,7 +553,7 @@ def cleanup():
# Set shutdown state in Zookeeper
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
try:

View File

@ -1,6 +1,6 @@
#!/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
#
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
@ -28,9 +28,9 @@ import time
import libvirt
import threading
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
class NodeInstance(object):
# Initialization function
@ -471,9 +471,9 @@ class NodeInstance(object):
# 6. Start client API (and provisioner worker)
if self.config['enable_api']:
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')
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
self.metadata_api.start()
# 8. Start DHCP servers
@ -525,7 +525,7 @@ class NodeInstance(object):
# 3. Stop client API
if self.config['enable_api']:
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
self.metadata_api.stop()
time.sleep(0.1) # Time for new writer to acquire the lock

View File

@ -32,8 +32,8 @@ from collections import deque
import fcntl
import signal
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
class VMConsoleWatcherInstance(object):
# Initialization function

View File

@ -1,6 +1,6 @@
#!/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
#
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
@ -30,11 +30,11 @@ import libvirt
import kazoo.client
import json
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
import pvcd.VMConsoleWatcherInstance as VMConsoleWatcherInstance
import pvcnoded.VMConsoleWatcherInstance as VMConsoleWatcherInstance
def flush_locks(zk_conn, logger, dom_uuid):
logger.out('Flushing RBD locks for VM "{}"'.format(dom_uuid), state='i')

View File

@ -1,6 +1,6 @@
#!/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
#
# Copyright (C) 2018-2020 Joshua M. Boniface <joshua@boniface.me>
@ -25,9 +25,9 @@ import sys
import time
from textwrap import dedent
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
class VXNetworkInstance(object):
# 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
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
dhcp_environment = {
'DNSMASQ_BRIDGE_INTERFACE': self.bridge_nic,
'PVCD_CONFIG_FILE': pvcd_config_file
'PVCD_CONFIG_FILE': pvcnoded_config_file
}
# Define the dnsmasq config fragments
@ -658,7 +658,7 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
'--log-dhcp',
'--keep-in-foreground',
'--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),
'--bind-interfaces',
]

View File

@ -27,8 +27,8 @@ import os
import time
import shlex
import pvcd.log as log
import pvcd.zkhandler as zkhandler
import pvcnoded.log as log
import pvcnoded.zkhandler as zkhandler
class OSDaemon(object):
def __init__(self, command_string, environment, logfile):

View File

@ -61,12 +61,12 @@ def get_client_id():
def connect_zookeeper():
# We expect the environ to contain the config file
try:
pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
pvcnoded_config_file = os.environ['PVCD_CONFIG_FILE']
except:
# 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:
o_config = yaml.load(cfgfile)
except Exception as e:

View File

@ -23,9 +23,9 @@
import time
import threading
import pvcd.zkhandler as zkhandler
import pvcd.common as common
import pvcd.VMInstance as VMInstance
import pvcnoded.zkhandler as zkhandler
import pvcnoded.common as common
import pvcnoded.VMInstance as VMInstance
#
# Fence thread entry function

View File

@ -23,8 +23,6 @@
import kazoo.client
import uuid
#import pvcd.log as log
# Child list function
def listchildren(zk_conn, key):
children = zk_conn.get_children(key)