From nobody Sun May 5 15:26:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614907236; cv=none; d=zohomail.com; s=zohoarc; b=FnLKZm0zGshh0hzwckW54N3o5EXynVuMcl4XWvm8dLugAmU3YNxrp8fvHFCKkA4GRz+Hn4sfnA90znRAhfUhITyw+WJTjrIBJeiMbt11yRyt2FIgH3kvEnrVQIT+8BSufPXj3h64GIH+OE3INzbsQaqyXTOLARuw2yuKeuuJ+Ug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614907236; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IE9qPi7tVAnCDKuZB+/HZWWR8139FQQsx1opPGuVHUM=; b=Wg0OlhaXNneWXOLqSPm7kXN6FTHU5SwYADmAkN6d1l8oMoPrhXEkFDoAR/bSqad0p1U57dTtwVeO9mbWhgSqVCaEosAkdD2dw47wKI2cAWOxu1LVnc1bOW6rR5maLWD3d09UDnDzJPmHMDwRqiFqD1gvMRyjoN65oPbfthDpB04= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614907236691841.218911123484; Thu, 4 Mar 2021 17:20:36 -0800 (PST) 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-473-bln54c9CNUipVE9z7iPhmg-1; Thu, 04 Mar 2021 20:20:33 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBE4726863; Fri, 5 Mar 2021 01:20:25 +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 911EF1002393; Fri, 5 Mar 2021 01:20:23 +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 998241809C86; Fri, 5 Mar 2021 01:20:18 +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 1251KGn9022767 for ; Thu, 4 Mar 2021 20:20:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B3C82166B44; Fri, 5 Mar 2021 01:20:16 +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 355B42166BA2 for ; Fri, 5 Mar 2021 01:20:13 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 C64451854CB1 for ; Fri, 5 Mar 2021 01:20:13 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-mCY8eb9rNmyseai7vmDZQg-1; Thu, 04 Mar 2021 20:20:11 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Ds8xG2Z4tzMjHC for ; Fri, 5 Mar 2021 09:17:54 +0800 (CST) Received: from localhost (10.174.149.172) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 5 Mar 2021 09:19:57 +0800 X-MC-Unique: bln54c9CNUipVE9z7iPhmg-1 X-MC-Unique: mCY8eb9rNmyseai7vmDZQg-1 From: Hogan Wang To: Subject: [PATCH] vm : forbid to start a removing vm Date: Fri, 5 Mar 2021 09:19:52 +0800 Message-ID: <20210305011952.960-1-hogan.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.149.172] X-CFilter-Loop: Reflected 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.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1251KGn9022767 X-loop: libvir-list@redhat.com Cc: zhuangshengen@huawei.com, wangxinxin.wang@huawei.com, weidong.huang@huawei.com, hogan.wang@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.84 on 10.5.11.22 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: Zhuang Shengen When a vm is doing migration phase confirm, and then start it concurrently, it will lead to the vm out of libvirtd control. Cause Analysis: 1. thread1 migrate vm out. 2. thread2 start the migrating vm. 3. thread1 remove vm from domain list after migrate success. 4. thread2 acquired the vm job success and start the vm. 5. cannot find the vm any more by 'virsh list' command. Actually, the started vm is not exist in the domain list. Solution: Check the vm->removing state before start. Signed-off-by: Zhuang Shengen Reviewed-by: Hogan Wang --- src/qemu/qemu_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d1a3659774..a5dfea94cb 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6637,6 +6637,12 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned= int flags) goto endjob; } =20 + if (vm->removing) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is already removing")); + goto endjob; + } + if (qemuDomainObjStart(dom->conn, driver, vm, flags, QEMU_ASYNC_JOB_START) < 0) goto endjob; --=20 2.23.0