From nobody Wed Apr 24 15:37:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595841467; cv=none; d=zohomail.com; s=zohoarc; b=l553Q3u/s1mS65FgqwypQYB5h+gHpFBM3GEtVyCM78TcoDt6ztWcBZwkXSOXQ9XHvTVWQz5lwOSsMdHzV3qFfZNSC88f7mPISSGiXxucSO+bz+u6dSEfYfrccOHFsQ8dcr/yIv0A8hcIPIPyuyGDteXIHoqyY7nd0M8Syg/Fg48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595841467; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=2nVKLAlOkHDh/LsoeolzExlXTp6QyKcJ0yxB1uRZ47Q=; b=eWZet/qmJWr3Rg8RCbeD9K4u7ubDBpim6Cw7+9Jy9Wc6dMOyzHsyhJMYx/5PaOU3blXKrRfNolDyw6irvbRTJA2cVU011ubogwhIrMEja4gzD51gCmsEkDpTGM8l1TJRrYuWW/XYD8QIacgW7pErtYl8Te8vVYe1z7soCXeVl5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1595841467059981.0127008049374; Mon, 27 Jul 2020 02:17:47 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-4aWRPmyWM3eeCm5EXSUcQA-1; Mon, 27 Jul 2020 05:17:42 -0400 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 A0A2D800597; Mon, 27 Jul 2020 09:17:37 +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 5CEA68FA5F; Mon, 27 Jul 2020 09:17:36 +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 D12AA1809554; Mon, 27 Jul 2020 09:17:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06R6t2fC002108 for ; Mon, 27 Jul 2020 02:55:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3DA46217B435; Mon, 27 Jul 2020 06:55:02 +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 38BBA2166BA3 for ; Mon, 27 Jul 2020 06:55:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AC9E185A797 for ; Mon, 27 Jul 2020 06:55:00 +0000 (UTC) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-255-gCKkfrqQMTWgHDocwGCThA-1; Mon, 27 Jul 2020 02:54:55 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 01C07134680B6F704856 for ; Mon, 27 Jul 2020 14:38:49 +0800 (CST) Received: from huawei.com (10.175.101.6) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Mon, 27 Jul 2020 14:38:41 +0800 X-MC-Unique: 4aWRPmyWM3eeCm5EXSUcQA-1 X-MC-Unique: gCKkfrqQMTWgHDocwGCThA-1 From: Chuan Zheng To: Subject: [PATCH] migration: fix xml file residual during vm crash with migration Date: Mon, 27 Jul 2020 14:51:01 +0800 Message-ID: <1595832661-113281-1-git-send-email-zhengchuan@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-CFilter-Loop: Reflected X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 27 Jul 2020 05:17:32 -0400 Cc: fangying1@huawei.com, alex.chen@huawei.com, wanghao232@huawei.com, zhang.zhanghailiang@huawei.com, yubihong@huawei.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 Content-Type: text/plain; charset="utf-8" From: Zheng Chuan when migration is cancelled (such as kill -9 vmpid in Src, etc), it could do virDomainSaveStatus() to save xml file after qemuProcessStop(), which re= sults in xml residulal. Fix it by that do not do virDomainSaveStatus() if vm is not active. Signed-off-by: Zheng Chuan --- src/qemu/qemu_migration.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2c7bf34..d2804ab 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3073,6 +3073,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver, qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, jobPriv->migParams, priv->job.apiFlags); =20 + if (!virDomainObjIsActive(vm)) + goto done; + if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); } --=20 1.8.3.1