From nobody Mon Feb 9 17:58:19 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=1578699191; cv=none; d=zohomail.com; s=zohoarc; b=IE7S6XM19sJgsJdCNgvwUDmFghwir13vvESZdnQQP8BS9e9DgXLnfotx5/HuBby84lChcqBcbFaY1nuBIixWcBzC5pf700lQWTRoNupdy+Ku4Xr3MifkfNJ/Lpym80KDjjpDQz+QpfB/S0l3ELgBVdfbn/5mVq4IZKNwAoSmLSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578699191; 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=ZuKgJv9aL+oAMkrl89y+0mCsEZ4vNtjqSyvjh7uVGdE=; b=BFwi+mQVjsE4DGKWroyYdg7pVrwESqe4jjrFhxWHdd3FQ/c4AMkJ02xonpPyw1pfDhU2m1thlY197B0GWkpXpmfpt/XgqfNr7ZKGERexg8x21Ak/bA1BWZDN/XZNyuw1LFQgjSVJbHgQ0iAQx80cELpsfPZmoiv/OBotGMhs3HI= 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 1578699191907781.2361097812063; Fri, 10 Jan 2020 15:33:11 -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-356-JRO2vey3Pt6Oke6wlTaGOw-1; Fri, 10 Jan 2020 18:32:58 -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 157CB800D53; Fri, 10 Jan 2020 23:32:53 +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 E5CB87FB76; Fri, 10 Jan 2020 23:32:52 +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 9AA3D81C7C; Fri, 10 Jan 2020 23:32:52 +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 00ANWM8q018727 for ; Fri, 10 Jan 2020 18:32:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6450B7C409; 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 1EF3D5D72B; 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=1578699190; 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=ZuKgJv9aL+oAMkrl89y+0mCsEZ4vNtjqSyvjh7uVGdE=; b=Dh6DGjg4efXF6DH1qkRwX78SWy6fmuFU1R8w8Lg0I6kU9yu2RBtJvnlcvd0jXCIbasDHNk VqSGwmuKd2j2PD0y2/gHCdCFNuvK2ECQYtbsTGwlC1gpxerl82RU1mk+Rot6FYkeiSwTR1 ny3YhtzvP9RWtthBEJGh5XKH5/rTDTc= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 10 Jan 2020 17:32:11 -0600 Message-Id: <20200110233217.18770-3-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 2/8] qemu: store complete agent filesystem information 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 X-MC-Unique: JRO2vey3Pt6Oke6wlTaGOw-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" In an effort to avoid holding both an agent and normal job at the same time, we shouldn't access the vm definition from within qemu_agent.c (i.e. while the agent job is being held). In preparation, we need to store the full filesystem disk information in qemuAgentDiskInfo. In a following commit, we can pass this information back to the caller and the caller can search the vm definition to match the filsystem disk to an alias. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_agent.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 8b54786ed8..fa55ff0a57 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1853,6 +1853,11 @@ typedef qemuAgentDiskInfo *qemuAgentDiskInfoPtr; struct _qemuAgentDiskInfo { char *alias; char *serial; + virPCIDeviceAddress pci_controller; + char *bus_type; + unsigned int bus; + unsigned int target; + unsigned int unit; char *devnode; }; =20 @@ -1876,6 +1881,7 @@ qemuAgentDiskInfoFree(qemuAgentDiskInfoPtr info) =20 VIR_FREE(info->serial); VIR_FREE(info->alias); + VIR_FREE(info->bus_type); VIR_FREE(info->devnode); VIR_FREE(info); } @@ -1956,10 +1962,6 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisk= s, qemuAgentDiskInfoPtr disk; virDomainDiskDefPtr diskDef; const char *val; - unsigned int bus; - unsigned int target; - unsigned int unit; - virPCIDeviceAddress pci_address; =20 if (!jsondisk) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1973,6 +1975,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, return -1; disk =3D fsinfo->disks[i]; =20 + if ((val =3D virJSONValueObjectGetString(jsondisk, "bus-type"))) + disk->bus_type =3D g_strdup(val); + if ((val =3D virJSONValueObjectGetString(jsondisk, "serial"))) disk->serial =3D g_strdup(val); =20 @@ -1989,9 +1994,9 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, } \ } while (0) =20 - GET_DISK_ADDR(jsondisk, &bus, "bus"); - GET_DISK_ADDR(jsondisk, &target, "target"); - GET_DISK_ADDR(jsondisk, &unit, "unit"); + GET_DISK_ADDR(jsondisk, &disk->bus, "bus"); + GET_DISK_ADDR(jsondisk, &disk->target, "target"); + GET_DISK_ADDR(jsondisk, &disk->unit, "unit"); =20 if (!(pci =3D virJSONValueObjectGet(jsondisk, "pci-controller"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -2000,18 +2005,17 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondis= ks, return -1; } =20 - GET_DISK_ADDR(pci, &pci_address.domain, "domain"); - GET_DISK_ADDR(pci, &pci_address.bus, "bus"); - GET_DISK_ADDR(pci, &pci_address.slot, "slot"); - GET_DISK_ADDR(pci, &pci_address.function, "function"); + GET_DISK_ADDR(pci, &disk->pci_controller.domain, "domain"); + GET_DISK_ADDR(pci, &disk->pci_controller.bus, "bus"); + GET_DISK_ADDR(pci, &disk->pci_controller.slot, "slot"); + GET_DISK_ADDR(pci, &disk->pci_controller.function, "function"); =20 #undef GET_DISK_ADDR - if (!(diskDef =3D virDomainDiskByAddress(vmdef, - &pci_address, - bus, - target, - unit))) + &disk->pci_controller, + disk->bus, + disk->target, + disk->unit))) continue; =20 disk->alias =3D g_strdup(diskDef->dst); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list