From nobody Wed May 1 23:50:15 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=1642679194; cv=none; d=zohomail.com; s=zohoarc; b=nhxlrWqj8DuzgMeH1mejJUudKmvIpcduu/ouCGL4tZXiG+AHKf9abBr6SrkZshtbIsqOXvWj6ikDGqljUS/jFaT85jLcasSZga4ejqKH9yu+wp13+n7rVR1AsV0H6x8YU+akDN5WThr/s6X3i9ov2kKiRNYKpu5k8ek6OCqhuHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642679194; 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=Z5zI72ZU1x73V4szXQPIvhuc1E2ru76xYzPCrlgdTbE=; b=OXsMbT8AD+gzGGuZv5QFWAq5MTI9r8N2WLePrICsHy6qs1a1tKupio2KanO2FAGxAsPN+V6HTA1gfOC3rRV7FdWrvnWg9i+wneylJcoM19nWBxH8MUbGNSVB3t+ihRqaAheu6ghcRuu+Y0xpnYchiNw42Knzj56vEbSAEceGIt0= 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 164267919429629.863006315890175; Thu, 20 Jan 2022 03:46:34 -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-52-f-aUdm6RNo-liDSk2lw24w-1; Thu, 20 Jan 2022 06:46:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BABBB86A8B5; Thu, 20 Jan 2022 11:46:24 +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 9A31E7CD6F; Thu, 20 Jan 2022 11:46:24 +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 66B7E4A7C8; Thu, 20 Jan 2022 11:46:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KBkDgi030249 for ; Thu, 20 Jan 2022 06:46:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 27C7A108F831; Thu, 20 Jan 2022 11:46:13 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89CC5108BEF4 for ; Thu, 20 Jan 2022 11:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642679193; 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=Z5zI72ZU1x73V4szXQPIvhuc1E2ru76xYzPCrlgdTbE=; b=MwhORqMfU3G0qsZSPosSsw0bHsTfBHzQqXqmT+veWr1AKLeX8jK02Jxd4aXTS1euS0sbC4 2In3TKpKCulmxbXUNR3JLEQrXeWydKNo/8xaMzWiN5D5yO9CwIH4ZVEF914xklgSMidTWc t6Yechlpx7codIXwCex3NuTeTe6gVNA= X-MC-Unique: f-aUdm6RNo-liDSk2lw24w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/5] storage: Add debug logs for storage pool config loading Date: Thu, 20 Jan 2022 12:45:54 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 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: 1642679196226100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 4 ++++ src/storage/storage_driver.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 02903ac487..815ada8584 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1614,6 +1614,8 @@ virStoragePoolObjLoad(virStoragePoolObjList *pools, virStoragePoolObj *obj; g_autoptr(virStoragePoolDef) def =3D NULL; + VIR_DEBUG("loading storage pool config XML '%s'", path); + if (!(def =3D virStoragePoolDefParseFile(path))) return NULL; @@ -1655,6 +1657,8 @@ virStoragePoolObjLoadState(virStoragePoolObjList *poo= ls, if (!(stateFile =3D virFileBuildPath(stateDir, name, ".xml"))) return NULL; + VIR_DEBUG("loading storage pool state XML '%s'", stateFile); + if (!(xml =3D virXMLParseCtxt(stateFile, NULL, _("(pool state)"), &ctx= t))) return NULL; diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 4df2c75a2b..8dfa2497fc 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -156,6 +156,8 @@ storagePoolUpdateStateCallback(virStoragePoolObj *obj, active =3D false; } + VIR_DEBUG("updating state of storage pool '%s' active=3D%d", def->name= , active); + /* We can pass NULL as connection, most backends do not use * it anyway, but if they do and fail, we want to log error and * continue with other pools. --=20 2.34.1 From nobody Wed May 1 23:50:15 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=1642679195; cv=none; d=zohomail.com; s=zohoarc; b=b+Mz0qeqYUo9aC3BiaE8Ymblc1lC2uYiNiWWLOjYOwB/IhHAxPUI9CuOEQ+5GTU3UZVW3ewjBv9yuORLxZQ66Y2SfkGWBG4W+0jyXmTPj3oQz8gYVcifELeqd4aha3blDu0Aqao4VH1hnsEGTc2PnZw6xXQa0FU2eLCw37pzOLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642679195; 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=63z8IL860SpZu15cm5hpvPI16WBsrQUluwrMQlDaHdA=; b=KCKwSqiv7I8fnxFxw39LDhOo4iTEJGyivgC6Tov5nHB8/LAlWJuKY3Ir9DWTY8HIqP4quIJ/YBRJgnAvP3DpebEmA12BrqI1GCObzcvD9Dm5KuqI+tDUZ0jsdbz3LgH6AdvShQGVltoRvxpm9lppmlBORngQ0k7WNFsL7SJgPoA= 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 1642679195691847.8868919514935; Thu, 20 Jan 2022 03:46:35 -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-104-y16v299wNT-0Mr12eXlTIQ-1; Thu, 20 Jan 2022 06:46:33 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A0871091DB8; Thu, 20 Jan 2022 11:46: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 E93097D4A3; Thu, 20 Jan 2022 11:46:27 +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 AB2D41809CB9; Thu, 20 Jan 2022 11:46:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KBkExF030283 for ; Thu, 20 Jan 2022 06:46:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2CD1B108F831; Thu, 20 Jan 2022 11:46:14 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8617B108BEF4 for ; Thu, 20 Jan 2022 11:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642679194; 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=63z8IL860SpZu15cm5hpvPI16WBsrQUluwrMQlDaHdA=; b=BipQeMcqMrPTM4sAogxOfk1wyhhVexDymZuzb9ttstOAD84SuWHAYmR/GNz+as/uYE4n7P DS/OUNSOcyrKGa2xt+XCA8vbc83DFs3jGAbwA1hdtzjbEW1a0gx2frBcs3T1RQHEe/pfs2 FvxA7vuLXDLjo6FFuz+ez0apeuuU2kg= X-MC-Unique: y16v299wNT-0Mr12eXlTIQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/5] virStoragePoolObjLoadAllConfigs: Use automatic memory clearing Date: Thu, 20 Jan 2022 12:45:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 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: 1642679196587100003 Content-Type: text/plain; charset="utf-8" Refactor the inner loop to automatically free temporary variables and remove unreachable error paths. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 815ada8584..4081e12823 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1736,27 +1736,15 @@ virStoragePoolObjLoadAllConfigs(virStoragePoolObjLi= st *pools, return rc; while ((ret =3D virDirRead(dir, &entry, configDir)) > 0) { - char *path; - char *autostartLink; + g_autofree char *path =3D virFileBuildPath(configDir, entry->d_nam= e, NULL); + g_autofree char *autostartLink =3D virFileBuildPath(autostartDir, = entry->d_name, NULL); virStoragePoolObj *obj; if (!virStringHasSuffix(entry->d_name, ".xml")) continue; - if (!(path =3D virFileBuildPath(configDir, entry->d_name, NULL))) - continue; - - if (!(autostartLink =3D virFileBuildPath(autostartDir, entry->d_na= me, - NULL))) { - VIR_FREE(path); - continue; - } - obj =3D virStoragePoolObjLoad(pools, entry->d_name, path, autostar= tLink); virStoragePoolObjEndAPI(&obj); - - VIR_FREE(path); - VIR_FREE(autostartLink); } return ret; --=20 2.34.1 From nobody Wed May 1 23:50:15 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=1642679200; cv=none; d=zohomail.com; s=zohoarc; b=fZNNvVnR0ow1FYy968/ZsdDKvvfZcGdbNy0sjO14AtijRqCq+fvHIDZLPH6Cbe+l/7A9vzdEuYjkQHVQQv/+bEpuMt7Emq37A19Q5r2PY4T6qo/Cc0DBrUnwV6La8aC6Pt9Og8uKDTPh0wdfSzVuamewjv8j2QQbkThkYS9/KGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642679200; 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=0Y5AMcotHSPwARh5BcizO8Alq7cgzXMGZIgB7zFkP4A=; b=D+dLjNj2cwiJjstirMPgvaj5FN+YjxfuUQfwRzDsz8q3BMk0ukiPC0wKrtt9J8HOd3+U6Bmd21MPMdjn8hTP7sjvgWEdzQtqIbHS9ZknsnNELMntHaPrMJPCyvsNS2WPyKD5GiAI7w5pQ0xINFAbeqMrFiFnBITrJqZoJ7hHUPE= 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 1642679200354215.57332262533657; Thu, 20 Jan 2022 03:46: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-101-NOFSiYMDNPKOVW1F8-VwyA-1; Thu, 20 Jan 2022 06:46:36 -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 DA1FB86A8C9; Thu, 20 Jan 2022 11:46:30 +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 B38AE7AB64; Thu, 20 Jan 2022 11:46:30 +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 7B8E64A7C8; Thu, 20 Jan 2022 11:46:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KBkFLv030301 for ; Thu, 20 Jan 2022 06:46:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3C809108F831; Thu, 20 Jan 2022 11:46:15 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B277108BEF4 for ; Thu, 20 Jan 2022 11:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642679199; 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=0Y5AMcotHSPwARh5BcizO8Alq7cgzXMGZIgB7zFkP4A=; b=DIGR8IWp01XlteBvHJTwsQUeDE/eGee7reKfr2sRxRUCkmjaNiaBdGltAjoccATgQfxvt7 XTiYmCTBxqtasZ/GHn9Jo/U34oRcfxATqOOhyZC/gEFcSdblJBNGWMACL0a7Da6pMHmkEF CaU/XMNSszFF6APa76DChO0bG5JJ0w0= X-MC-Unique: NOFSiYMDNPKOVW1F8-VwyA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] storageDriverAutostartCallback: Refactor control flow Date: Thu, 20 Jan 2022 12:45:56 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1642679201539100001 Content-Type: text/plain; charset="utf-8" Use early returns to decrease the indentation level and make it more obvious that the 'cleanup' path is a noop in those cases. 'virStoragePoolObjSetStarting' was called only when the code wanted to start the pool, so if that was skipped, cleanup is noop as it's conditional on the return value of 'virStoragePoolObjIsStarting'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_driver.c | 49 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8dfa2497fc..97e0d9b3a0 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -194,38 +194,39 @@ storageDriverAutostartCallback(virStoragePoolObj *obj, { virStoragePoolDef *def =3D virStoragePoolObjGetDef(obj); virStorageBackend *backend; - bool started =3D false; + g_autofree char *stateFile =3D NULL; if (!(backend =3D virStorageBackendForType(def->type))) return; - if (virStoragePoolObjIsAutostart(obj) && - !virStoragePoolObjIsActive(obj)) { + if (!virStoragePoolObjIsAutostart(obj)) + return; - virStoragePoolObjSetStarting(obj, true); - if (backend->startPool && - backend->startPool(obj) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to autostart storage pool '%s': %s"), - def->name, virGetLastErrorMessage()); - goto cleanup; - } - started =3D true; + if (virStoragePoolObjIsActive(obj)) + return; + + VIR_DEBUG("autostarting storage pool '%s'", def->name); + + virStoragePoolObjSetStarting(obj, true); + + if (backend->startPool && + backend->startPool(obj) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to autostart storage pool '%s': %s"), + def->name, virGetLastErrorMessage()); + goto cleanup; } - if (started) { - g_autofree char *stateFile =3D NULL; + stateFile =3D virFileBuildPath(driver->stateDir, def->name, ".xml"); - stateFile =3D virFileBuildPath(driver->stateDir, def->name, ".xml"= ); - if (!stateFile || - virStoragePoolSaveState(stateFile, def) < 0 || - storagePoolRefreshImpl(backend, obj, stateFile) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to autostart storage pool '%s': %s"), - def->name, virGetLastErrorMessage()); - } else { - virStoragePoolObjSetActive(obj, true); - } + if (!stateFile || + virStoragePoolSaveState(stateFile, def) < 0 || + storagePoolRefreshImpl(backend, obj, stateFile) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to autostart storage pool '%s': %s"), + def->name, virGetLastErrorMessage()); + } else { + virStoragePoolObjSetActive(obj, true); } cleanup: --=20 2.34.1 From nobody Wed May 1 23:50:15 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=1642679189; cv=none; d=zohomail.com; s=zohoarc; b=n8ufX9DYKDDcVdfR83aK48ayNTY+870DAAPEEwBHc3rKdeLBDCgG18IVI4f3wAMaTxgvz00bITAg6UoJ72g3WJrVM1pkFIeqW9Fu8PR/mIuFdHPGtMiGje1gH6hk+uZHYdeYZUvJTpBPbDZKcDpreiJBkfGDFXB8fkpaiF7OP+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642679189; 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=wdSkFWve+hMxQVwRHo1fmqy3m2+AemBBtAtLVJrCTt8=; b=ghE2rv3p2ZgTH1Ew49kxpqUxsG8bT+T88RelP6voIHRs923yDvFpdFLlb0WLsOCNk25Bn4QC3dVzomzX/pQBLw95eR/MD4rD2Sc7yZICnzd1PSm6MfhUvhhirKWFoMta+FKWLl6k9tYwv/6R14VmhMhMAauHR+AeVwf8NQlpghc= 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 1642679189900618.112310451739; Thu, 20 Jan 2022 03:46:29 -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-634-4X2ywB4LMOSNhORbzefPWQ-1; Thu, 20 Jan 2022 06:46:25 -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 05BDA8519E1; Thu, 20 Jan 2022 11:46:19 +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 D3F8D7AB65; Thu, 20 Jan 2022 11:46:18 +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 389524BB7C; Thu, 20 Jan 2022 11:46:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KBkG1U030352 for ; Thu, 20 Jan 2022 06:46:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4D094108F833; Thu, 20 Jan 2022 11:46:16 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CB65108BEF4 for ; Thu, 20 Jan 2022 11:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642679188; 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=wdSkFWve+hMxQVwRHo1fmqy3m2+AemBBtAtLVJrCTt8=; b=UN2o1ovguMxzbuPPLshTgmm+JT/KwH/7ciH/oHizmrDpyJ2Filyxlk8Z+69x7EhOGhxoW0 FjGFutvOfS//8OZzYrO/IMORzEITSTk14tU06xbn0FLwSiKGTuRb/fijXTUaIytPSEtyB4 dSlyovZlOnJzYLXCdc6+mJWJUrjxOxM= X-MC-Unique: 4X2ywB4LMOSNhORbzefPWQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/5] virStoragePoolObjSourceFindDuplicateCb: Fix handling of VIR_STORAGE_POOL_ISCSI_DIRECT Date: Thu, 20 Jan 2022 12:45:57 +0100 Message-Id: <5426d1a6e9ad43d94b5b6bf93643411ef184fe59.1642679117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1642679191509100001 Content-Type: text/plain; charset="utf-8" The direct SCSI pool doesn't expose the volumes in the host attempting to match it using 'virStoragePoolObjSourceMatchTypeDEVICE' which in turn uses 'virStoragePoolSourceFindDuplicateDevices' doesn't make sense. Remove it from the source matching completely as we can open multiple connections to the target. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 4081e12823..58c86e8b1b 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1447,13 +1447,11 @@ virStoragePoolObjSourceFindDuplicateCb(const void *= payload, break; case VIR_STORAGE_POOL_ISCSI: - case VIR_STORAGE_POOL_ISCSI_DIRECT: case VIR_STORAGE_POOL_FS: case VIR_STORAGE_POOL_LOGICAL: case VIR_STORAGE_POOL_DISK: case VIR_STORAGE_POOL_ZFS: if ((data->def->type =3D=3D VIR_STORAGE_POOL_ISCSI || - data->def->type =3D=3D VIR_STORAGE_POOL_ISCSI_DIRECT || data->def->type =3D=3D VIR_STORAGE_POOL_FS || data->def->type =3D=3D VIR_STORAGE_POOL_LOGICAL || data->def->type =3D=3D VIR_STORAGE_POOL_DISK || @@ -1481,6 +1479,7 @@ virStoragePoolObjSourceFindDuplicateCb(const void *pa= yload, return 1; break; + case VIR_STORAGE_POOL_ISCSI_DIRECT: case VIR_STORAGE_POOL_RBD: case VIR_STORAGE_POOL_LAST: break; --=20 2.34.1 From nobody Wed May 1 23:50:15 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=1642679204; cv=none; d=zohomail.com; s=zohoarc; b=fDZi3ADFrrHZ3FpgDxEtpRgaPVp7oAEXDNWOF4GZY3E4GcszUaauQpXeUK7mSKXmQwuQ926cI4ysERXYEofmqCFTE8CW08Y9PuqhHdIhaKe6rQa4zO/Zze50iixN5aeYBIWP1nTEBSbvvlEaC2x12MZ8rC/7SPH2o6JtiDjXux8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642679204; 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=6cvjSQgByOkAw1q87kgbH0ieJoHplzwyOxcu3jCRfno=; b=FmKVmzi2IZKTf/i4HLpwK+1WV0A6b3UALhq7Zi9xb9GTmkrw5kZZbm++JHpOhkrLPosOA9Jlclef4meBSMX/EVIvgVgnYT09osaCXPlhrSRcsGaAxE78n3htG1iCedlnSRiJxIKJjm7uEaVAllK9sy9KohcZGCqegUqde1uk00M= 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 1642679204088391.5935658941572; Thu, 20 Jan 2022 03:46:44 -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-457-S3m7w3HpMH2m6a-qc0Vl1A-1; Thu, 20 Jan 2022 06:46:39 -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 46C9C86A8AF; Thu, 20 Jan 2022 11:46:34 +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 209027AB65; Thu, 20 Jan 2022 11:46: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 E2EBE1809CBA; Thu, 20 Jan 2022 11:46:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KBkHLP030388 for ; Thu, 20 Jan 2022 06:46:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 56AC6108F833; Thu, 20 Jan 2022 11:46:17 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB02C108BEF4 for ; Thu, 20 Jan 2022 11:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642679203; 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=6cvjSQgByOkAw1q87kgbH0ieJoHplzwyOxcu3jCRfno=; b=Sxr8mob6U+++NVJ4+Hqmn2ufbXRPaa+9LqsQVBLMHT0yPctmT/WOTpcUVElOekB/2+gnVv L5GE2sfTmEWcLCtuEFmOItfUIufDroedqd9u2c2KKD03C6JHW8ooiz3Ykzyd7xM5k66wF0 5gx0q/qxrEEdvy6vRojz3DXCoPyLj7I= X-MC-Unique: S3m7w3HpMH2m6a-qc0Vl1A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] storage: Implement 'checkPool' method for 'disk' type pools Date: Thu, 20 Jan 2022 12:45:58 +0100 Message-Id: <1c3069cd9b13835e5bfe3cb466e0f465007491ea.1642679117.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1642679206079100001 Content-Type: text/plain; charset="utf-8" If 'checkPool' is not implemented, the pool will be made inactive when restarting libvirtd and subsequently re-loading the state from the pool state XML. Base the 'checkPool' implementation on logic similar to 'startPool'. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1910856 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_backend_disk.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backe= nd_disk.c index be8a535570..bf867491d0 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -476,6 +476,32 @@ virStorageBackendDiskStartPool(virStoragePoolObj *pool) } +static int +virStorageBackendDiskCheckPool(virStoragePoolObj *pool, + bool *isActive) +{ + virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); + const char *path =3D def->source.devices[0].path; + + *isActive =3D false; + + if (!virFileExists(path)) + return 0; + + if (def->source.format =3D=3D VIR_STORAGE_POOL_DISK_UNKNOWN) + def->source.format =3D VIR_STORAGE_POOL_DISK_DOS; + + if (!virStorageBackendDeviceIsEmpty(path, + virStoragePoolFormatDiskTypeToStri= ng(def->source.format), + false)) + return -1; + + *isActive =3D true; + + return 0; +} + + /** * Write a new partition table header */ @@ -973,6 +999,7 @@ virStorageBackend virStorageBackendDisk =3D { .buildPool =3D virStorageBackendDiskBuildPool, .refreshPool =3D virStorageBackendDiskRefreshPool, .deletePool =3D virStorageBackendDiskDeletePool, + .checkPool =3D virStorageBackendDiskCheckPool, .createVol =3D virStorageBackendDiskCreateVol, .deleteVol =3D virStorageBackendDiskDeleteVol, --=20 2.34.1