From nobody Fri May 17 08:39:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618388136; cv=none; d=zohomail.com; s=zohoarc; b=XiU97XbI8S0ocp8YOgZWWwKt+RGJlxtdng6Yy2jl/M8mbGB4q7kY/p2BMlJ2OaQS2a+2e2azN0qpzBAMO5562PY7vkoGlCnPNSsEkDEBBb60nE4pzjeYGEh0O/TOzussxTC1qCUqdQxnCi28Lv3/j8R92JvwnrmpnFicRHSbrWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618388136; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Q2XWCYXPSlwCwVOMkLlFIZdiBSG2xWAxT+zNEVWXbVI=; b=aG6Vh7vAcThR388JqcqZ+UsyhKZbq49fW3UWAJ47Dt4l5E/exek3blsT1MUuPZVnhXOFma+fTKVBVtJP7NC22CVIgv4bGMOfBiedvU/0jhxrwBdyTBZ0E/SbhOUDbxJZ7sYB+pshGptJzee9tAulQVA2YMXLH97D4fMKAisiQOU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161838813611466.5055412312181; Wed, 14 Apr 2021 01:15:36 -0700 (PDT) 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-443-8o88Nt3sNB24xB6dOIPH3A-1; Wed, 14 Apr 2021 04:15:32 -0400 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 9F7B96D4E0; Wed, 14 Apr 2021 08:15:26 +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 DFC46610F0; Wed, 14 Apr 2021 08:15: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 407E21806D15; Wed, 14 Apr 2021 08:15:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13E8FM4L015957 for ; Wed, 14 Apr 2021 04:15:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27E4517D7E; Wed, 14 Apr 2021 08:15:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E6955D9D0 for ; Wed, 14 Apr 2021 08:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618388135; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q2XWCYXPSlwCwVOMkLlFIZdiBSG2xWAxT+zNEVWXbVI=; b=K3mtfEgW2krkbCRWGVlZeffI4RCon+ARt04kWs37EvIFQGpTBUzlfqnHxNjKpB+i2jOvJ2 6Tz0WL8hp0M5OitxCj5qgh27bBQQK+FW6pQGpfi7um+/+OhCRi8vRtqxNGukfZvTVIEh7X ry0VaTPkuHS+809WM6KRlAAPf8vUJQw= X-MC-Unique: 8o88Nt3sNB24xB6dOIPH3A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Expose disk serial in virDomainGetGuestInfo() Date: Wed, 14 Apr 2021 10:15:14 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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) Content-Type: text/plain; charset="utf-8" When querying guest info via virDomainGetGuestInfo() the 'guest-get-disks' agent command is called. It may report disk serial number which we parse, but never report nor use for anything else. As it turns out, it may help management application find matching disk in their internals. Signed-off-by: Michal Privoznik --- src/libvirt-domain.c | 1 + src/qemu/qemu_driver.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 83ff7df9fe..1c244da650 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12561,6 +12561,7 @@ virDomainSetVcpu(virDomainPtr domain, * hold the list of PVs, for LUKS encrypted volume th= is will * contain the disk where the volume is placed. (Linu= x) * "disk..dependency..name" - a dependency + * "disk..serial" - disk serial number * "disk..alias" - the device alias of the disk (e.g. sda) * "disk..guest_alias" - optional alias assigned to the disk, on= Linux * this is a name assigned by device mapper diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 90b5477f00..88ee9e5d5e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19951,15 +19951,24 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfo *= *info, } =20 if (info[i]->address) { + qemuAgentDiskAddress *address =3D info[i]->address; virDomainDiskDef *diskdef =3D NULL; =20 + if (address->serial) { + g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "disk.%zu.serial", i); + if (virTypedParamsAddString(params, nparams, maxparams, + param_name, address->serial) <= 0) + return; + } + /* match the disk to the target in the vm definition */ diskdef =3D virDomainDiskByAddress(vmdef, - &info[i]->address->pci_contro= ller, - info[i]->address->ccw_addr, - info[i]->address->bus, - info[i]->address->target, - info[i]->address->unit); + &address->pci_controller, + address->ccw_addr, + address->bus, + address->target, + address->unit); if (diskdef) { g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, "disk.%zu.alias", i); --=20 2.26.3