From nobody Sun Apr 28 23:56:43 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.zoho.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 1493742754298421.3896350798466; Tue, 2 May 2017 09:32:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2D6EEC2D8; Tue, 2 May 2017 16:32:28 +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 58276806B1; Tue, 2 May 2017 16:32:28 +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 9510A18523CD; Tue, 2 May 2017 16:32:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v42GWOmi016932 for ; Tue, 2 May 2017 12:32:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id B91F7729C5; Tue, 2 May 2017 16:32:24 +0000 (UTC) Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8BEA5729CD for ; Tue, 2 May 2017 16:32:21 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 18339100E8D; Tue, 2 May 2017 18:32:20 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E2D6EEC2D8 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E2D6EEC2D8 From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 2 May 2017 18:32:19 +0200 Message-Id: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Fix persistent migration of transient domains 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.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 02 May 2017 16:32:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" While fixing a bug with incorrectly freed memory in commit v3.1.0-399-g5498aa29a, I accidentally broke persistent migration of transient domains. Before adding qemuDomainDefCopy in the path, the code just took NULL from vm->newDef and used it as the persistent def, which resulted in no persistent XML being sent in the migration cookie. This scenario is perfectly valid and the destination correctly handles it by using the incoming live definition and storing it as the persistent one. After the mentioned commit libvirtd would just segfault in the described scenario. https://bugzilla.redhat.com/show_bug.cgi?id=3D1446205 Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 30f98da1e..3c0d7e957 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3640,15 +3640,15 @@ qemuMigrationRun(virQEMUDriverPtr driver, =20 if (flags & VIR_MIGRATE_PERSIST_DEST) { if (persist_xml) { - persistDef =3D qemuMigrationPrepareDef(driver, persist_xml, - NULL, NULL); - } else { - persistDef =3D qemuDomainDefCopy(driver, vm->newDef, - VIR_DOMAIN_XML_SECURE | - VIR_DOMAIN_XML_MIGRATABLE); + if (!(persistDef =3D qemuMigrationPrepareDef(driver, persist_x= ml, + NULL, NULL))) + goto cleanup; + } else if (vm->newDef) { + if (!(persistDef =3D qemuDomainDefCopy(driver, vm->newDef, + VIR_DOMAIN_XML_SECURE | + VIR_DOMAIN_XML_MIGRATABLE= ))) + goto cleanup; } - if (!persistDef) - goto cleanup; } =20 mig =3D qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list