Add per-node schema tracking
This will allow nodes to start with their own schema versions, and then be updated simultaneously by the API. References #129
This commit is contained in:
parent
a4aaf89681
commit
3c102b3769
|
@ -1 +1 @@
|
||||||
{"version": "0", "root": "", "base": {"schema": "/schema", "schema.version": "/schema/version", "config": "/config", "config.maintenance": "/config/maintenance", "config.primary_node": "/config/primary_node", "config.upstream_ip": "/config/upstream_ip", "config.migration_target_selector": "/config/migration_target_selector", "lock": "/locks", "lock.primary_node": "/locks/primary_node", "lock.flush_lock": "/locks/flush_lock", "lock.domain_migrate": "/locks/domain_migrate", "cmd": "/cmd", "cmd.nodes": "/cmd/nodes", "cmd.domains": "/cmd/domains", "cmd.ceph": "/cmd/ceph", "node": "/nodes", "domain": "/domains", "network": "/networks", "storage": "/ceph", "storage.util": "/ceph/util", "osd": "/ceph/osds", "pool": "/ceph/pools", "volume": "/ceph/volumes", "snapshot": "/ceph/snapshots"}, "node": {"keepalive": "/keepalive", "mode": "/daemonmode", "data.static": "/staticdata", "counts.provisioned_domains": "/domainscount", "counts.running_domains": "/runningdomains", "counts.networks": "/networkscount", "state.daemon": "/daemonstate", "state.router": "/routerstate", "state.domain": "/domainstate", "vcpu.allocated": "/vcpualloc", "memory.total": "/memtotal", "memory.used": "/memused", "memory.free": "/memfree", "memory.allocated": "/memalloc", "memory.provisioned": "/memprov", "ipmi.hostname": "/ipmihostname", "ipmi.username": "/ipmiusername", "ipmi.password": "/ipmipassword"}, "domain": {"name": "", "xml": "/xml", "state": "/state", "profile": "/profile", "stats": "/stats", "node": "/node", "last_node": "/lastnode", "failed_reason": "/failedreason", "console.log": "/consolelog", "console.vnc": "/vnc", "meta.autostart": "/node_autostart", "meta.migrate_method": "/migration_method", "meta.node_selector": "/node_selector", "meta.node_limit": "/node_limit"}, "network": {"type": "/nettype", "rules": "/firewall_rules", "nameservers": "/name_servers", "domain": "/domain", "ip4.gateway": "/ip4_gateway", "ip4.network": "/ip4_network", "ip4.dhcp": "/dhcp4_flag", "ip4.reservations": "/dhcp4_reservations", "ip4.dhcp_start": "/dhcp4_start", "ip4.dhcp_end": "/dhcp4_end", "ip6.gateway": "/ip6_gateway", "ip6.network": "/ip6_network", "ip6.dhcp": "/dhcp6_flag"}, "osd": {"node": "/node", "device": "/device", "stats": "/stats"}, "pool": {"pgs": "/pgs", "stats": "/stats"}, "volume": {"stats": "/stats"}, "snapshot": {"stats": "/stats"}}
|
{"version": "0", "root": "", "base": {"schema": "/schema", "schema.version": "/schema/version", "config": "/config", "config.maintenance": "/config/maintenance", "config.primary_node": "/config/primary_node", "config.upstream_ip": "/config/upstream_ip", "config.migration_target_selector": "/config/migration_target_selector", "lock": "/locks", "lock.primary_node": "/locks/primary_node", "lock.flush_lock": "/locks/flush_lock", "lock.domain_migrate": "/locks/domain_migrate", "cmd": "/cmd", "cmd.nodes": "/cmd/nodes", "cmd.domains": "/cmd/domains", "cmd.ceph": "/cmd/ceph", "node": "/nodes", "domain": "/domains", "network": "/networks", "storage": "/ceph", "storage.util": "/ceph/util", "osd": "/ceph/osds", "pool": "/ceph/pools", "volume": "/ceph/volumes", "snapshot": "/ceph/snapshots"}, "node": {"keepalive": "/keepalive", "mode": "/daemonmode", "data.active_schema": "/activeschema", "data.static": "/staticdata", "counts.provisioned_domains": "/domainscount", "counts.running_domains": "/runningdomains", "counts.networks": "/networkscount", "state.daemon": "/daemonstate", "state.router": "/routerstate", "state.domain": "/domainstate", "vcpu.allocated": "/vcpualloc", "memory.total": "/memtotal", "memory.used": "/memused", "memory.free": "/memfree", "memory.allocated": "/memalloc", "memory.provisioned": "/memprov", "ipmi.hostname": "/ipmihostname", "ipmi.username": "/ipmiusername", "ipmi.password": "/ipmipassword"}, "domain": {"name": "", "xml": "/xml", "state": "/state", "profile": "/profile", "stats": "/stats", "node": "/node", "last_node": "/lastnode", "failed_reason": "/failedreason", "console.log": "/consolelog", "console.vnc": "/vnc", "meta.autostart": "/node_autostart", "meta.migrate_method": "/migration_method", "meta.node_selector": "/node_selector", "meta.node_limit": "/node_limit"}, "network": {"type": "/nettype", "rules": "/firewall_rules", "nameservers": "/name_servers", "domain": "/domain", "ip4.gateway": "/ip4_gateway", "ip4.network": "/ip4_network", "ip4.dhcp": "/dhcp4_flag", "ip4.reservations": "/dhcp4_reservations", "ip4.dhcp_start": "/dhcp4_start", "ip4.dhcp_end": "/dhcp4_end", "ip6.gateway": "/ip6_gateway", "ip6.network": "/ip6_network", "ip6.dhcp": "/dhcp6_flag"}, "osd": {"node": "/node", "device": "/device", "stats": "/stats"}, "pool": {"pgs": "/pgs", "stats": "/stats"}, "volume": {"stats": "/stats"}, "snapshot": {"stats": "/stats"}}
|
|
@ -401,6 +401,7 @@ class ZKSchema(object):
|
||||||
'node': {
|
'node': {
|
||||||
'keepalive': '/keepalive',
|
'keepalive': '/keepalive',
|
||||||
'mode': '/daemonmode',
|
'mode': '/daemonmode',
|
||||||
|
'data.active_schema': '/activeschema',
|
||||||
'data.static': '/staticdata',
|
'data.static': '/staticdata',
|
||||||
'counts.provisioned_domains': '/domainscount',
|
'counts.provisioned_domains': '/domainscount',
|
||||||
'counts.running_domains': '/runningdomains',
|
'counts.running_domains': '/runningdomains',
|
||||||
|
|
|
@ -532,7 +532,17 @@ except Exception as e:
|
||||||
logger.out('Validating Zookeeper schema', state='i')
|
logger.out('Validating Zookeeper schema', state='i')
|
||||||
|
|
||||||
# Instantiate a zkschema instance with our current schema version
|
# Instantiate a zkschema instance with our current schema version
|
||||||
zkschema = ZKSchema.load_current(zkhandler)
|
zkschema = ZKSchema()
|
||||||
|
|
||||||
|
try:
|
||||||
|
node_schema_version = int(zkhandler.read(zkschema.path('node.data.active_schema', myhostname)))
|
||||||
|
except Exception:
|
||||||
|
node_schema_version = zkhandler.read(zkschema.path('base.schema.version'))
|
||||||
|
zkhandler.write([
|
||||||
|
(zkschema.path('node.data.active_schema', myhostname), node_schema_version)
|
||||||
|
])
|
||||||
|
|
||||||
|
zkschema.load(node_schema_version)
|
||||||
|
|
||||||
# Validate our schema against that version
|
# Validate our schema against that version
|
||||||
if not zkschema.validate(zkhandler, logger):
|
if not zkschema.validate(zkhandler, logger):
|
||||||
|
@ -549,7 +559,7 @@ else:
|
||||||
|
|
||||||
# Cleanup function
|
# Cleanup function
|
||||||
def cleanup():
|
def cleanup():
|
||||||
global zkhandler, update_timer, d_domain
|
global zkhandler, zkschema, update_timer, d_domain
|
||||||
|
|
||||||
logger.out('Terminating pvcnoded and cleaning up', state='s')
|
logger.out('Terminating pvcnoded and cleaning up', state='s')
|
||||||
|
|
||||||
|
@ -607,6 +617,7 @@ def cleanup():
|
||||||
|
|
||||||
# Close the Zookeeper connection
|
# Close the Zookeeper connection
|
||||||
try:
|
try:
|
||||||
|
del zkschema
|
||||||
zkhandler.disconnect()
|
zkhandler.disconnect()
|
||||||
del zkhandler
|
del zkhandler
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in New Issue