Add API management to node daemon
This commit is contained in:
parent
22ae087836
commit
b854d53fab
|
@ -25,6 +25,8 @@ pvc:
|
||||||
enable_storage: True
|
enable_storage: True
|
||||||
# enable_api: Enable or disable the API client, if installed, when node is Primary
|
# enable_api: Enable or disable the API client, if installed, when node is Primary
|
||||||
enable_api: True
|
enable_api: True
|
||||||
|
# enable_provisioner: Enable or disable the Provisioner client, if installed, when node is Primary
|
||||||
|
enable_provisioner: True
|
||||||
# cluster: Cluster-level configuration
|
# cluster: Cluster-level configuration
|
||||||
cluster:
|
cluster:
|
||||||
# coordinators: The list of cluster coordinator hostnames
|
# coordinators: The list of cluster coordinator hostnames
|
||||||
|
|
|
@ -138,6 +138,7 @@ def readConfig(pvcd_config_file, myhostname):
|
||||||
'enable_networking': o_config['pvc']['functions']['enable_networking'],
|
'enable_networking': o_config['pvc']['functions']['enable_networking'],
|
||||||
'enable_storage': o_config['pvc']['functions']['enable_storage'],
|
'enable_storage': o_config['pvc']['functions']['enable_storage'],
|
||||||
'enable_api': o_config['pvc']['functions']['enable_api'],
|
'enable_api': o_config['pvc']['functions']['enable_api'],
|
||||||
|
'enable_provisioner': o_config['pvc']['functions']['enable_provisioner'],
|
||||||
'dynamic_directory': o_config['pvc']['system']['configuration']['directories']['dynamic_directory'],
|
'dynamic_directory': o_config['pvc']['system']['configuration']['directories']['dynamic_directory'],
|
||||||
'log_directory': o_config['pvc']['system']['configuration']['directories']['log_directory'],
|
'log_directory': o_config['pvc']['system']['configuration']['directories']['log_directory'],
|
||||||
'console_log_directory': o_config['pvc']['system']['configuration']['directories']['console_log_directory'],
|
'console_log_directory': o_config['pvc']['system']['configuration']['directories']['console_log_directory'],
|
||||||
|
|
|
@ -266,6 +266,10 @@ class NodeInstance(object):
|
||||||
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 pvc-api.service")
|
||||||
|
if self.config['enable_provisioner']:
|
||||||
|
self.logger.out('Stopping PVC Provisioner service', state='i')
|
||||||
|
common.run_os_command("systemctl stop pvc-provisioner.service")
|
||||||
|
common.run_os_command("systemctl stop pvc-provisioner-worker.service")
|
||||||
for network in self.d_network:
|
for network in self.d_network:
|
||||||
self.d_network[network].stopDHCPServer()
|
self.d_network[network].stopDHCPServer()
|
||||||
self.d_network[network].removeGateways()
|
self.d_network[network].removeGateways()
|
||||||
|
@ -287,6 +291,10 @@ class NodeInstance(object):
|
||||||
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 pvc-api.service")
|
||||||
|
if self.config['enable_provisioner']:
|
||||||
|
self.logger.out('Starting PVC Provisioner service', state='i')
|
||||||
|
common.run_os_command("systemctl start pvc-provisioner-worker.service")
|
||||||
|
common.run_os_command("systemctl start pvc-provisioner.service")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# Switch Patroni leader to the local instance
|
# Switch Patroni leader to the local instance
|
||||||
|
|
Loading…
Reference in New Issue