Add proxmox hostname to vps name
This commit is contained in:
Binary file not shown.
@@ -75,7 +75,9 @@ class VPSServer(models.Model):
|
|||||||
config_data = config_response.json()['data']
|
config_data = config_response.json()['data']
|
||||||
|
|
||||||
# Update fields
|
# Update fields
|
||||||
self.name = config_data.get('name', f"{vm_type}-{vm_id}")
|
hostname = config_data.get('hostname', '')
|
||||||
|
vm_name = f"{vm_type}-{vm_id}"
|
||||||
|
self.name = f"{vm_name} ({hostname})" if hostname else vm_name
|
||||||
self.cpu = status_data.get('cpus', 0)
|
self.cpu = status_data.get('cpus', 0)
|
||||||
self.ram = status_data.get('maxmem', 0) / (1024 * 1024 * 1024) # Convert to GB
|
self.ram = status_data.get('maxmem', 0) / (1024 * 1024 * 1024) # Convert to GB
|
||||||
self.storage = status_data.get('maxdisk', 0) / (1024 * 1024 * 1024) # Convert to GB
|
self.storage = status_data.get('maxdisk', 0) / (1024 * 1024 * 1024) # Convert to GB
|
||||||
|
|||||||
Reference in New Issue
Block a user