[GH-ISSUE #21] no ['master_node'] value - script error #15

Open
opened 2026-02-26 17:46:07 +03:00 by kerem · 4 comments
Owner

Originally created by @Tradeforlife on GitHub (Mar 1, 2024).
Original GitHub issue: https://github.com/cvk98/Proxmox-load-balancer/issues/21

As of 1/03/2024 Proxmox hosts fully patched using a ubuntu 23.x LXC within a python env and the current build of Proxmox-load-balancer of 1/03/2024. when I run the program after updating the config file with correct info I get.

(.env) root@prox-lb:/opt/Proxmox-load-balancer# python plb.py 
INFO | START ***Load-balancer!***
Traceback (most recent call last):
  File "/opt/Proxmox-load-balancer/plb.py", line 496, in <module>
    main()
  File "/opt/Proxmox-load-balancer/plb.py", line 466, in main
    cluster = Cluster(server_url)
              ^^^^^^^^^^^^^^^^^^^
  File "/opt/Proxmox-load-balancer/plb.py", line 96, in __init__
    self.cl_nodes: dict = self.cluster_hosts()  # All cluster nodes
                          ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Proxmox-load-balancer/plb.py", line 169, in cluster_hosts
    self.master_node = rr.json()['data']['manager_status']['master_node']
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'master_node'

I edit the plb.py to show the output of the rr.json() within the cluster_hosts(self) function and it showed the below output. there is no master_node key. I'm not sure if it's not required anymore of I have something changed in my cluster.. either way it's not working.

{'data': {'manager_status': {'node_status': {}}, 'quorum': {'quorate': '1', 'node': 'pve-quorum'}}}

Cluster Information

root@pve-quorum:~# pvecm status
Cluster information
-------------------
Name:             cluster1
Config Version:   12
Transport:        knet
Secure auth:      on

Quorum information
------------------
Date:             Fri Mar  1 13:31:53 2024
Quorum provider:  corosync_votequorum
Nodes:            4
Node ID:          0x00000002
Ring ID:          1.848
Quorate:          Yes

Votequorum information
----------------------
Expected votes:   4
Highest expected: 4
Total votes:      4
Quorum:           3  
Flags:            Quorate 

Membership information
----------------------
    Nodeid      Votes    Qdevice Name
0x00000001          1  NA,NV,NMW 192.168.10.11
0x00000002          1         NR 192.168.10.30 (local)
0x00000003          1         NR 192.168.10.10
0x00000004          1         NR 192.168.10.12
0x00000000          0            Qdevice (votes 0)
root@pve-quorum:~# 
Originally created by @Tradeforlife on GitHub (Mar 1, 2024). Original GitHub issue: https://github.com/cvk98/Proxmox-load-balancer/issues/21 As of 1/03/2024 Proxmox hosts fully patched using a ubuntu 23.x LXC within a python env and the current build of Proxmox-load-balancer of 1/03/2024. when I run the program after updating the config file with correct info I get. ``` (.env) root@prox-lb:/opt/Proxmox-load-balancer# python plb.py INFO | START ***Load-balancer!*** Traceback (most recent call last): File "/opt/Proxmox-load-balancer/plb.py", line 496, in <module> main() File "/opt/Proxmox-load-balancer/plb.py", line 466, in main cluster = Cluster(server_url) ^^^^^^^^^^^^^^^^^^^ File "/opt/Proxmox-load-balancer/plb.py", line 96, in __init__ self.cl_nodes: dict = self.cluster_hosts() # All cluster nodes ^^^^^^^^^^^^^^^^^^^^ File "/opt/Proxmox-load-balancer/plb.py", line 169, in cluster_hosts self.master_node = rr.json()['data']['manager_status']['master_node'] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ KeyError: 'master_node' ``` I edit the plb.py to show the output of the rr.json() within the cluster_hosts(self) function and it showed the below output. there is no master_node key. I'm not sure if it's not required anymore of I have something changed in my cluster.. either way it's not working. ``` {'data': {'manager_status': {'node_status': {}}, 'quorum': {'quorate': '1', 'node': 'pve-quorum'}}} ``` Cluster Information ``` root@pve-quorum:~# pvecm status Cluster information ------------------- Name: cluster1 Config Version: 12 Transport: knet Secure auth: on Quorum information ------------------ Date: Fri Mar 1 13:31:53 2024 Quorum provider: corosync_votequorum Nodes: 4 Node ID: 0x00000002 Ring ID: 1.848 Quorate: Yes Votequorum information ---------------------- Expected votes: 4 Highest expected: 4 Total votes: 4 Quorum: 3 Flags: Quorate Membership information ---------------------- Nodeid Votes Qdevice Name 0x00000001 1 NA,NV,NMW 192.168.10.11 0x00000002 1 NR 192.168.10.30 (local) 0x00000003 1 NR 192.168.10.10 0x00000004 1 NR 192.168.10.12 0x00000000 0 Qdevice (votes 0) root@pve-quorum:~# ```
Author
Owner

@Tradeforlife commented on GitHub (Mar 1, 2024):

NOTE : I just commented out

self.master_node = rr.json()['data']['manager_status']['master_node']

any it seems to be running, not sure if this is required anywhere else.

<!-- gh-comment-id:1972359774 --> @Tradeforlife commented on GitHub (Mar 1, 2024): NOTE : I just commented out ``` self.master_node = rr.json()['data']['manager_status']['master_node'] ``` any it seems to be running, not sure if this is required anywhere else.
Author
Owner

@cvk98 commented on GitHub (Mar 1, 2024):

This is required if the script is installed on all nodes. In this case, only 1 should decide how to balance. And thus the HA master is selected. If you have 1 instance, this mechanism is not needed at all.

<!-- gh-comment-id:1972501326 --> @cvk98 commented on GitHub (Mar 1, 2024): This is required if the script is installed on all nodes. In this case, only 1 should decide how to balance. And thus the HA master is selected. If you have 1 instance, this mechanism is not needed at all.
Author
Owner

@cvk98 commented on GitHub (Mar 1, 2024):

Without HA, there is no master node in the cluster.

<!-- gh-comment-id:1972503321 --> @cvk98 commented on GitHub (Mar 1, 2024): Without HA, there is no master node in the cluster.
Author
Owner

@Tradeforlife commented on GitHub (Mar 1, 2024):

I uncommented the line and enabled HA and now it's working as expected, thanks.

<!-- gh-comment-id:1972514534 --> @Tradeforlife commented on GitHub (Mar 1, 2024): I uncommented the line and enabled HA and now it's working as expected, thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxmox-load-balancer#15
No description provided.