On a Monday in 2022, Michal Privoznik wrote:
Using the following spatch, I've identified two places which
could be switched from explicit virDomainObjIsActive() +
virReportError() to virDomainObjCheckActive():
@@
expression dom;
@@
if (
- !virDomainObjIsActive(dom)
+ virDomainObjCheckActive(dom) < 0
) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not
running"));
...
}
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
BTW. if I'm more aggressive and let virReportError() have just any args
then even more places fit the rule (approx. two dozen more).
Had you sent that as a patch, we would have been able to see what kind
of error messages are used in those places without having to run the
spatch.
src/qemu/qemu_driver.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano