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@xxxxxxxxxx> --- BTW. if I'm more aggressive and let virReportError() have just any args then even more places fit the rule (approx. two dozen more). src/qemu/qemu_driver.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 70d51855b2..e417d358cd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19924,9 +19924,7 @@ qemuDomainGetSEVInfo(virQEMUDriver *driver, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0) return -1; - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(vm) < 0) { goto endjob; } @@ -20744,9 +20742,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(vm) < 0) { goto endjob; } -- 2.34.1