Repository navigation
KVM: remove leftover conversion XML and UEFI NVRAM files - #14534
andrijapanicsb wants to merge 2 commits into
Conversation
When a VMware VM is converted straight into file-based primary storage (forceconverttopool), the converted disks are used where they are, but the <uuid>.xml file written by virt-v2v was never removed. It stayed in the storage pool even after the VM was expunged. Delete that one file once the converted instance has been read successfully. On failure it is kept, because the existing cleanup command reads it to find the converted disks.
Every UEFI VM has a <uuid>.fd NVRAM file on its KVM host. It was never removed, so it stayed on the host after the VM was expunged. On expunge, ask the host the VM last ran on to delete it. This is best effort: it never fails the expunge and waits at most 60 seconds. The host only deletes the file of a valid VM UUID, and keeps it if a domain with that UUID is still defined there.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14534 +/- ##
============================================
+ Coverage 20.75% 20.77% +0.01%
- Complexity 21901 21927 +26
============================================
Files 6496 6498 +2
Lines 591602 591709 +107
Branches 72583 72597 +14
============================================
+ Hits 122814 122940 +126
+ Misses 455456 455425 -31
- Partials 13332 13344 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@andrijapanicsb a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19855 |
|
@blueorangutan test |
|
@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-17430)
|
Description
Fixes #14462
In short: KVM leaves two kinds of small files behind that nothing ever deletes. This PR deletes each one once it is no longer needed, and changes nothing else.
Who runs into this
Migrating VMs from VMware to KVM. If you convert a VM straight onto NFS primary storage (the "Force converting to storage pool directly" option), a small
.xmlfile is left next to the VM's disks after every migration. It stays there even after the VM is deleted.Deleting UEFI VMs. UEFI is the modern boot firmware. Every UEFI VM has a small file on its KVM host that stores its boot settings, called the NVRAM file. When the VM is permanently deleted (expunged), that file stays on the host.
Nothing uses these files afterwards, and nothing cleans them up. After many migrations or many deleted VMs, an operator has to find and remove them by hand.
What changes
.xmlfile left next to the disks.xmlfile removed, disks untouched.xmlWhat it never does
.xmlfile the import just read is removed.Not covered
Technical details
Conversion XML
forceconverttopool=trueon file-based storage,LibvirtImportConvertedInstanceCommandWrapperadopts the converted disks in place and skipped the cleanup step that the normal path runs.<conversion-uuid>.xml(the file it just parsed), only after the converted instance was read successfully.CleanupConvertedInstanceDisksCommand, which reads that XML to find the converted disks to remove./tmpfile deleted in afinallyblock, in-place finalization writes no output XML, and the fallback output directory is deleted once the disks are moved out.forceconverttopool, VMware to KVM Migrations improvements #11594 (b106d6e).UEFI NVRAM
guest.nvram.path+<vm-uuid>.fd.KVMGuru.finalizeExpungenow sends a newDeleteUefiNvramCommandto the VM's current or last host, only for user VMs with theUEFIboot detail.easySendwith a 60 second timeout, catches all errors, and still returns no expunge commands. Returning the command fromfinalizeExpungeinstead would have made expunge fail whenever the last host is down.LibvirtDeleteUefiNvramCommandWrapper:Files
core/src/main/java/com/cloud/agent/api/DeleteUefiNvramCommand.java(new)plugins/hypervisors/kvm/.../wrapper/LibvirtDeleteUefiNvramCommandWrapper.java(new)plugins/hypervisors/kvm/.../wrapper/LibvirtImportConvertedInstanceCommandWrapper.javaserver/src/main/java/com/cloud/hypervisor/KVMGuru.javaTypes of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
In short: all affected unit tests pass, including 19 new ones. No live test yet.
.xmlgoes, the disk and unrelated files stay.xmlfor the existing cleanup../...Test details
Run locally with JDK 17:
LibvirtImportConvertedInstanceCommandWrapperTestLibvirtDeleteUefiNvramCommandWrapperTest(new)KVMGuruTest-Dexec.skip=trueskips an unrelated schema shell test that cannot run on Windows (CRLF line endings).Planned live checks:
forceconverttopool=true, then confirm no<uuid>.xmlis left in the pool;