Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
adc022f55d | |||
7082982a33 | |||
5b6ef71909 | |||
a8c28786dd | |||
be7b0be8ed | |||
c45804e8c1 | |||
b1fcf6a4a5 |
@ -42,6 +42,11 @@ To get started with PVC, please see the [About](https://parallelvirtualcluster.r
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
#### v0.9.23
|
||||||
|
|
||||||
|
* [Daemons] Fixes a critical overwriting bug in zkhandler when schema paths are not yet valid
|
||||||
|
* [Node Daemon] Ensures the daemon mode is updated on every startup (fixes the side effect of the above bug in 0.9.22)
|
||||||
|
|
||||||
#### v0.9.22
|
#### v0.9.22
|
||||||
|
|
||||||
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
||||||
|
@ -25,7 +25,7 @@ import yaml
|
|||||||
from distutils.util import strtobool as dustrtobool
|
from distutils.util import strtobool as dustrtobool
|
||||||
|
|
||||||
# Daemon version
|
# Daemon version
|
||||||
version = '0.9.22'
|
version = '0.9.23'
|
||||||
|
|
||||||
# API version
|
# API version
|
||||||
API_VERSION = 1.0
|
API_VERSION = 1.0
|
||||||
|
@ -2,7 +2,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pvc',
|
name='pvc',
|
||||||
version='0.9.22',
|
version='0.9.23',
|
||||||
packages=['pvc', 'pvc.cli_lib'],
|
packages=['pvc', 'pvc.cli_lib'],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'Click',
|
'Click',
|
||||||
|
@ -201,6 +201,10 @@ class ZKHandler(object):
|
|||||||
Check if a key exists
|
Check if a key exists
|
||||||
"""
|
"""
|
||||||
path = self.get_schema_path(key)
|
path = self.get_schema_path(key)
|
||||||
|
if path is None:
|
||||||
|
# This path is invalid, this is likely due to missing schema entries, so return False
|
||||||
|
return False
|
||||||
|
|
||||||
stat = self.zk_conn.exists(path)
|
stat = self.zk_conn.exists(path)
|
||||||
if stat:
|
if stat:
|
||||||
return True
|
return True
|
||||||
@ -213,11 +217,13 @@ class ZKHandler(object):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
path = self.get_schema_path(key)
|
path = self.get_schema_path(key)
|
||||||
data = self.zk_conn.get(path)[0].decode(self.encoding)
|
if path is None:
|
||||||
except NoNodeError:
|
# This path is invalid; this is likely due to missing schema entries, so return None
|
||||||
data = None
|
return None
|
||||||
|
|
||||||
return data
|
return self.zk_conn.get(path)[0].decode(self.encoding)
|
||||||
|
except NoNodeError:
|
||||||
|
return None
|
||||||
|
|
||||||
def write(self, kvpairs):
|
def write(self, kvpairs):
|
||||||
"""
|
"""
|
||||||
@ -238,6 +244,9 @@ class ZKHandler(object):
|
|||||||
value = kvpair[1]
|
value = kvpair[1]
|
||||||
|
|
||||||
path = self.get_schema_path(key)
|
path = self.get_schema_path(key)
|
||||||
|
if path is None:
|
||||||
|
# This path is invalid; this is likely due to missing schema entries, so continue
|
||||||
|
continue
|
||||||
|
|
||||||
if not self.exists(key):
|
if not self.exists(key):
|
||||||
# Creating a new key
|
# Creating a new key
|
||||||
@ -276,9 +285,9 @@ class ZKHandler(object):
|
|||||||
keys = [keys]
|
keys = [keys]
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
path = self.get_schema_path(key)
|
|
||||||
if self.exists(key):
|
if self.exists(key):
|
||||||
try:
|
try:
|
||||||
|
path = self.get_schema_path(key)
|
||||||
self.zk_conn.delete(path, recursive=recursive)
|
self.zk_conn.delete(path, recursive=recursive)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log("ZKHandler error: Failed to delete key {}: {}".format(path, e), state='e')
|
self.log("ZKHandler error: Failed to delete key {}: {}".format(path, e), state='e')
|
||||||
@ -292,11 +301,13 @@ class ZKHandler(object):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
path = self.get_schema_path(key)
|
path = self.get_schema_path(key)
|
||||||
children = self.zk_conn.get_children(path)
|
if path is None:
|
||||||
except NoNodeError:
|
# This path is invalid; this is likely due to missing schema entries, so return None
|
||||||
children = None
|
return None
|
||||||
|
|
||||||
return children
|
return self.zk_conn.get_children(path)
|
||||||
|
except NoNodeError:
|
||||||
|
return None
|
||||||
|
|
||||||
def rename(self, kkpairs):
|
def rename(self, kkpairs):
|
||||||
"""
|
"""
|
||||||
@ -327,13 +338,20 @@ class ZKHandler(object):
|
|||||||
|
|
||||||
source_key = kkpair[0]
|
source_key = kkpair[0]
|
||||||
source_path = self.get_schema_path(source_key)
|
source_path = self.get_schema_path(source_key)
|
||||||
|
if source_path is None:
|
||||||
|
# This path is invalid; this is likely due to missing schema entries, so continue
|
||||||
|
continue
|
||||||
|
|
||||||
destination_key = kkpair[1]
|
destination_key = kkpair[1]
|
||||||
destination_path = self.get_schema_path(destination_key)
|
destination_path = self.get_schema_path(destination_key)
|
||||||
|
if destination_path is None:
|
||||||
|
# This path is invalid; this is likely due to missing schema entries, so continue
|
||||||
|
continue
|
||||||
|
|
||||||
if not self.exists(source_key):
|
if not self.exists(source_key):
|
||||||
self.log("ZKHander error: Source key '{}' does not exist".format(source_path), state='e')
|
self.log("ZKHander error: Source key '{}' does not exist".format(source_path), state='e')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.exists(destination_key):
|
if self.exists(destination_key):
|
||||||
self.log("ZKHander error: Destination key '{}' already exists".format(destination_path), state='e')
|
self.log("ZKHander error: Destination key '{}' already exists".format(destination_path), state='e')
|
||||||
return False
|
return False
|
||||||
@ -698,9 +716,16 @@ class ZKSchema(object):
|
|||||||
if base_path is None:
|
if base_path is None:
|
||||||
# This should only really happen for second-layer key types where the helper functions join them together
|
# This should only really happen for second-layer key types where the helper functions join them together
|
||||||
base_path = ''
|
base_path = ''
|
||||||
|
|
||||||
|
if not ipath:
|
||||||
|
# This is a root path
|
||||||
|
return f'{base_path}/{item}'
|
||||||
|
|
||||||
sub_path = self.schema.get(itype).get('.'.join(ipath))
|
sub_path = self.schema.get(itype).get('.'.join(ipath))
|
||||||
if sub_path is None:
|
if sub_path is None:
|
||||||
sub_path = ''
|
# We didn't find the path we're looking for, so we don't want to do anything
|
||||||
|
return None
|
||||||
|
|
||||||
return f'{base_path}/{item}{sub_path}'
|
return f'{base_path}/{item}{sub_path}'
|
||||||
|
|
||||||
# Get keys of a schema location
|
# Get keys of a schema location
|
||||||
|
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -1,3 +1,10 @@
|
|||||||
|
pvc (0.9.23-0) unstable; urgency=high
|
||||||
|
|
||||||
|
* [Daemons] Fixes a critical overwriting bug in zkhandler when schema paths are not yet valid
|
||||||
|
* [Node Daemon] Ensures the daemon mode is updated on every startup (fixes the side effect of the above bug in 0.9.22)
|
||||||
|
|
||||||
|
-- Joshua M. Boniface <joshua@boniface.me> Mon, 05 Jul 2021 23:40:32 -0400
|
||||||
|
|
||||||
pvc (0.9.22-0) unstable; urgency=high
|
pvc (0.9.22-0) unstable; urgency=high
|
||||||
|
|
||||||
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
||||||
|
1
debian/pvc-daemon-api.install
vendored
1
debian/pvc-daemon-api.install
vendored
@ -5,5 +5,6 @@ api-daemon/pvcapid.sample.yaml etc/pvc
|
|||||||
api-daemon/pvcapid usr/share/pvc
|
api-daemon/pvcapid usr/share/pvc
|
||||||
api-daemon/pvcapid.service lib/systemd/system
|
api-daemon/pvcapid.service lib/systemd/system
|
||||||
api-daemon/pvcapid-worker.service lib/systemd/system
|
api-daemon/pvcapid-worker.service lib/systemd/system
|
||||||
|
api-daemon/pvcapid-worker.sh usr/share/pvc
|
||||||
api-daemon/provisioner usr/share/pvc
|
api-daemon/provisioner usr/share/pvc
|
||||||
api-daemon/migrations usr/share/pvc
|
api-daemon/migrations usr/share/pvc
|
||||||
|
@ -42,6 +42,11 @@ To get started with PVC, please see the [About](https://parallelvirtualcluster.r
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
#### v0.9.23
|
||||||
|
|
||||||
|
* [Daemons] Fixes a critical overwriting bug in zkhandler when schema paths are not yet valid
|
||||||
|
* [Node Daemon] Ensures the daemon mode is updated on every startup (fixes the side effect of the above bug in 0.9.22)
|
||||||
|
|
||||||
#### v0.9.22
|
#### v0.9.22
|
||||||
|
|
||||||
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
* [API Daemon] Drastically improves performance when getting large lists (e.g. VMs)
|
||||||
|
@ -55,7 +55,7 @@ import pvcnoded.CephInstance as CephInstance
|
|||||||
import pvcnoded.MetadataAPIInstance as MetadataAPIInstance
|
import pvcnoded.MetadataAPIInstance as MetadataAPIInstance
|
||||||
|
|
||||||
# Version string for startup output
|
# Version string for startup output
|
||||||
version = '0.9.22'
|
version = '0.9.23'
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# PVCD - node daemon startup program
|
# PVCD - node daemon startup program
|
||||||
@ -791,6 +791,7 @@ if zkhandler.exists(('node', myhostname)):
|
|||||||
logger.out("Node is " + fmt_green + "present" + fmt_end + " in Zookeeper", state='i')
|
logger.out("Node is " + fmt_green + "present" + fmt_end + " in Zookeeper", state='i')
|
||||||
# Update static data just in case it's changed
|
# Update static data just in case it's changed
|
||||||
zkhandler.write([
|
zkhandler.write([
|
||||||
|
(('node', myhostname), config['daemon_mode']),
|
||||||
(('node.mode', myhostname), config['daemon_mode']),
|
(('node.mode', myhostname), config['daemon_mode']),
|
||||||
(('node.state.daemon', myhostname), 'init'),
|
(('node.state.daemon', myhostname), 'init'),
|
||||||
(('node.state.router', myhostname), init_routerstate),
|
(('node.state.router', myhostname), init_routerstate),
|
||||||
|
@ -246,7 +246,7 @@ class NodeInstance(object):
|
|||||||
if data != self.domain_list:
|
if data != self.domain_list:
|
||||||
self.domain_list = data
|
self.domain_list = data
|
||||||
|
|
||||||
@self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('node.count.provisioned_domainss', self.name))
|
@self.zkhandler.zk_conn.DataWatch(self.zkhandler.schema.path('node.count.provisioned_domains', self.name))
|
||||||
def watch_node_domainscount(data, stat, event=''):
|
def watch_node_domainscount(data, stat, event=''):
|
||||||
if event and event.type == 'DELETED':
|
if event and event.type == 'DELETED':
|
||||||
# The key has been deleted after existing before; terminate this watcher
|
# The key has been deleted after existing before; terminate this watcher
|
||||||
|
Reference in New Issue
Block a user