From nobody Mon Feb 9 02:51:52 2026 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=1692967924; cv=none; d=zohomail.com; s=zohoarc; b=MvCTNEKGiGHIOIAx2faQtwJNb68xUlS88e4sFRUEAOthitdGe862F2ZYlvBOi75f6hwpStacvhcNwZgycEa3pOoCeeSb5f5LAPpH0xtcD66LT9YQM/YXoDjd5ez0bp7orTMehm0It+1EVaCZMZn/5SVlvY+ed/ikjQDEK8QggmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692967924; 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=CZtv5YIP7s4I7Dbf046OJf7pWRo3zFT6DomPpsXZvao=; b=YQTgxVdiiVkCMhfAA7m1wn4C3S4/pji3+d5Ze6iXhU08vkWXPFFaHLYtlx+Uh5qwkLqdIA/pHB4vDZ6BMvNODh36tyEeNpLsYr5kp7Q28PkgOnBADtR7Yxwj4sx6H8hGS2oSBLZoQv35Tuslzsx3+nH7MEe1V5MwPGw11nghqY4= 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 1692967924890825.6801522286034; Fri, 25 Aug 2023 05:52:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-680-cCw6OOjCPLCWa2_nuk4R-A-1; Fri, 25 Aug 2023 08:50:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4F782808B47; Fri, 25 Aug 2023 12:50:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A10D02026D68; Fri, 25 Aug 2023 12:50:43 +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 DBCAC19465B5; Fri, 25 Aug 2023 12:50:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B5C9019465B8 for ; Fri, 25 Aug 2023 12:50:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A65D0492C3C; Fri, 25 Aug 2023 12:50:41 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D2CA492C13 for ; Fri, 25 Aug 2023 12:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692967923; 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=CZtv5YIP7s4I7Dbf046OJf7pWRo3zFT6DomPpsXZvao=; b=B58V71TtPoDWoAUsBP/DdIUuM9MQyuUA9H6ORlcjZVBLJvZaI77GoIdeZFxq3de5x2NrDz XXVW+2sSHCTG6mE+2UOI0vv3GyOsGXZYo5RDjRdU1+6BEAhN+sR9aNO8Xjc+7yNRoBDrc+ 48v+U5AYhnfTMbyRGSiBQK3/7X3WSfs= X-MC-Unique: cCw6OOjCPLCWa2_nuk4R-A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v3 2/2] qemu: add support for discard_granularity Date: Fri, 25 Aug 2023 14:50:32 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1692967926780100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This commit adds building of `discard_granularity` disk option for qemu commandline. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1849570 Signed-off-by: Kristina Hanicova --- src/qemu/qemu_command.c | 2 + .../disk-blockio.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/disk-blockio.xml | 2 +- .../disk-blockio.x86_64-latest.xml | 48 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/disk-blockio.x86_64-latest.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6bcf2fdadd..b228820b5f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1760,6 +1760,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, unsigned int bootindex =3D 0; unsigned int logical_block_size =3D disk->blockio.logical_block_size; unsigned int physical_block_size =3D disk->blockio.physical_block_size; + unsigned int discard_granularity =3D disk->blockio.discard_granularity; g_autoptr(virJSONValue) wwn =3D NULL; g_autofree char *serial =3D NULL; virTristateSwitch removable =3D VIR_TRISTATE_SWITCH_ABSENT; @@ -1939,6 +1940,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, "p:bootindex", bootindex, "p:logical_block_size", logical_block_size, "p:physical_block_size", physical_block_size, + "p:discard_granularity", discard_granularity, "A:wwn", &wwn, "p:rotation_rate", disk->rotation_rate, "S:vendor", disk->vendor, diff --git a/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args b/tests= /qemuxml2argvdata/disk-blockio.x86_64-latest.args index 7270613573..15f31ae60d 100644 --- a/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -device '{"driver":"ide-cd","bus":"ide.0","unit":1,"drive":"libvirt-2-form= at","id":"ide0-0-1"}' \ -blockdev '{"driver":"file","filename":"/tmp/idedisk.img","node-name":"lib= virt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ --device '{"driver":"ide-hd","bus":"ide.0","unit":2,"drive":"libvirt-1-form= at","id":"ide0-0-2","bootindex":1,"logical_block_size":512,"physical_block_= size":512}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":2,"drive":"libvirt-1-form= at","id":"ide0-0-2","bootindex":1,"logical_block_size":512,"physical_block_= size":512,"discard_granularity":4096}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ diff --git a/tests/qemuxml2argvdata/disk-blockio.xml b/tests/qemuxml2argvda= ta/disk-blockio.xml index 170728371f..84943719d4 100644 --- a/tests/qemuxml2argvdata/disk-blockio.xml +++ b/tests/qemuxml2argvdata/disk-blockio.xml @@ -23,7 +23,7 @@
- + diff --git a/tests/qemuxml2xmloutdata/disk-blockio.x86_64-latest.xml b/test= s/qemuxml2xmloutdata/disk-blockio.x86_64-latest.xml new file mode 100644 index 0000000000..82ee552068 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-blockio.x86_64-latest.xml @@ -0,0 +1,48 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + +
+ + + + + + +
+ + +
+ + +
+ + + + +