From nobody Tue Dec 16 06:37:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526906478578587.5133017577767; Mon, 21 May 2018 05:41:18 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1460919D236; Mon, 21 May 2018 12:41:17 +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 B9615600CC; Mon, 21 May 2018 12:41:16 +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 4820A3D380; Mon, 21 May 2018 12:41:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4LCesiH028022 for ; Mon, 21 May 2018 08:40:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9FBE25C261; Mon, 21 May 2018 12:40:54 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-225.phx2.redhat.com [10.3.116.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B1525C1A1 for ; Mon, 21 May 2018 12:40:54 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Mon, 21 May 2018 08:40:45 -0400 Message-Id: <20180521124045.4130-9-jferlan@redhat.com> In-Reply-To: <20180521124045.4130-1-jferlan@redhat.com> References: <20180521124045.4130-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 8/8] schema: Add missing block data for nodedev 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 21 May 2018 12:41:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1566416 Commit id 'fe2af45b' added output for logical_block_size and num_blocks for both removeable and fixed storage, but did not update the nodedev capability causing virt-xml-validate to fail. It's listed as optional only because it only prints if the sizes are > 0. For a CDROM drive the values won't be formatted. Update the nodedevxml2xmltest in order to output the values for storage based on the logic from udevProcessRemoveableMedia and udevProcessSD with respect to the logical_blocksize and num_blocks calculations. Signed-off-by: John Ferlan --- docs/schemas/nodedev.rng | 13 +++++++++++++ tests/nodedevschemadata/DVD_with_media.xml | 2 ++ ...ge_serial_3600c0ff000d7a2a5d463ff4902000000.xml | 2 ++ ..._serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 2 ++ tests/nodedevxml2xmltest.c | 22 ++++++++++++++++++= ++++ 5 files changed, 41 insertions(+) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 6b063cc225..0498489cfd 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -578,6 +578,7 @@ + =20 @@ -585,6 +586,18 @@ + + + + + + + + + + + + =20 diff --git a/tests/nodedevschemadata/DVD_with_media.xml b/tests/nodedevsche= madata/DVD_with_media.xml index 673e88fd0a..f169885eb1 100644 --- a/tests/nodedevschemadata/DVD_with_media.xml +++ b/tests/nodedevschemadata/DVD_with_media.xml @@ -11,6 +11,8 @@ 1 12345678 Windows_XP_Label + 2048 + 6028 diff --git a/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff= 4902000000.xml b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d4= 63ff4902000000.xml index d225dca8fa..5bdbb8ac95 100644 --- a/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000= 000.xml +++ b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000= 000.xml @@ -13,5 +13,7 @@ HP 3600c0ff000d7a2a5d463ff4902000000 15626928128 + 512 + 30521344 diff --git a/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MP= CZ12Y0GNGWSE.xml b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9S= A00_MPCZ12Y0GNGWSE.xml index 3595a0baaa..68dbf0be96 100644 --- a/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0G= NGWSE.xml +++ b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0G= NGWSE.xml @@ -8,5 +8,7 @@ HTS721010G9SA00 ATA 100030242816 + 512 + 195371568 diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 41ed5c01c2..207d97483e 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -23,6 +23,7 @@ testCompareXMLToXMLFiles(const char *xml) char *actual =3D NULL; int ret =3D -1; virNodeDeviceDefPtr dev =3D NULL; + virNodeDevCapsDefPtr caps; =20 if (virTestLoadFile(xml, &xmlData) < 0) goto fail; @@ -30,6 +31,27 @@ testCompareXMLToXMLFiles(const char *xml) if (!(dev =3D virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE, NU= LL))) goto fail; =20 + /* Calculate some things that are not read in */ + for (caps =3D dev->caps; caps; caps =3D caps->next) { + virNodeDevCapDataPtr data =3D &caps->data; + + if (caps->data.type =3D=3D VIR_NODE_DEV_CAP_STORAGE) { + if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) { + if (data->storage.flags & + VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE) { + data->storage.logical_block_size =3D 2048; + data->storage.num_blocks =3D + data->storage.removable_media_size / + data->storage.logical_block_size; + } + } else { + data->storage.logical_block_size =3D 512; + data->storage.num_blocks =3D data->storage.size / + data->storage.logical_block_siz= e; + } + } + } + if (!(actual =3D virNodeDeviceDefFormat(dev))) goto fail; =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list