Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out UNDEFINE_NVRAM for test:///default #153

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

ekohl
Copy link
Contributor

@ekohl ekohl commented Jul 16, 2024

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.

@ekohl
Copy link
Contributor Author

ekohl commented Jul 16, 2024

https://gitlab.com/libvirt/libvirt/-/blob/239669049d9904e5e8da2d8b2a38d4d927a167e9/src/qemu/qemu_capabilities.c#L261 suggests there's an nvram capability, but I don't see this on my real libvirt instance.

https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlagsValues is a list of possible flags, but this really doesn't help since I don't see a way to probe for supported flags.

@ekohl ekohl force-pushed the add-destroy-test branch from f1e16fb to 791cab1 Compare July 16, 2024 15:45
@ekohl ekohl changed the title Add a test for Server#destroy Filter out UNDEFINE_NVRAM for test:///default Jul 16, 2024
@ekohl ekohl added the bug label Jul 16, 2024
@@ -97,6 +97,11 @@ 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 and we can't probe

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a "FIXME" comment so that it gets highlighted?
Is it possible to open a issue for the test driver so that the UNDEFINE_NVRAM gets fixed soonish?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more digging in the source tells me it's implemented in src/test. Specifically, https://gitlab.com/libvirt/libvirt/-/blob/239669049d9904e5e8da2d8b2a38d4d927a167e9/src/test/test_driver.c?page=5#L4578-4634

I'm not sure if it can simply be added to virCheckFlags there, or if the whole driver needs to support nvram.

Copy link

@sbernhard sbernhard Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is true. The https://gitlab.com/libvirt/libvirt/-/blob/master/src/internal.h?ref_type=heads#L259 is a just a macro and will return if a unsupported flag is used. And https://gitlab.com/libvirt/libvirt/-/blob/239669049d9904e5e8da2d8b2a38d4d927a167e9/src/test/test_driver.c?page=5#L4587 only specified some flags but not NVRAM.

@@ -97,6 +97,11 @@ 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 and we can't probe
# for the capability at runtime
if service.uri.uri == 'test:///default'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some further digging. https://libvirt.org/drvtest.html documents the test driver. So really it should look at the scheme see if that's test or test+something.

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.
@ekohl ekohl force-pushed the add-destroy-test branch from 791cab1 to 14ac85e Compare July 16, 2024 20:07
Copy link

@dosas dosas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for fixing this.

@ekohl ekohl merged commit 14ac85e into fog:master Jul 17, 2024
6 of 7 checks passed
@ekohl ekohl deleted the add-destroy-test branch July 17, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants