fix(lxc): preserve credentials and IP across reinstall
Three related fixes so login/password/SSH key/IP survive a reinstall: 1. backend/app/api/proxmox/lxc.py — on initial LXC deploy save cloud_init_user='root' and cloud_init_password=req.password to VMInstance (previously both were None, so reinstall could not restore root password). 2. backend/app/api/proxmox/async_ops.py — _do_reinstall_sync passes cached.cloud_init_password to create_lxc_container so the new container gets the same root password as the original. 3. backend/app/workers/monitoring_worker.py — VM sync worker no longer overwrites VMInstance.ip_address with NULL when no IPAM allocation exists for that (server_id, vmid). It only updates the field when IPAM has a value, otherwise the IP saved at deploy/wizard time is preserved.
This commit is contained in:
@@ -737,7 +737,10 @@ class MonitoringWorker:
|
||||
existing.os_type = os_type
|
||||
existing.vm_type = vm_type
|
||||
existing.is_template = bool(vm_data.get('template'))
|
||||
existing.ip_address = ip_address
|
||||
# Only overwrite ip_address if IPAM has a value;
|
||||
# otherwise preserve user-assigned IP from deploy/wizard
|
||||
if ip_address:
|
||||
existing.ip_address = ip_address
|
||||
existing.last_sync_at = sync_time
|
||||
existing.deleted_at = None
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user