From nobody Mon Feb 9 17:58:25 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578699217; cv=none; d=zohomail.com; s=zohoarc; b=C75WByHvU1zvkdLMpgjkNWyyv0tw2PHu7hmXl+Dx3wWQomwz6qPmrRC4CPTSBPQX7gfE3HO1OlVIQXO9TRNbcP2ivj05EUUSd+1yN4Z+Z0R3OciJ8BaEIe2dgwQWQAYccGTss5cefuzzuCjThwX18rlrHai1mFgVHSAHnyIe/AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578699217; h=Content-Type:Content-Transfer-Encoding:Cc: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=8Tjx5kG+pqAhATmaOtPOD379wPogvbpYlg/HrmSnDC4=; b=VSOnsv/SAIafJWZgnlezK+VEVwbdPva3NDqfpUWRmYKGJyon+k6ePh8FCpe8oQXWVLBAwGPcq55XgptyNdSQet8/9sd9ihGogMmpvOf7FCBa7acFZaAiEATewDg2fGhEbFMRv/OrUMfqHGhxKkKsnfVyLKRfrGiL3V3/HGUCXVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1578699217408846.4076480860894; Fri, 10 Jan 2020 15:33:37 -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-162-kmc30sRGO-ifrg8UqyDrPQ-1; Fri, 10 Jan 2020 18:33:34 -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 649508024D5; Fri, 10 Jan 2020 23:33:29 +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 33D631001B00; Fri, 10 Jan 2020 23:33:29 +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 819D518089CD; Fri, 10 Jan 2020 23:33:28 +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 00ANWM6e018732 for ; Fri, 10 Jan 2020 18:32:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id C98787C409; Fri, 10 Jan 2020 23:32:22 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-214.phx2.redhat.com [10.3.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84B695D72B; Fri, 10 Jan 2020 23:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578699216; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8Tjx5kG+pqAhATmaOtPOD379wPogvbpYlg/HrmSnDC4=; b=eDXAg5fhk1gNh5m1eLjTTQRfg2KtMADGaEqPBqtoqlIb5EFefk26dc7er+qeoRE2f3xu8K 6+Gcjv4M0zbin/W1/ivD3oPe9YUemGmqonKGFueQ3WVGmKrFi+rrUB9hzknBP9IzvHao5P ew/KK7Bjlkoi93vIXLah9UWjMPpvoDo= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 10 Jan 2020 17:32:12 -0600 Message-Id: <20200110233217.18770-4-jjongsma@redhat.com> In-Reply-To: <20200110233217.18770-1-jjongsma@redhat.com> References: <20200110233217.18770-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com Subject: [libvirt] [PATCH v2 3/8] qemu: Don't store disk alias in qemuAgentDiskInfo 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 X-MC-Unique: kmc30sRGO-ifrg8UqyDrPQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The qemuAgentDiskInfo structure is filled with information received from the agent command response, except for the 'alias' field, which is retrieved from the vm definition. Limit this structure only to data that was received from the agent message. This is another intermediate step in moving the responsibility for searching the vmdef from qemu_agent.c to qemu_driver.c so that we can avoid holding an agent job and a normal job at the same time. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_agent.c | 63 ++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index fa55ff0a57..b250077f0a 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1851,7 +1851,6 @@ qemuAgentSetTime(qemuAgentPtr mon, typedef struct _qemuAgentDiskInfo qemuAgentDiskInfo; typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr; struct _qemuAgentDiskInfo { - char *alias; char *serial; virPCIDeviceAddress pci_controller; char *bus_type; @@ -1880,7 +1879,6 @@ qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info) return; =20 VIR_FREE(info->serial); - VIR_FREE(info->alias); VIR_FREE(info->bus_type); VIR_FREE(info->devnode); VIR_FREE(info); @@ -1906,10 +1904,12 @@ qemuAgentFSInfoFree(qemuAgentFSInfoPtr info) } =20 static virDomainFSInfoPtr -qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent) +qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent, + virDomainDefPtr vmdef) { virDomainFSInfoPtr ret =3D NULL; size_t i; + virDomainDiskDefPtr diskDef; =20 if (VIR_ALLOC(ret) < 0) goto error; @@ -1924,8 +1924,17 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent) =20 ret->ndevAlias =3D agent->ndisks; =20 - for (i =3D 0; i < ret->ndevAlias; i++) - ret->devAlias[i] =3D g_strdup(agent->disks[i]->alias); + for (i =3D 0; i < ret->ndevAlias; i++) { + qemuAgentDiskInfoPtr agentdisk =3D agent->disks[i]; + if (!(diskDef =3D virDomainDiskByAddress(vmdef, + &agentdisk->pci_controller, + agentdisk->bus, + agentdisk->target, + agentdisk->unit))) + continue; + + ret->devAlias[i] =3D g_strdup(diskDef->dst); + } =20 return ret; =20 @@ -1936,8 +1945,7 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent) =20 static int qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, - qemuAgentFSInfoPtr fsinfo, - virDomainDefPtr vmdef) + qemuAgentFSInfoPtr fsinfo) { size_t ndisks; size_t i; @@ -1960,7 +1968,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, virJSONValuePtr jsondisk =3D virJSONValueArrayGet(jsondisks, i); virJSONValuePtr pci; qemuAgentDiskInfoPtr disk; - virDomainDiskDefPtr diskDef; const char *val; =20 if (!jsondisk) { @@ -2011,14 +2018,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisk= s, GET_DISK_ADDR(pci, &disk->pci_controller.function, "function"); =20 #undef GET_DISK_ADDR - if (!(diskDef =3D virDomainDiskByAddress(vmdef, - &disk->pci_controller, - disk->bus, - disk->target, - disk->unit))) - continue; - - disk->alias =3D g_strdup(diskDef->dst); } =20 return 0; @@ -2030,8 +2029,7 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, */ static int qemuAgentGetFSInfoInternal(qemuAgentPtr mon, - qemuAgentFSInfoPtr **info, - virDomainDefPtr vmdef) + qemuAgentFSInfoPtr **info) { size_t i; int ret =3D -1; @@ -2147,7 +2145,7 @@ qemuAgentGetFSInfoInternal(qemuAgentPtr mon, goto cleanup; } =20 - if (qemuAgentGetFSInfoFillDisks(disk, info_ret[i], vmdef) < 0) + if (qemuAgentGetFSInfoFillDisks(disk, info_ret[i]) < 0) goto cleanup; } =20 @@ -2177,14 +2175,14 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, size_t i; int nfs; =20 - nfs =3D qemuAgentGetFSInfoInternal(mon, &agentinfo, vmdef); + nfs =3D qemuAgentGetFSInfoInternal(mon, &agentinfo); if (nfs < 0) return ret; if (VIR_ALLOC_N(info_ret, nfs) < 0) goto cleanup; =20 for (i =3D 0; i < nfs; i++) { - if (!(info_ret[i] =3D qemuAgentFSInfoToPublic(agentinfo[i]))) + if (!(info_ret[i] =3D qemuAgentFSInfoToPublic(agentinfo[i], vmdef)= )) goto cleanup; } =20 @@ -2219,7 +2217,7 @@ qemuAgentGetFSInfoParams(qemuAgentPtr mon, size_t i, j; int nfs; =20 - if ((nfs =3D qemuAgentGetFSInfoInternal(mon, &fsinfo, vmdef)) < 0) + if ((nfs =3D qemuAgentGetFSInfoInternal(mon, &fsinfo)) < 0) return nfs; =20 if (virTypedParamsAddUInt(params, nparams, maxparams, @@ -2266,13 +2264,22 @@ qemuAgentGetFSInfoParams(qemuAgentPtr mon, param_name, fsinfo[i]->ndisks) < 0) goto cleanup; for (j =3D 0; j < fsinfo[i]->ndisks; j++) { + virDomainDiskDefPtr diskdef =3D NULL; qemuAgentDiskInfoPtr d =3D fsinfo[i]->disks[j]; - g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, - "fs.%zu.disk.%zu.alias", i, j); - if (d->alias && - virTypedParamsAddString(params, nparams, maxparams, - param_name, d->alias) < 0) - goto cleanup; + /* match the disk to the target in the vm definition */ + diskdef =3D virDomainDiskByAddress(vmdef, + &d->pci_controller, + d->bus, + d->target, + d->unit); + if (diskdef) { + g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "fs.%zu.disk.%zu.alias", i, j); + if (diskdef->dst && + virTypedParamsAddString(params, nparams, maxparams, + param_name, diskdef->dst) < 0) + goto cleanup; + } =20 g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, "fs.%zu.disk.%zu.serial", i, j); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list