Bug 1612338 - <disk><sector_size> xml filter queries physical sector size instead of logical
Summary: <disk><sector_size> xml filter queries physical sector size instead of logical
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: inventory
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 25.6
Assignee: Dan Callaghan
QA Contact: Matt Tyson 🤬
URL:
Whiteboard:
Depends On:
Blocks: 1610638 1657730
TreeView+ depends on / blocked
 
Reported: 2018-08-03 17:11 UTC by Pavel Cahyna
Modified: 2018-12-10 10:54 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-09-03 23:31:38 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Beaker Project Gerrit 6245 0 None MERGED make <sector_size> query logical sector size, not physical. 2020-07-02 13:58:07 UTC
Red Hat Bugzilla 766919 0 unspecified CLOSED RFE: Block size of hard drive should be available 2021-02-22 00:41:40 UTC

Internal Links: 766919

Description Pavel Cahyna 2018-08-03 17:11:23 UTC
Description of problem:
<sector_size> is equivalent to <phys_sector_size>. It should not be, <sector_size> is documented (see https://beaker-project.org/docs/_downloads/beaker-job.rng) to be the logical sector size, which is different from physical.

In the web interface this is correct, querying Disk/SectorSize yields different results than Disk/PhysicalSectorSize.

Version-Release number of selected component (if applicable):
24.5

Steps to Reproduce:
1. bkr system-list --xml-filter='<hostRequires><and><disk><sector_size op=">" value="512" /></disk></and></hostRequires>'
2. bkr system-list --xml-filter='<hostRequires><and><disk><phys_sector_size op=">" value="512" /></disk></and></hostRequires>'

Actual results:
the list is exactly identical and e.g. aarch64-7s-m1.ss.eng.rdu.redhat.com is in both, while it has Logical sector size = 512 bytes (check the web interface).

Expected results:
there are much fewer machines with logical sector size > 512 than with physical sector size > 512.

Additional info:

patch
diff --git a/Server/bkr/server/needpropertyxml.py b/Server/bkr/server/needpropertyxml.py
index 179711684..af233105b 100644
--- a/Server/bkr/server/needpropertyxml.py
+++ b/Server/bkr/server/needpropertyxml.py
@@ -1088,7 +1088,7 @@ def filter_disk(self):
         value = self.get_xml_attr('value', int, None)
         units = self.get_xml_attr('units', unicode, 'bytes')
         if value:
-            return getattr(Disk.phys_sector_size, op)(
+            return getattr(Disk.sector_size, op)(
                     value * bytes_multiplier(units))
         return None
 

IntegrationTests/src/bkr/inttest/server/test_needpropertyxml.py also needs updating. It contains

        small_disk.disks[:] = [Disk(size=8000000000,
                sector_size=512, phys_sector_size=512)]
        big_disk = data_setup.create_system()
        big_disk.disks[:] = [Disk(size=2000000000000,
                sector_size=4096, phys_sector_size=4096)]
        two_disks = data_setup.create_system()
        two_disks.disks[:] = [
                Disk(size=500000000000, sector_size=512, phys_sector_size=512),
                Disk(size=8000000000, sector_size=4096, phys_sector_size=4096)]

it is not surprising that the bug was not discovered when the test uses disks with sector_size==phys_sector_size.

Comment 1 Dan Callaghan 2018-08-07 22:42:12 UTC
Pavel contributed a patch to fix this.

Comment 5 Roman Joost 2018-09-03 23:31:38 UTC
This has been released with Beaker 25.6.

Release Notes: https://beaker-project.org/docs/whats-new/release-25.html#beaker-25-6


Note You need to log in before you can comment on or make changes to this bug.