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
|
||||
|
||||
#### 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
|
||||
|
||||
* [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
|
||||
|
||||
# Daemon version
|
||||
version = '0.9.22'
|
||||
version = '0.9.23'
|
||||
|
||||
# API version
|
||||
API_VERSION = 1.0
|
||||
|
@ -2,7 +2,7 @@ from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='pvc',
|
||||
version='0.9.22',
|
||||
version='0.9.23',
|
||||
packages=['pvc', 'pvc.cli_lib'],
|
||||
install_requires=[
|
||||
'Click',
|
||||
|
@ -201,6 +201,10 @@ class ZKHandler(object):
|
||||
Check if a key exists
|
||||
"""
|
||||
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)
|
||||
if stat:
|
||||
return True
|
||||
@ -213,11 +217,13 @@ class ZKHandler(object):
|
||||
"""
|
||||
try:
|
||||
path = self.get_schema_path(key)
|
||||
data = self.zk_conn.get(path)[0].decode(self.encoding)
|
||||
except NoNodeError:
|
||||
data = None
|
||||
if path is None:
|
||||
# This path is invalid; this is likely due to missing schema entries, so return None
|
||||
return None
|
||||
|
||||
return data
|
||||
return self.zk_conn.get(path)[0].decode(self.encoding)
|
||||
except NoNodeError:
|
||||
return None
|
||||
|
||||
def write(self, kvpairs):
|
||||
"""
|
||||
@ -238,6 +244,9 @@ class ZKHandler(object):
|
||||
value = kvpair[1]
|
||||
|
||||
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):
|
||||
# Creating a new key
|
||||
@ -276,9 +285,9 @@ class ZKHandler(object):
|
||||
keys = [keys]
|
||||
|
||||
for key in keys:
|
||||
path = self.get_schema_path(key)
|
||||
if self.exists(key):
|
||||
try:
|
||||
path = self.get_schema_path(key)
|
||||
self.zk_conn.delete(path, recursive=recursive)
|
||||
except Exception as e:
|
||||
self.log("ZKHandler error: Failed to delete key {}: {}".format(path, e), state='e')
|
||||
@ -292,11 +301,13 @@ class ZKHandler(object):
|
||||
"""
|
||||
try:
|
||||
path = self.get_schema_path(key)
|
||||
children = self.zk_conn.get_children(path)
|
||||
except NoNodeError:
|
||||
children = None
|
||||
if path is None:
|
||||
# This path is invalid; this is likely due to missing schema entries, so return None
|
||||
return None
|
||||
|
||||
return children
|
||||
return self.zk_conn.get_children(path)
|
||||
except NoNodeError:
|
||||
return None
|
||||
|
||||
def rename(self, kkpairs):
|
||||
"""
|
||||
@ -327,13 +338,20 @@ class ZKHandler(object):
|
||||
|
||||
source_key = kkpair[0]
|
||||
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_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):
|
||||
self.log("ZKHander error: Source key '{}' does not exist".format(source_path), state='e')
|
||||
return False
|
||||
|
||||
if self.exists(destination_key):
|
||||
self.log("ZKHander error: Destination key '{}' already exists".format(destination_path), state='e')
|
||||
return False
|
||||
@ -698,9 +716,16 @@ class ZKSchema(object):
|
||||
if base_path is None:
|
||||
# This should only really happen for second-layer key types where the helper functions join them together
|
||||
base_path = ''
|
||||
|
||||
if not ipath:
|
||||
# This is a root path
|
||||
return f'{base_path}/{item}'
|
||||
|
||||
sub_path = self.schema.get(itype).get('.'.join(ipath))
|
||||
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}'
|
||||
|
||||
# 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
|
||||
|
||||
* [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.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/migrations usr/share/pvc
|
||||
|
@ -42,6 +42,11 @@ To get started with PVC, please see the [About](https://parallelvirtualcluster.r
|
||||
|
||||
## 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
|
||||
|
||||
* [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
|
||||
|
||||
# Version string for startup output
|
||||
version = '0.9.22'
|
||||
version = '0.9.23'
|
||||
|
||||
###############################################################################
|
||||
# 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')
|
||||
# Update static data just in case it's changed
|
||||
zkhandler.write([
|
||||
(('node', myhostname), config['daemon_mode']),
|
||||
(('node.mode', myhostname), config['daemon_mode']),
|
||||
(('node.state.daemon', myhostname), 'init'),
|
||||
(('node.state.router', myhostname), init_routerstate),
|
||||
|
@ -246,7 +246,7 @@ class NodeInstance(object):
|
||||
if data != self.domain_list:
|
||||
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=''):
|
||||
if event and event.type == 'DELETED':
|
||||
# The key has been deleted after existing before; terminate this watcher
|
||||
|
Reference in New Issue
Block a user