Add node PVC version data to Node information

Allows API client to see the currently-active version of the node
daemon.
This commit is contained in:
Joshua Boniface 2021-07-05 09:57:38 -04:00
parent 21a1a7da9e
commit a69105569f
6 changed files with 15 additions and 1 deletions

View File

@ -535,6 +535,9 @@ class API_Node_Root(Resource):
domain_state: domain_state:
type: string type: string
description: The current domain (VM) state description: The current domain (VM) state
pvc_version:
type: string
description: The current running PVC node daemon version
cpu_count: cpu_count:
type: integer type: integer
description: The number of available CPU cores description: The number of available CPU cores

View File

@ -0,0 +1 @@
{"version": "2", "root": "", "base": {"root": "", "schema": "/schema", "schema.version": "/schema/version", "config": "/config", "config.maintenance": "/config/maintenance", "config.primary_node": "/config/primary_node", "config.primary_node.sync_lock": "/config/primary_node/sync_lock", "config.upstream_ip": "/config/upstream_ip", "config.migration_target_selector": "/config/migration_target_selector", "cmd": "/cmd", "cmd.node": "/cmd/nodes", "cmd.domain": "/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": {"name": "", "keepalive": "/keepalive", "mode": "/daemonmode", "data.active_schema": "/activeschema", "data.latest_schema": "/latestschema", "data.static": "/staticdata", "data.pvc_version": "/pvcversion", "running_domains": "/runningdomains", "count.provisioned_domains": "/domainscount", "count.networks": "/networkscount", "state.daemon": "/daemonstate", "state.router": "/routerstate", "state.domain": "/domainstate", "cpu.load": "/cpuload", "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", "sriov": "/sriov", "sriov.pf": "/sriov/pf", "sriov.vf": "/sriov/vf"}, "sriov_pf": {"phy": "", "mtu": "/mtu", "vfcount": "/vfcount"}, "sriov_vf": {"phy": "", "pf": "/pf", "mtu": "/mtu", "mac": "/mac", "phy_mac": "/phy_mac", "config": "/config", "config.vlan_id": "/config/vlan_id", "config.vlan_qos": "/config/vlan_qos", "config.tx_rate_min": "/config/tx_rate_min", "config.tx_rate_max": "/config/tx_rate_max", "config.spoof_check": "/config/spoof_check", "config.link_state": "/config/link_state", "config.trust": "/config/trust", "config.query_rss": "/config/query_rss", "pci": "/pci", "pci.domain": "/pci/domain", "pci.bus": "/pci/bus", "pci.slot": "/pci/slot", "pci.function": "/pci/function", "used": "/used", "used_by": "/used_by"}, "domain": {"name": "", "xml": "/xml", "state": "/state", "profile": "/profile", "stats": "/stats", "node": "/node", "last_node": "/lastnode", "failed_reason": "/failedreason", "storage.volumes": "/rbdlist", "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", "migrate.sync_lock": "/migrate_sync_lock"}, "network": {"vni": "", "type": "/nettype", "rule": "/firewall_rules", "rule.in": "/firewall_rules/in", "rule.out": "/firewall_rules/out", "nameservers": "/name_servers", "domain": "/domain", "reservation": "/dhcp4_reservations", "lease": "/dhcp4_leases", "ip4.gateway": "/ip4_gateway", "ip4.network": "/ip4_network", "ip4.dhcp": "/dhcp4_flag", "ip4.dhcp_start": "/dhcp4_start", "ip4.dhcp_end": "/dhcp4_end", "ip6.gateway": "/ip6_gateway", "ip6.network": "/ip6_network", "ip6.dhcp": "/dhcp6_flag"}, "reservation": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname"}, "lease": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname", "expiry": "/expiry", "client_id": "/clientid"}, "rule": {"description": "", "rule": "/rule", "order": "/order"}, "osd": {"id": "", "node": "/node", "device": "/device", "stats": "/stats"}, "pool": {"name": "", "pgs": "/pgs", "stats": "/stats"}, "volume": {"name": "", "stats": "/stats"}, "snapshot": {"name": "", "stats": "/stats"}}

View File

@ -33,6 +33,7 @@ def getNodeInformation(zkhandler, node_name):
node_coordinator_state = zkhandler.read(('node.state.router', node_name)) node_coordinator_state = zkhandler.read(('node.state.router', node_name))
node_domain_state = zkhandler.read(('node.state.domain', node_name)) node_domain_state = zkhandler.read(('node.state.domain', node_name))
node_static_data = zkhandler.read(('node.data.static', node_name)).split() node_static_data = zkhandler.read(('node.data.static', node_name)).split()
node_pvc_version = zkhandler.read(('node.data.pvc_version', node_name))
node_cpu_count = int(node_static_data[0]) node_cpu_count = int(node_static_data[0])
node_kernel = node_static_data[1] node_kernel = node_static_data[1]
node_os = node_static_data[2] node_os = node_static_data[2]
@ -53,6 +54,7 @@ def getNodeInformation(zkhandler, node_name):
'daemon_state': node_daemon_state, 'daemon_state': node_daemon_state,
'coordinator_state': node_coordinator_state, 'coordinator_state': node_coordinator_state,
'domain_state': node_domain_state, 'domain_state': node_domain_state,
'pvc_version': node_pvc_version,
'cpu_count': node_cpu_count, 'cpu_count': node_cpu_count,
'kernel': node_kernel, 'kernel': node_kernel,
'os': node_os, 'os': node_os,

View File

@ -440,7 +440,7 @@ class ZKHandler(object):
# #
class ZKSchema(object): class ZKSchema(object):
# Current version # Current version
_version = 1 _version = 2
# Root for doing nested keys # Root for doing nested keys
_schema_root = '' _schema_root = ''
@ -482,6 +482,7 @@ class ZKSchema(object):
'data.active_schema': '/activeschema', 'data.active_schema': '/activeschema',
'data.latest_schema': '/latestschema', 'data.latest_schema': '/latestschema',
'data.static': '/staticdata', 'data.static': '/staticdata',
'data.pvc_version': '/pvcversion',
'running_domains': '/runningdomains', 'running_domains': '/runningdomains',
'count.provisioned_domains': '/domainscount', 'count.provisioned_domains': '/domainscount',
'count.networks': '/networkscount', 'count.networks': '/networkscount',

View File

@ -464,6 +464,10 @@
"description": "The current operating system type", "description": "The current operating system type",
"type": "string" "type": "string"
}, },
"pvc_version": {
"description": "The current running PVC node daemon version",
"type": "string"
},
"running_domains": { "running_domains": {
"description": "The list of running domains (VMs) by UUID", "description": "The list of running domains (VMs) by UUID",
"type": "string" "type": "string"

View File

@ -786,6 +786,7 @@ if config['daemon_mode'] == 'coordinator':
init_routerstate = 'secondary' init_routerstate = 'secondary'
else: else:
init_routerstate = 'client' init_routerstate = 'client'
if zkhandler.exists(('node', myhostname)): 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
@ -794,6 +795,7 @@ if zkhandler.exists(('node', myhostname)):
(('node.state.daemon', myhostname), 'init'), (('node.state.daemon', myhostname), 'init'),
(('node.state.router', myhostname), init_routerstate), (('node.state.router', myhostname), init_routerstate),
(('node.data.static', myhostname), ' '.join(staticdata)), (('node.data.static', myhostname), ' '.join(staticdata)),
(('node.data.pvc_version', myhostname), version),
(('node.ipmi.hostname', myhostname), config['ipmi_hostname']), (('node.ipmi.hostname', myhostname), config['ipmi_hostname']),
(('node.ipmi.username', myhostname), config['ipmi_username']), (('node.ipmi.username', myhostname), config['ipmi_username']),
(('node.ipmi.password', myhostname), config['ipmi_password']), (('node.ipmi.password', myhostname), config['ipmi_password']),
@ -809,6 +811,7 @@ else:
(('node.state.domain', myhostname), 'flushed'), (('node.state.domain', myhostname), 'flushed'),
(('node.state.router', myhostname), init_routerstate), (('node.state.router', myhostname), init_routerstate),
(('node.data.static', myhostname), ' '.join(staticdata)), (('node.data.static', myhostname), ' '.join(staticdata)),
(('node.data.pvc_version', myhostname), version),
(('node.ipmi.hostname', myhostname), config['ipmi_hostname']), (('node.ipmi.hostname', myhostname), config['ipmi_hostname']),
(('node.ipmi.username', myhostname), config['ipmi_username']), (('node.ipmi.username', myhostname), config['ipmi_username']),
(('node.ipmi.password', myhostname), config['ipmi_password']), (('node.ipmi.password', myhostname), config['ipmi_password']),