Skip to content

Commit

Permalink
Filter out UNDEFINE_NVRAM for test:///default
Browse files Browse the repository at this point in the history
The test driver doesn't support UNDEFINE_NVRAM and I couldn't find a way
to probe for the capability. This hacks around it by looking at the
service uri and filters out the flag.

It also adds an explicit test since previously the exception was
swallowed. A new server is created to avoid interference with other
tests.

The cherry pick doesn't include tests because the testing infrastructure
doesn't work in this branch.

(cherry picked from commit 14ac85e)
  • Loading branch information
ekohl committed Jul 17, 2024
1 parent 31c376e commit 5d101c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/fog/libvirt/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def destroy(options={ :destroy_volumes => false, :flags => ::Libvirt::Domain::UN
if flags.zero?
service.vm_action(uuid, :undefine)
else
# the test driver doesn't support UNDEFINE_NVRAM
if service.uri.driver == 'test'

Check warning on line 100 in lib/fog/libvirt/models/compute/server.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Raw Output: lib/fog/libvirt/models/compute/server.rb:100:38: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
flags ^= ::Libvirt::Domain::UNDEFINE_NVRAM
end
service.vm_action(uuid, :undefine, flags)
end
volumes.each { |vol| vol.destroy } if options[:destroy_volumes]
Expand Down

0 comments on commit 5d101c9

Please sign in to comment.