From nobody Sat May 4 17:48:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639573709248323.0253331690677; Wed, 15 Dec 2021 05:08:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-333-fM91MGDcMxiMgpj9gnYLKA-1; Wed, 15 Dec 2021 08:08:21 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0601E109B9B1; Wed, 15 Dec 2021 13:07:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9052E4E2A8; Wed, 15 Dec 2021 13:07:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1C5EC1809CB8; Wed, 15 Dec 2021 13:07:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BFD7kUh015469 for ; Wed, 15 Dec 2021 08:07:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2BECD401E4C; Wed, 15 Dec 2021 13:07:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 288ED400F24 for ; Wed, 15 Dec 2021 13:07:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E672185A7B4 for ; Wed, 15 Dec 2021 13:07:46 +0000 (UTC) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-PHAn1jHVPAqBludXQ5Qo2g-1; Wed, 15 Dec 2021 08:07:44 -0500 Received: by mail-pg1-f181.google.com with SMTP id y9so6959029pgj.5 for ; Wed, 15 Dec 2021 05:07:43 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([203.163.243.175]) by smtp.googlemail.com with ESMTPSA id h66sm2368277pgc.34.2021.12.15.05.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 05:07:41 -0800 (PST) X-MC-Unique: fM91MGDcMxiMgpj9gnYLKA-1 X-MC-Unique: PHAn1jHVPAqBludXQ5Qo2g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Vb4WFZKqnadxK0l2/zQv/k9mwKqYYPCSQo9DyhEUrWA=; b=iaRoh5lfY9UnSVCMMWOsprZrKYEITuZYeZtGL/KJrz0FNDB+KHEKp1KaZQ+zBgEC33 KJrqt2dFuDPJphmHzwE+G155yjy0vO/WJGS3IMpc1iR0nSSLb0qpO6c1tlYtjgR08/u0 FeNlrUoYegoowtKv2Gv+biptbINPnwPyY6aVercdDaQqSoNYoFLEqz/qutErQLxd1KDt i61lzVKyJdxI6//BaEZn3hizwzicX75ANzIbWnIlttPNDR7U7ZozXK4Fv2QcXdeS1tP+ Jiw23KKApWp6NfEDCrPmdbKR51PiYyp4yZ2CasahqVtu58hJjptf1M79QepVHT/pwNfo 4qRg== X-Gm-Message-State: AOAM5309xjJg41HN0sig5/Oj5gPlPccvPzgnr9d/p7MEzSXhhg1aqmtF NarOD70g+078WIfRQht4ZCQet+YFswSP7A== X-Google-Smtp-Source: ABdhPJwaI9GTov2uGXIOefl7TfldRRuKoQHYqG2DuTcTLecSirP0Us04t5P0pVNuZWcVw8mwOdCX8Q== X-Received: by 2002:a63:1c52:: with SMTP id c18mr7955764pgm.182.1639573662454; Wed, 15 Dec 2021 05:07:42 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [PATCH] qemu: fix missing cleanup on error in qemuSaveImageStartVM Date: Wed, 15 Dec 2021 18:37:21 +0530 Message-Id: <20211215130721.495148-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-loop: libvir-list@redhat.com Cc: Ani Sinha , jdenemar@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1639573710982100001 Content-Type: text/plain; charset="utf-8" Commit 52521de8332c2323bd ("qemu: Use qemuDomainSaveStatus") replaced a call to virDomainObjSave() with qemuDomainSaveStatus() as a part of cleanup. Sin= ce qemuDomainSaveStatus() does not indicate any failure through its return cod= e, the error handling cleanup code got eliminated in the process. Thus upon failure, we will no longer killing the started qemu process. This commit fi= xes this by reverting the change that was introduced with the above commit. Fixes: 52521de8332c2323bd ("qemu: Use qemuDomainSaveStatus") Signed-off-by: Ani Sinha Reviewed-by: Jiri Denemark --- src/qemu/qemu_saveimage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 28d6098dd8..557ee2cd21 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -586,6 +586,7 @@ qemuSaveImageStartVM(virConnectPtr conn, VIR_AUTOCLOSE intermediatefd =3D -1; g_autoptr(virCommand) cmd =3D NULL; g_autofree char *errbuf =3D NULL; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); virQEMUSaveHeader *header =3D &data->header; g_autoptr(qemuDomainSaveCookie) cookie =3D NULL; int rc =3D 0; @@ -679,7 +680,10 @@ qemuSaveImageStartVM(virConnectPtr conn, "%s", _("failed to resume domain")); goto cleanup; } - qemuDomainSaveStatus(vm); + if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) { + VIR_WARN("Failed to save status on vm %s", vm->def->name); + goto cleanup; + } } else { int detail =3D (start_paused ? VIR_DOMAIN_EVENT_SUSPENDED_PAUSED : VIR_DOMAIN_EVENT_SUSPENDED_RESTORED); --=20 2.25.1