Skip to content

Commit

Permalink
Undefine NVRAM on vm destruction
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Dec 20, 2023
1 parent 16a7083 commit 7d37d9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fog/libvirt/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 7d37d9f

Please sign in to comment.