project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] Cross-cluster LXC replication fails — wrong clone parameter (name vs hostname)

Open DarmokNoob opened this issue 6 months ago • 1 comments

[!NOTE] The stubbornness to actually prove what I found out with live pvesh tests and pveproxy log captures rather than just making assumptions was all me, but Claude and Gemini get credit for helping me dig through the API docs, documenting the investigation, and the RCA write up.

Important caveat: I was unable to capture the actual POST body sent by PegaProx due to TLS encryption on port 8006 and I don't think I needed to go that far. The conclusion that name is the offending parameter is based on the error message reported by both PegaProx and Proxmox, confirmed by pvesh testing showing name is explicitly rejected as an unknown option for LXC clone while hostname is accepted. If you (the dev team) can inspect the actual clone payload in the source code that should prove my assumptions.

Every cross-cluster DR replication job targeting an LXC container fails immediately at the clone step with a 400 error:

Clone failed: {"errors":{"name":"property is not defined in schema and the schema does not allow additional properties"},"data":null,"message":"Parameter verification failed.\n"}

The snapshot and vzdelsnapshot steps complete successfully — only the clone step fails. The same error occurs consistently across multiple LXC containers and multiple attempts.

Based on the error message, PegaProx appears to be sending a name parameter in the clone API call. The Proxmox LXC clone API does not accept name — that is a QEMU/VM-only parameter. LXC containers use hostname instead.

Steps to Reproduce

  1. Add two standalone Proxmox nodes as separate clusters in PegaProx
  2. Ensure LXC containers on source node are on lvmthin storage
  3. Open any LXC container → Configure → Replication → Cross-Cluster → Add DR Job
  4. Set target cluster, target storage (lvmthin), schedule
  5. Trigger the job manually

Expected behavior

The LXC container should be cloned to the target cluster successfully.

Suspected Root Cause

The Proxmox API uses different parameters for clone depending on type:

  • QEMU VMs → name
  • LXC containers → hostname The error "name":"property is not defined in schema" suggests PegaProx is sending name for LXC containers, which Proxmox rejects with 400.

Confirmed via direct pvesh testing on Proxmox 8.4.18:

# name is rejected for LXC
pvesh create /nodes/pve-source/lxc/101/clone --newid 901 --storage local-lvm --full 1 --name test
# Unknown option: name
# 400 unable to parse option
 
# hostname is accepted for LXC
pvesh create /nodes/pve-source/lxc/101/clone --newid 901 --storage local-lvm --full 1 --hostname test
# Proceeds past parameter validation — different error unrelated to parameter name

Tested Proof — Correct API Sequence Works

To confirm the fix, the correct API sequence was executed remotely from the root host that the PegaProx Docker container is installed on (10.0.0.1) against the source Proxmox node (10.0.0.2) using curl. Note: curl is not included in the PegaProx Docker image so these commands were run on the host OS directly — same machine, same network path PegaProx uses.

Step 1 — Create snapshot (same as PegaProx does, this already works):

curl -sk -X POST 'https://10.0.0.2:8006/api2/json/nodes/pve-source/lxc/101/snapshot' \
  -H 'Authorization: PVEAPIToken=root@pam!testtoken=<redacted>' \
  -d 'snapname=drtest'

Response:

{"data":"UPID:pve-source:0027660D:02EAFFBD:6A122D4A:vzsnapshot:101:root@pam!testtoken:"}

Step 2 — Clone using hostname instead of name (this is the fix):

curl -sk -X POST 'https://10.0.0.2:8006/api2/json/nodes/pve-source/lxc/101/clone' \
  -H 'Authorization: PVEAPIToken=root@pam!testtoken=<redacted>' \
  -d 'newid=901&hostname=LXC-Container-DR&storage=local-lvm&full=1&snapname=drtest'

Response:

{"data":"UPID:pve-source:002766F0:02EB0BB2:6A122D68:vzclone:101:root@pam!testtoken:"}

No 400 error. The clone task was accepted and executed successfully. The cloned container appeared in PegaProx confirming the operation completed end to end.

These commands were run on the same host and same network path PegaProx uses — the only difference between PegaProx's failing call and this successful call is hostname vs name. That's the fix.

Suggested Fix

In the cross-cluster replication clone code, detect VM type and send the correct parameter:

if vm_type == 'lxc':
    params['hostname'] = vm_name
else:
    params['name'] = vm_name

Environment

  • PegaProx Version: v0.9.10
  • Installation Method: Docker
  • OS: Arch Linux ARM64 (PiKVM, Raspberry Pi 4)
  • Browser: Chrome
  • Behind Reverse Proxy? No
  • UI: Modern Layout

Logs

pveproxy access log on source Proxmox node showing 400 on clone POST:

POST /api2/json/nodes/pve-source/lxc/101/clone HTTP/1.1" 400 164

PegaProx error from DR job:

Clone failed: {"errors":{"name":"property is not defined in schema and the schema does not allow additional properties"},"data":null,"message":"Parameter verification failed.\n"}

Checklist

  • [x] I have searched existing issues to make sure this is not a duplicate
  • [x] I am using the latest version of PegaProx

DarmokNoob avatar May 23 '26 23:05 DarmokNoob

👋 Thanks for reporting a bug!

Unfortunately, it looks like some required information is missing.

Please provide:

  • [ ] Describe the bug

Why? We are volunteers maintaining PegaProx in our free time. Complete bug reports help us fix issues faster. 🐾

Closing for now — please reopen with the required details or open a new issue.

This is an automated message.

github-actions[bot] avatar May 23 '26 23:05 github-actions[bot]