From nobody Sat May 18 21:16:12 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 ARC-Seal: i=1; a=rsa-sha256; t=1662431375; cv=none; d=zohomail.com; s=zohoarc; b=P4+OM2nAt7w2cnzDW2JgitRahJrjIhkxfUVUwBEajdspJAf6NR7GAIRPj17TUWMqWgcoAsDyV2Adq4NQ4fK3m1Wv6D5grIJUmCxNvIRQeJsUhNxhDRmnyU+fhBodA5/PdlKxqFK1uFAco7n4MQmUodzI5HRuSCh6ocLHcpVFxDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662431375; 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=lF94rSZ7TuYto0ARKY54cQ4wr5JrzIV8fkmUhguZTjI=; b=CcUwBW8IXwqx6k3roWYfm2PJdIfiFE1632fUFP4+boLuGr8ZWHHUO5G60rHonA1sjEIv2bJ4hf0ywghtCVj5aO39qaDDsNPt0fXVgJ1hgID/OJoUxHuuB3IGm6j0PvrQQvhqWjoPcdxCE1TKb8OoXJkaA+cfo5YnUvn6DI1+E7w= 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 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 1662431374506248.20433944358297; Mon, 5 Sep 2022 19:29:34 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-5WdELViPP2W6w1Lfu7MbZA-1; Mon, 05 Sep 2022 22:29:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06AA5101E168; Tue, 6 Sep 2022 02:29:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 572522166B26; Tue, 6 Sep 2022 02:29:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 36FB31946A48; Tue, 6 Sep 2022 02:29:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 61FCD1946A47 for ; Tue, 6 Sep 2022 02:29:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4C8C4C15BBD; Tue, 6 Sep 2022 02:29:25 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48C3EC15BB3 for ; Tue, 6 Sep 2022 02:29:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2CC8C85A58B for ; Tue, 6 Sep 2022 02:29:25 +0000 (UTC) Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.226]) by relay.mimecast.com with ESMTP id us-mta-203-3kKjgr98PSO7Iz6tr9cCmQ-1; Mon, 05 Sep 2022 22:29:22 -0400 Received: from clientip-171.223.99.60 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 0574A2800BA; Tue, 6 Sep 2022 10:29:12 +0800 (CST) Received: from ([172.18.0.218]) by app0025 with ESMTP id 1934fa2969fb4e8493cece4fca353d49 for libvir-list@redhat.com; Tue, 06 Sep 2022 10:29:19 CST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662431373; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lF94rSZ7TuYto0ARKY54cQ4wr5JrzIV8fkmUhguZTjI=; b=ijg3UatFWbbDOviwQ2pVaz0gIXFeNfad2r8R/0hQz5S8Bl3iVOcBrzSiadPQWUljVKQzPk qhUzKti/isg1/yQynNxZKQjhohyVLRaH9CDwntXwSqiUlcXuL9V/Bua2CtEKPu7dPIHbOW UvccfHYkXmsbxOvPGMr3KyzK2TAdoSw= X-MC-Unique: 5WdELViPP2W6w1Lfu7MbZA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 3kKjgr98PSO7Iz6tr9cCmQ-1 HMM_SOURCE_IP: 172.18.0.218:47764.1663359688 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn X-Transaction-ID: 1934fa2969fb4e8493cece4fca353d49 X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: Subject: [PATCH] qemu: Don't report error from domblkinfo if vm is inactive Date: Tue, 6 Sep 2022 10:29:01 +0800 Message-Id: <4445ece79b3e3501668093d8840234266a7e7980.1662399012.git.huangy81@chinatelecom.cn> MIME-Version: 1.0 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.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tugy@chinatelecom.cn, yangchg@chinatelecom.cn, huangy81@chinatelecom.cn, yuanmh12@chinatelecom.cn, dengpc12@chinatelecom.cn, zhoupx@chinatelecom.cn, baiyw2@chinatelecom.cn, liuym16@chinatelecom.cn Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: 1662431377600100001 Content-Type: text/plain; charset="utf-8" From: Hyman Huang(=E9=BB=84=E5=8B=87) Libvirt logs and reports error when executing domblkinfo if vm configured rbd storage and in inactive state. The steps to reproduce the problem: 1. define and start domain with its storage configured rbd disk, and corresponding disk label is 'vda'. 2. set vm in inactive state. 3. call 'virsh domblklinfo' as the following and problem reproduced. $ virsh domblkinfo vm1 vda error: internal error: missing storage backend for network files using rbd protocol Meanwhile, libvirtd log message also report the same error. To fix this, validate the disk type if vm is inactive before refreshing capacity and allocation limits of a given storage source in qemuDomainGetBlockInfo in advance, if storage source type is VIR_STORAGE_TYPE_NETWORK and net protocol is VIR_STORAGE_NET_PROTOCAOL_RBD, set info to 0 like 'domblkinfo --all' command does and return directly. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1724808 Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Signed-off-by: Pengcheng Deng --- src/qemu/qemu_driver.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c7cca64..bfe1fa2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11118,6 +11118,19 @@ qemuDomainGetBlockInfo(virDomainPtr dom, =20 /* for inactive domains we have to peek into the files */ if (!virDomainObjIsActive(vm)) { + /* for rbd protocol, virStorageFileBackend not loaded if vm is ina= ctive, + * so generate 0 based info like 'domblkinfo --all' does and retur= n directly + * */ + if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TY= PE_NETWORK && + disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD) { + info->capacity =3D 0; + info->allocation =3D 0; + info->physical =3D 0; + + ret =3D 0; + goto endjob; + } + if ((qemuStorageLimitsRefresh(driver, cfg, vm, disk->src, false)) = < 0) goto endjob; =20 --=20 1.8.3.1