mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-14 07:04:43 -05:00
virsh: Fix regression with duplicated error messages
Commit4f4c3b13(v3.3) fixed an issue where performing cleanup of libvirt objects could sometimes lose error messages, by adding code to copy the libvirt error into last_error prior to cleanup paths. However, it caused a regression: on other paths, some errors are now printed twice, if libvirt still remembers in its thread-local storage that an error was set even after virsh cleared last_error. For example: $ virsh -c test:///default snapshot-delete test blah error: Domain snapshot not found: no domain snapshot with matching name 'blah' error: Domain snapshot not found: no domain snapshot with matching name 'blah' Fix things by telling libvirt to discard any thread-local errors at the same time virsh prints an error message (whether or not the libvirt error is the same as what is stored in last_error). Update the virsh-undefine testsuite (partially reverting portions of commitb620bdee, by removing -q, to more easily pinpoint which commands are causing which messages), now that there is only one error message instead of two. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -276,6 +276,7 @@ vshResetLibvirtError(void)
|
||||
{
|
||||
virFreeError(last_error);
|
||||
last_error = NULL;
|
||||
virResetLastError();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user