mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-02-13 03:32:16 +00:00
fix vm type and data empty
This commit is contained in:
parent
b89c73d67f
commit
986a14d643
1 changed files with 9 additions and 5 deletions
|
@ -93,19 +93,21 @@ class Analyse:
|
||||||
if nodes_list["result"] == "OK":
|
if nodes_list["result"] == "OK":
|
||||||
for value_nodes_list in nodes_list["value"]["data"]:
|
for value_nodes_list in nodes_list["value"]["data"]:
|
||||||
# if value_nodes_list["node"] not in exclude_nodes:
|
# if value_nodes_list["node"] not in exclude_nodes:
|
||||||
list_instances = {}
|
list_instances = { "data" : []}
|
||||||
""" TOTAL COUNT CPU and RAM allocate """
|
""" TOTAL COUNT CPU and RAM allocate """
|
||||||
if (instancetype == "all"):
|
if (instancetype == "all"):
|
||||||
types = ["lxc", "qemu"] # vz...
|
types = ["lxc", "qemu"] # vz...
|
||||||
for type in types:
|
for type in types:
|
||||||
list_instances.update(
|
list_instances["data"] = list_instances["data"] + \
|
||||||
proxmox.get_instances("{0}:{1}".format(cluster["url"], int(cluster["port"])),
|
proxmox.get_instances("{0}:{1}".format(cluster["url"], int(cluster["port"])),
|
||||||
value_nodes_list["node"], type)["value"])
|
value_nodes_list["node"], type)["value"]["data"]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
list_instances = \
|
list_instances = \
|
||||||
proxmox.get_instances("{0}:{1}".format(cluster["url"], int(cluster["port"])),
|
proxmox.get_instances("{0}:{1}".format(cluster["url"], int(cluster["port"])),
|
||||||
value_nodes_list["node"], instancetype)["value"]
|
value_nodes_list["node"], instancetype)["value"]
|
||||||
|
|
||||||
|
|
||||||
totalcpu = 0
|
totalcpu = 0
|
||||||
totalram = 0
|
totalram = 0
|
||||||
|
|
||||||
|
@ -124,9 +126,11 @@ class Analyse:
|
||||||
instance["cluster"] = cluster["name"]
|
instance["cluster"] = cluster["name"]
|
||||||
instance["node"] = value_nodes_list["node"]
|
instance["node"] = value_nodes_list["node"]
|
||||||
instance["date"] = int(insert_time)
|
instance["date"] = int(insert_time)
|
||||||
instance["type"] = "" # a revoir
|
if "type" not in instance:
|
||||||
|
instance["type"] = "qemu"
|
||||||
self.mongo.insert_instances(instance)
|
self.mongo.insert_instances(instance)
|
||||||
|
|
||||||
|
print(list_instances)
|
||||||
"""
|
"""
|
||||||
#############
|
#############
|
||||||
# NODES #
|
# NODES #
|
||||||
|
|
Loading…
Reference in a new issue