From nobody Thu Mar 28 08:16:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526337890993203.69424008011356; Mon, 14 May 2018 15:44:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 655B830D4DAC; Mon, 14 May 2018 22:44:48 +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 1DD2320D8801; Mon, 14 May 2018 22:44:47 +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 A2EEC1801249; Mon, 14 May 2018 22:44:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4EMifDU024431 for ; Mon, 14 May 2018 18:44:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id C797D30B2001; Mon, 14 May 2018 22:44:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0F1530B2003 for ; Mon, 14 May 2018 22:44:39 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE1C216A34A for ; Mon, 14 May 2018 22:44:31 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Mon, 14 May 2018 16:44:28 -0600 From: Jim Fehlig To: libvir-list@redhat.com Date: Mon, 14 May 2018 16:44:15 -0600 Message-Id: <20180514224415.10116-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 14 May 2018 22:44:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 14 May 2018 22:44:37 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] libxl: don't set hasManagedSave when performing save 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 14 May 2018 22:44:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" libxlDoDomainSave() is used in both the save and managedsave code paths but was unconditionally setting hasManagedSave to true on success. As a result, undefine would fail after a non-managed save/restore operation. E.g. virsh define; virsh start virsh save; virsh restore virsh shutdown virsh undefine error: Refusing to undefine while domain managed save image exists Modify libxlDoDomainSave() to take an additional parameter to specify managed vs non-managed save, and change callers to use it. Signed-off-by: Jim Fehlig Reviewed-by: Daniel P. Berrang=C3=A9 --- src/libxl/libxl_driver.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 34adef8d48..df53dead0a 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1653,8 +1653,10 @@ libxlDomainGetState(virDomainPtr dom, * virDomainObjPtr must be locked on invocation */ static int -libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, - const char *to) +libxlDoDomainSave(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + const char *to, + bool managed) { libxlDriverConfigPtr cfg =3D libxlDriverConfigGet(driver); libxlSavefileHeader hdr; @@ -1725,7 +1727,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDo= mainObjPtr vm, } =20 libxlDomainCleanup(driver, vm); - vm->hasManagedSave =3D true; + vm->hasManagedSave =3D managed; ret =3D 0; =20 cleanup: @@ -1772,7 +1774,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to= , const char *dxml, if (virDomainObjCheckActive(vm) < 0) goto endjob; =20 - if (libxlDoDomainSave(driver, vm, to) < 0) + if (libxlDoDomainSave(driver, vm, to, false) < 0) goto endjob; =20 if (!vm->persistent) @@ -1989,7 +1991,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int= flags) =20 VIR_INFO("Saving state to %s", name); =20 - if (libxlDoDomainSave(driver, vm, name) < 0) + if (libxlDoDomainSave(driver, vm, name, true) < 0) goto endjob; =20 if (!vm->persistent) --=20 2.16.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list