apache / apache/cloudstack

[KVM] CloudStack infrastructure metadata is preserved in libvirt XML after unmanaged VM operation (introduced in PR #11061)

Đang mở
#12,126 2 bình luận 0 reaction 1 người được giao Được @pavanaravapalli nhận Xem trên GitHub
component:kvm component:libvirt no-issue-activity
Ngôn ngữ chính
Java
Star
3.1k
Fork
1.4k
Merge trung bình
6 ngày 19 giờ
Pull request đã merge (30 ngày)
32

Mô tả

### problem

When a KVM instance is marked as unmanaged, CloudStack leaves infrastructure metadata — zone, pod, cluster, and host details — inside the libvirt VM XML.

This behavior appears to have been introduced as part of the enhancement in PR: https://github.com/apache/cloudstack/pull/11061.
As a result, operators must manually or programmatically remove these metadata entries.

### versions

4.22.1, main

### The steps to reproduce the bug

**Steps to Reproduce**

1. Install CloudStack main branch.
2. Deploy a VM on a KVM hypervisor.
3. Trigger an "unmanage VM" operation in CloudStack.
4. On the KVM host, inspect the libvirt XML for that VM: /etc/libvirt/qemu/.xml
5. Observe that infrastructure metadata tags (zone, pod, cluster, host) remain intact.

**Expected Behavior**

- When a VM is marked unmanaged:
CloudStack-specific infrastructure metadata should be removed from the libvirt XML,

**Actual Behavior**

- Metadata remains in the VM’s libvirt XML after the unmanage operation.
- Users must manually remove or script the cleanup of zone/pod/cluster/host metadata.
- This may cause confusion or inconsistent state if unmanaged VMs are later moved, repurposed, or reused.

** Impact **

- Operational confusion: Unmanaged VMs still appear to reference CloudStack infrastructure.
- Automation issues: Tools/scripts that rely on metadata may misinterpret the VM’s state.
- Security & hygiene: Residual metadata may mislead audits or lifecycle operations.
- Maintenance overhead: Users must clean up metadata manually or build custom scripts.

### What to do about it?

**Proposed Fix**

Automatically remove CloudStack metadata (zone, pod, cluster, host) during the unmanage VM workflow on KVM.
Alternatively, add a new configuration variable (e.g., kvm.libvirt.xml.metadata.clean=true|false) so operators can opt in or out of automatic cleanup.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.