From 7d37d9f4bf95e62c981291919863548a75930c3e Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 19 Oct 2023 19:04:37 +0200 Subject: [PATCH] Undefine NVRAM on vm destruction VMs with UEFI store UEFI variables in OVMF files. This flag tells Libvirt to undefine it, if it exists. This was introduced in libvirt 1.2.6, which can be found on very old EL7 systems, but those are no longer supported. EL 7.9 (only supported EL7 version) ships libvirt 4.5. --- lib/fog/libvirt/models/compute/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fog/libvirt/models/compute/server.rb b/lib/fog/libvirt/models/compute/server.rb index 8bcc521..55241f2 100644 --- a/lib/fog/libvirt/models/compute/server.rb +++ b/lib/fog/libvirt/models/compute/server.rb @@ -90,9 +90,9 @@ def disk_path volumes.first.path if volumes and volumes.first end - def destroy(options={ :destroy_volumes => false, :flags => 0 }) + def destroy(options={ :destroy_volumes => false, :flags => ::Libvirt::Domain::UNDEFINE_NVRAM }) poweroff unless stopped? - if options.fetch(:flags, 0).zero? + if options.fetch(:flags, ::Libvirt::Domain::UNDEFINE_NVRAM).zero? service.vm_action(uuid, :undefine) else service.vm_action(uuid, :undefine, options[:flags])