From nobody Wed May 15 23:34:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508468; cv=none; d=zohomail.com; s=zohoarc; b=mYlt6Wz6HdlAq1yV5ZggoCwVt3dXl4wJ/UKXWCzRw9tMsesb//iUdE1hQTALrP2wItE/9ana95jrwD728Ai1emdm3yUwKSCEPWw4lHhmOSHxl5fOacGGbEyebQws786Zm7oWMUgnH+gaWT2RAlDFmP30Ylw2L/PBIByGNXShgaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508468; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bmgT8ZZqkK1OONTSyX5u4BNitXzBxbcucp7MZCjqJqA=; b=b/yJe4FKhJEe9KJDXT/NT4O7KpuZ8iG5Rp5x9tD2TXkJMfp3lHoNqgzWHto6nWLABFGGKyhKLa+jwqQXMY3Qawn4ftA6eZfqv5EmoNVscmw+0H0KTHsbNr2msb99VfOx5+zmJCU98bEfTNoabXDrEIYPnGXstahfGLPZdR14ldA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1644508468667451.2260233328659; Thu, 10 Feb 2022 07:54:28 -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-55-Bgitlr5aN6e53jLeohDcTQ-1; Thu, 10 Feb 2022 10:54:27 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C844510557D5; Thu, 10 Feb 2022 15:54:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BB8B7DE44; Thu, 10 Feb 2022 15:54:21 +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 22A944BB7C; Thu, 10 Feb 2022 15:54:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpbp7011332 for ; Thu, 10 Feb 2022 10:51:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5DB5075133; Thu, 10 Feb 2022 15:51:37 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC71975745 for ; Thu, 10 Feb 2022 15:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508468; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bmgT8ZZqkK1OONTSyX5u4BNitXzBxbcucp7MZCjqJqA=; b=XwpzSNwnQFK3WlC1Rg1J9LnA1Nzv+j2Da9+KeN/aZWUKWa0peaK844An6N3QzOohoyqqU9 62xavvzzxY1Q16SyF+nUIappdKQTKGe+7CObh4m1PfKO/FsyGJVwNMt0U2HR6SCJwfzB6W 1hr5QAI70k2mDASGA8rzpTAxW7HUcIU= X-MC-Unique: Bgitlr5aN6e53jLeohDcTQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/6] ch_driver: Don't lock driver when getting version Date: Thu, 10 Feb 2022 16:51:29 +0100 Message-Id: <3ca3d9dd639c4dcdd6b55c469d8288457490a2f5.1644507592.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.16 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508492875100001 Content-Type: text/plain; charset="utf-8" In chConnectGetVersion() the CH driver is locked in order to read driver->version. This is needless, because not only is the version set with driver unlocked (chStateInitialize() calls chExtractVersion() which sets the version), but the version is practically immutable. Once driver initialized itself it's never changed. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_driver.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index e751ddba19..7c3b45ca2f 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -106,9 +106,7 @@ static int chConnectGetVersion(virConnectPtr conn, if (virConnectGetVersionEnsureACL(conn) < 0) return -1; =20 - chDriverLock(driver); *version =3D driver->version; - chDriverUnlock(driver); return 0; } =20 --=20 2.34.1 From nobody Wed May 15 23:34:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508560; cv=none; d=zohomail.com; s=zohoarc; b=BmaCFpWPyMpY4D2DHxrUHzUzhDCM50tj+fB/qvyxkT19cUOm9nQFOLUGqIL12M5DX0ajJQ/M1S1ouKwdpn5ixnC6UAL2QQfC2m9hkDW5fI/hJiEk3ONHNPRsZqjnFHUz8kNXxq+VJLtpKGZDnJXzIZcC4PqxL3joFBIufueTrP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508560; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AhWxNdk2cb8fj5a7MvCXyswrBHD5AfzfHKg7VJJvYJU=; b=FRgoSXGhDqQTr9+SfHtCgJceaezs1/PbbzfKRtjtwat1Rw+qUbndmQLBqzfJsm/OoTF59sIpIjzgXMf4b7so1BbogdDvS7PiFi2OszFHF9dQHEVrw4acRVqTA3g1N+IOglvqIzRNynS3PrTrys8JM8x/270nbQ0KFJ6ybP0Pb5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644508560013432.5491585017327; Thu, 10 Feb 2022 07:56:00 -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-392-vCH8RvLJNZ2_jiIGNqayfw-1; Thu, 10 Feb 2022 10:55:57 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A81F185302A; Thu, 10 Feb 2022 15:55:51 +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 2963A753E5; Thu, 10 Feb 2022 15:55:51 +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 DF2D41809CBA; Thu, 10 Feb 2022 15:55:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpcf2011346 for ; Thu, 10 Feb 2022 10:51:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2C04975747; Thu, 10 Feb 2022 15:51:38 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA19275133 for ; Thu, 10 Feb 2022 15:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508559; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AhWxNdk2cb8fj5a7MvCXyswrBHD5AfzfHKg7VJJvYJU=; b=WkMatxf6tqq1ugkOzhzc+Zx2x9RSiskkGpC3fWgxZuiE1q+1sMwfHrUrsrsqOmqw+FTNAE USgGi7D5FRqn3NPojvBoaoesRBop1s6bPv3NQUP19V179AHaY++sMXHKF+LyYyTlbaoJGD r5RL8YzpNlabeMuXVU2FRjfCbkKF8lw= X-MC-Unique: vCH8RvLJNZ2_jiIGNqayfw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/6] ch_driver: Don't lock driver when looking up domains Date: Thu, 10 Feb 2022 16:51:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.11 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508562386100001 Content-Type: text/plain; charset="utf-8" There is no need to lock whole driver when accessing virDomainObjList. Those APIs were specifically tailored to be thread safe (when we were dropping QEMU driver lock). Don't resurrect old history. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_driver.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 7c3b45ca2f..2ed33c3446 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -363,11 +363,9 @@ chDomainUndefine(virDomainPtr dom) =20 static int chDomainIsActive(virDomainPtr dom) { - virCHDriver *driver =3D dom->conn->privateData; virDomainObj *vm; int ret =3D -1; =20 - chDriverLock(driver); if (!(vm =3D virCHDomainObjFromDomain(dom))) goto cleanup; =20 @@ -378,7 +376,6 @@ static int chDomainIsActive(virDomainPtr dom) =20 cleanup: virDomainObjEndAPI(&vm); - chDriverUnlock(driver); return ret; } =20 @@ -636,9 +633,7 @@ static virDomainPtr chDomainLookupByID(virConnectPtr co= nn, virDomainObj *vm; virDomainPtr dom =3D NULL; =20 - chDriverLock(driver); vm =3D virDomainObjListFindByID(driver->domains, id); - chDriverUnlock(driver); =20 if (!vm) { virReportError(VIR_ERR_NO_DOMAIN, @@ -663,9 +658,7 @@ static virDomainPtr chDomainLookupByName(virConnectPtr = conn, virDomainObj *vm; virDomainPtr dom =3D NULL; =20 - chDriverLock(driver); vm =3D virDomainObjListFindByName(driver->domains, name); - chDriverUnlock(driver); =20 if (!vm) { virReportError(VIR_ERR_NO_DOMAIN, @@ -690,9 +683,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr = conn, virDomainObj *vm; virDomainPtr dom =3D NULL; =20 - chDriverLock(driver); vm =3D virDomainObjListFindByUUID(driver->domains, uuid); - chDriverUnlock(driver); =20 if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; --=20 2.34.1 From nobody Wed May 15 23:34:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508716; cv=none; d=zohomail.com; s=zohoarc; b=gx6S2xH2wcLneby3Xay2SAVxUlS/SFilZdUdMud5NnM/1Bd1GGLcG15QbYupdTaoQwR/gWvx8N6coiXeRW/qkukhGcQOe1fTQKJoEY1Eh+GVqgOEIvISQiIGWssZnG88jnRvg1BWjLVyqfnk8/li86hK+nbre96PJUCG6Tr11JQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508716; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+7Q8iorhKGksFkNf2wuUEAwA1GYMcqPtD6cIQSgsX7E=; b=D5aau0TzdDTUYJFvcUpm4ILdxwLIkzGDxvxUdnyhTTEE6jCuuO3X6ITJ8xp7FNlNWknpZUt7n03VcoI5TZfiaIBWYxchl1pkhiXvjarTpo1tMk4VT88wb6KnIc1tlQQZGiKg/3jSUc3KgDFYwTxRQ3XF1L1hJRgtxRWm6fSMRi0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644508716651895.2964276205622; Thu, 10 Feb 2022 07:58:36 -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-44-C7gJlONIOVSypQpUvBciwQ-1; Thu, 10 Feb 2022 10:58:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF34210151E1; Thu, 10 Feb 2022 15:58:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E8652B6E2; Thu, 10 Feb 2022 15:58:25 +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 58FC44A7C8; Thu, 10 Feb 2022 15:58:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpce6011355 for ; Thu, 10 Feb 2022 10:51:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED79475745; Thu, 10 Feb 2022 15:51:38 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7858F75133 for ; Thu, 10 Feb 2022 15:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508715; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+7Q8iorhKGksFkNf2wuUEAwA1GYMcqPtD6cIQSgsX7E=; b=JI8EtV3z1rZUEDx0ZMnB4GFlr2nR97KLgZ1TDdy4iBKuJYkNomNNaGWe56C7NkJ7gFgiKo +2bGXEMVLQC/J/FiPNwXBqZNCgJYwFuAux4Evwm8oQWBZ8leTczILInjHrnA5I8JlQcD0p CLTMITBNJGzvogrJ1PjJvPsadqEqToU= X-MC-Unique: C7gJlONIOVSypQpUvBciwQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/6] chDomainCreateXML: Drop spurious driver unlock Date: Thu, 10 Feb 2022 16:51:31 +0100 Message-Id: <91e21d9b6cb91fdf39f3cba1bf0afe3ea65033ab.1644507592.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.84 on 10.5.11.23 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508718238100001 Content-Type: text/plain; charset="utf-8" Inside chDomainCreateXML(), towards the end, the driver is unlocked even though there is no corresponding driver lock call before that. Drop it. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 2ed33c3446..b023f7e3d3 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -239,7 +239,6 @@ chDomainCreateXML(virConnectPtr conn, virDomainObjListRemove(driver->domains, vm); } virDomainObjEndAPI(&vm); - chDriverUnlock(driver); return dom; } =20 --=20 2.34.1 From nobody Wed May 15 23:34:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508720; cv=none; d=zohomail.com; s=zohoarc; b=ijhnSE8zws980AOIfz3H6cHPho3Btim1KzXkVS9NFeH8vn+r+Lb7KIxkeexxWMrKtxQUmsbWV0GxpMsRL+6WP9fgRvOJXzqgLQOtS+tVvr2cFMsLrKTJlQEkpo60VriSCVWOwGO+To0682cji9cSFI33LjZnw4yReH+vWDEAYpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508720; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0L4jr4cgyeVV0SrUo8/MmzQkSkswAFuaS5ShJchpTSo=; b=KrgVAzB2pC9cXTymVzql6AvblF1zucAoVYZK3M2Xd1wQCG8NWxw5KNfW0tBYUIWqQrhcxu57hPfMbWDlkLKtrzkmEc93fiXt4mQdKQ5hjDNZW1H5C34KXLVw34T0TzWQLCoqjkMKZQPD9SIvuaZCwGuGpWS1+qbpwSgtHpmkwKg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644508720735669.1840390223377; Thu, 10 Feb 2022 07:58:40 -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-568-QXPD1CEvPa69DeZTOs03pA-1; Thu, 10 Feb 2022 10:58:38 -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 7906310151E2; Thu, 10 Feb 2022 15:58:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5388485EEB; Thu, 10 Feb 2022 15:58:32 +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 25FC54A7CB; Thu, 10 Feb 2022 15:58:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpdfT011368 for ; Thu, 10 Feb 2022 10:51:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id BAE6075745; Thu, 10 Feb 2022 15:51:39 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4566775133 for ; Thu, 10 Feb 2022 15:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508719; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0L4jr4cgyeVV0SrUo8/MmzQkSkswAFuaS5ShJchpTSo=; b=G/1HyAoxc6NemkaSjWG3/wwJR1KZT0D6MrYl5nD9Hhl8zL6azolO4qostbJZVPTBmUg8g9 +3NH0LnJILnizOcRb7b3/9GNHjQrI6jE95bCrd1nsd8+As6PmCgsxCGC75YbGh7s74FSku 34PPxg52TFNxgc6yOxSbmQw864k5pcQ= X-MC-Unique: QXPD1CEvPa69DeZTOs03pA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/6] ch_driver: End job properly on failed chDomainCreateXML() Date: Thu, 10 Feb 2022 16:51:32 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508722791100001 Content-Type: text/plain; charset="utf-8" When creating a domain failed, then the virCHDomainObjEndJob() would be jumped over. Fix this by creating enjob label and fixing one goto. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index b023f7e3d3..cd156a222b 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -228,10 +228,11 @@ chDomainCreateXML(virConnectPtr conn, goto cleanup; =20 if (virCHProcessStart(driver, vm, VIR_DOMAIN_RUNNING_BOOTED) < 0) - goto cleanup; + goto endjob; =20 dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); =20 + endjob: virCHDomainObjEndJob(vm); =20 cleanup: --=20 2.34.1 From nobody Wed May 15 23:34:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508479; cv=none; d=zohomail.com; s=zohoarc; b=Sin46MbxmHjwgP8lZxGI6QS/2984+9dkwYbR1gogVCH0ZdDtCOxgM4IOgu0jMjoVqqjCFpIJqGD8gk8ouNAY2AazKvQFHlFVgQKzhy3FND5/bbuH7qFdgUEuI5ki8IK4KZi0PjRvNXUowfBGWTWIJt/6iaM3J2/obLM8S5UtEX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508479; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1GbBvbwOXxoOJZZHBEs9xY1JIqroCbrB9K8ZwddsSrc=; b=lG+OGI74AsCaYbl7XIPuohdRHNKbMUp1vmuwnHd3vM/bePywlA0GXY6kAHSsx8bjTxmTytb11dW+KrCQxwKMROtMzFDDNzzTRz7fJuMGfHoR04faTeI8zv+1OQSnaZgTe4U6qPGtNEyBnR2VBg2jdAVbpxYPEv9nJkvcIYHioIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1644508479387768.0734266085955; Thu, 10 Feb 2022 07:54:39 -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-173-QFgllSxDNv2zMH9kyDFblA-1; Thu, 10 Feb 2022 10:54:36 -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 4C529107B279; Thu, 10 Feb 2022 15:54:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 274DC1062220; Thu, 10 Feb 2022 15:54:31 +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 C961F4CA93; Thu, 10 Feb 2022 15:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpegj011380 for ; Thu, 10 Feb 2022 10:51:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8812E75748; Thu, 10 Feb 2022 15:51:40 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12B8975133 for ; Thu, 10 Feb 2022 15:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508478; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1GbBvbwOXxoOJZZHBEs9xY1JIqroCbrB9K8ZwddsSrc=; b=YJH7BHM8k32QdDqQsSC+ilYRRr3ci6D6YM+xYGGMQeN6fkhe7ghMGc4uoX134GdfxMBVgF 78MlrESDPfwPV0RuBSzU54e4oJkI1mYLRQNWle4vG5/f35omQwMYbJOL3pN7CQehF9Ft+m YGmwIHZiWIAdr1YmdT75xvOyazgwz4Y= X-MC-Unique: QFgllSxDNv2zMH9kyDFblA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/6] ch_driver: Introduce and use virCHDomainRemoveInactive() Date: Thu, 10 Feb 2022 16:51:33 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508480086100001 Content-Type: text/plain; charset="utf-8" There are few places where a call to virDomainObjListRemove() is guarded with !vm->persistent check. And there are some places which are missing this check completely (leading us to losing a domain). To prevent such mistakes introduce virCHDomainRemoveInactive() which does the check for us. Also replace all occurrences of virDomainObjListRemove() with the call to the new function. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_domain.c | 9 +++++++++ src/ch/ch_domain.h | 4 ++++ src/ch/ch_driver.c | 17 +++++++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index 0b4dbbf142..25f581c1c3 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -136,6 +136,15 @@ virCHDomainObjEndJob(virDomainObj *obj) virCondSignal(&priv->job.cond); } =20 +void +virCHDomainRemoveInactive(virCHDriver *driver, + virDomainObj *vm) +{ + if (vm->persistent) { + virDomainObjListRemove(driver->domains, vm); + } +} + static void * virCHDomainObjPrivateAlloc(void *opaque) { diff --git a/src/ch/ch_domain.h b/src/ch/ch_domain.h index c1d3be212e..11a20a874a 100644 --- a/src/ch/ch_domain.h +++ b/src/ch/ch_domain.h @@ -88,6 +88,10 @@ virCHDomainObjBeginJob(virDomainObj *obj, enum virCHDoma= inJob job) void virCHDomainObjEndJob(virDomainObj *obj); =20 +void +virCHDomainRemoveInactive(virCHDriver *driver, + virDomainObj *vm); + int virCHDomainRefreshThreadInfo(virDomainObj *vm); =20 diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index cd156a222b..ef74a00bf7 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -237,7 +237,7 @@ chDomainCreateXML(virConnectPtr conn, =20 cleanup: if (vm && !dom) { - virDomainObjListRemove(driver->domains, vm); + virCHDomainRemoveInactive(driver, vm); } virDomainObjEndAPI(&vm); return dom; @@ -342,10 +342,9 @@ chDomainUndefineFlags(virDomainPtr dom, goto cleanup; } =20 - if (virDomainObjIsActive(vm)) { - vm->persistent =3D 0; - } else { - virDomainObjListRemove(driver->domains, vm); + vm->persistent =3D 0; + if (!virDomainObjIsActive(vm)) { + virCHDomainRemoveInactive(driver, vm); } =20 ret =3D 0; @@ -608,12 +607,14 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int f= lags) if (virDomainObjCheckActive(vm) < 0) goto endjob; =20 - ret =3D virCHProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); + if (virCHProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED) < 0) + goto endjob; + + virCHDomainRemoveInactive(driver, vm); + ret =3D 0; =20 endjob: virCHDomainObjEndJob(vm); - if (!vm->persistent) - virDomainObjListRemove(driver->domains, vm); =20 cleanup: virDomainObjEndAPI(&vm); --=20 2.34.1 From nobody Wed May 15 23:34:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644508725; cv=none; d=zohomail.com; s=zohoarc; b=B8d4k3305rAdjoDAaZZaL2cfIlqxaqJf3bYZOMIsG7ZoL7nYr0m8xfQu9LqkrDPCD+uMemNcH354gSLbmcXAYct4P78m2+LMW8n8BtT++psVuD69lV97He5GKFDlmstzaQAiSF20q8VboPlbNNCdMX9zJKbSutmndHbW/pRZ8jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644508725; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NNa/45Z+Olf4Mf1Jk7i92sGPJlmqzlIBxqP41EkApXA=; b=XhCx5iT4RxlX0OHMlaGWGc5mhWqLrAv7qozL9fKEHP39E1HEphZkZroM7mROeM8pYyCPO2NRHSimhYBjhWEV5/6aqOGgG77r0u9EMEHs2mv45dQuGgsGDvqPsfB54Au/6N+RedU4rKePBt0ybed9WlOQtb3+2bp0ZLW60zAqv7M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644508725482249.00076598872727; Thu, 10 Feb 2022 07:58:45 -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-644--nc_rRzlNIOo41lT454DEw-1; Thu, 10 Feb 2022 10:58:41 -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 EE47F100C628; Thu, 10 Feb 2022 15:58:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFF22106222E; Thu, 10 Feb 2022 15:58:34 +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 A21D94A7CD; Thu, 10 Feb 2022 15:58:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21AFpf6T011396 for ; Thu, 10 Feb 2022 10:51:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 570D175133; Thu, 10 Feb 2022 15:51:41 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id D505175745 for ; Thu, 10 Feb 2022 15:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644508725; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NNa/45Z+Olf4Mf1Jk7i92sGPJlmqzlIBxqP41EkApXA=; b=Bb/acYgLD+hcHpb8bgl8PJKGLllXS7/GJw2fCLXlhizItxA2/aJ/49LQlXH1VzY7usvsbO wEtC24ohkmksj3M1Jk5m1vt/NpbTku+S2e2aYnbAPgh9aKED/RIA47coMuPPOXd3h1L8UC D+8FULEG9e9vs5tK/JNFE/PZfg7NRPI= X-MC-Unique: -nc_rRzlNIOo41lT454DEw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/6] ch_process: Check whether domain is already running before starting it Date: Thu, 10 Feb 2022 16:51:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@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.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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644508727470100001 Content-Type: text/plain; charset="utf-8" There are two places where a domain can be started in CH driver: chDomainCreateXML() and chDomainCreateWithFlags(). Both acquire a job (good), but neither of them checks whether the domain isn't already running. This is wrong. Fortunately, both function call the very same virCHProcessStart() rendering it the best place for such check. Signed-off-by: Michal Privoznik Reviewed-by: Tim Wiederhake --- src/ch/ch_process.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 6d9a286e8a..00d94ddcbe 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -470,6 +470,12 @@ virCHProcessStart(virCHDriver *driver, g_autofree int *nicindexes =3D NULL; size_t nnicindexes =3D 0; =20 + if (virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("VM is already active")); + return -1; + } + if (!priv->monitor) { /* And we can get the first monitor connection now too */ if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm))) { --=20 2.34.1