-
Notifications
You must be signed in to change notification settings - Fork 172
[virsh metadata] change the checking logic for missing metadata #6376
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ def run(test, params, env): | |
virsh_dargs = {'debug': True, 'ignore_status': True} | ||
metadata_set = "yes" == params.get("metadata_set", "no") | ||
metadata_get = "yes" == params.get("metadata_get", "yes") | ||
metadata_empty = "yes" == params.get("metadata_empty", "no") | ||
metadata_remove = "yes" == params.get("metadata_remove", "no") | ||
restart_libvirtd = "yes" == params.get("restart_libvirtd", "no") | ||
status_error = "yes" == params.get("status_error", "no") | ||
|
@@ -110,6 +111,10 @@ def get_metadata(metadata_option=""): | |
**virsh_dargs) | ||
check_result(result, status_error) | ||
# Get metadata | ||
# from libvirt 11.3.0, instead of return status error, libvirt will return an empty string if there is no metadata to be returned | ||
if metadata_empty: | ||
status_error = False | ||
metadata_value = "" | ||
for option in metadata_option.split(): | ||
if option == "--config": | ||
vm.destroy() | ||
|
@@ -137,6 +142,6 @@ def get_metadata(metadata_option=""): | |
check_result(result, status_error) | ||
# Get metadata again | ||
for option in metadata_option.split(): | ||
check_result(get_metadata(metadata_option=option), True) | ||
check_result(get_metadata(metadata_option=option), False, '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will negative scenarios now fail for previous libvirt versions? If so, maybe the negative scenarios should only be run with 11.3.0 or later. This can be achieved by using version switch as described here: https://github.com/autotest/tp-libvirt/blob/master/tp-libvirt_review_comment_summary.rst?plain=1#L121 |
||
finally: | ||
vmxml.sync() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this comment in favor of cleaner code, the information is available in your commit message.