Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1990749

Summary: [storage role] Get wrong volume size in tests_resize.yml
Product: Red Hat Enterprise Linux 8 Reporter: guazhang <guazhang>
Component: rhel-system-rolesAssignee: Rich Megginson <rmeggins>
Status: CLOSED WONTFIX QA Contact: CS System Management SST QE <rhel-cs-system-management-subsystem-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: dlehman, japokorn, nhosoi, rmeggins, spetrosi, vtrefny
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:storage
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-15 16:52:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description guazhang@redhat.com 2021-08-06 06:37:00 UTC
Description of problem:
storage role tests_resize.yml test failed and get the error info, please help to check if hit a bug

Version-Release number of selected component (if applicable):
rhel-system-roles-1.5.1-1.el8.noarch



    - name: Test for correct handling of volume size equal disk's size
      block:
        - name: Try to create LVM with volume size equal disk's size, resize to "{{ disk_size }}"
          include_role:
            name: rhel-system-roles.storage
          vars:
            storage_pools:
              - name: foo
                disks: "{{ unused_disks }}"
                volumes:
                  - name: test1
                    fs_type: 'ext4'
                    size: "{{ disk_size }}"
                    mount_point: "{{ mount_location }}"


    - include_tasks: verify-role-results.yml


                                                                        


TASK [Try to create LVM with volume size equal disk's size, resize to "80006650789888"] ************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tests/tests_resize.yml:112


TASK [rhel-system-roles.storage : debug] ***********************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:12
ok: [localhost] => {
    "storage_pools": [
        {
            "disks": [
                "sda"
            ],
            "name": "foo",
            "volumes": [
                {
                    "fs_type": "ext4",
                    "mount_point": "/opt/test1",
                    "name": "test1",
                    "size": "80006650789888"
                }
            ]
        }
    ]
}





TASK [rhel-system-roles.storage : failed message] **************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:71
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"actions": [], "changed": false, "crypts": [], "failed": true, "invocation": {"module_args": {"disklabel_type": null, "diskvolume_mkfs_option_map": {}, "packages_only": false, "pool_defaults": {"disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": []}, "pools": [{"disks": ["sda"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "name": "foo", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": [{"compression": null, "deduplication": null, "disks": ["sda"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "/opt/test1", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": "80006650789888", "state": "present", "type": "lvm", "vdo_pool_size": null}]}], "safe_mode": false, "use_partitions": null, "volume_defaults": {"compression": null, "deduplication": null, "disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "xfs", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "lvm", "vdo_pool_size": null}, "volumes": []}}, "leaves": [], "mounts": [], "msg": "volume 'test1' cannot be resized to '72.77 TiB'", "packages": [], "pools": [], "volumes": []}}

Comment 1 guazhang@redhat.com 2021-08-07 14:20:29 UTC
HI,

For the task "TASK [Try to create LVM with volume size equal disk's size, resize to "80006650789888"]"

my disk size is  9.1(T) and resize to 80006650789888(b), but why the blivet msg said can not reszie to 72.77 TiB ? 

if I change  "disk_size: '9T'" and then the task will resize OK.



...
sdb                                                                       8:16   0   9.1T  0 disk    
`-foo-test1                                                             253:5    0     9G  0 lvm     /opt/test1
sdc                                                                       8:32   0   9.1T  0 disk    
sdd                                                                       8:48   0   9.1T  0 disk    
sde                                                                       8:64   0   9.1T  0 disk    
sdf                                                                       8:80   0   9.1T  0 disk    
sdg                                                                       8:96   0   9.1T  0 disk    

...


I think the size calculate wrong in blivet. the resize $size will expand to $size * 8 .





    too_large_size: '{{ unused_disk_subfact.sectors|int * 1.2 *
                        unused_disk_subfact.sectorsize|int }}'

    disk_size: '{{ unused_disk_subfact.sectors|int *
                   unused_disk_subfact.sectorsize|int }}'


TASK [rhel-system-roles.storage : failed message] **************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:71
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"actions": [], "changed": false, "crypts": [], "failed": true, "invocation": {"module_args": {"disklabel_type": null, "diskvolume_mkfs_option_map": {}, "packages_only": false, "pool_defaults": {"disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": []}, "pools": [{"disks": ["sdb"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "name": "foo", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": [{"compression": null, "deduplication": null, "disks": ["sdb"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "/opt/test1", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": "96007980947865.6", "state": "present", "type": "lvm", "vdo_pool_size": null}]}], "safe_mode": false, "use_partitions": null, "volume_defaults": {"compression": null, "deduplication": null, "disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "xfs", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "lvm", "vdo_pool_size": null}, "volumes": []}}, "leaves": [], "mounts": [], "msg": "volume 'test1' cannot be resized to '87.32 TiB'", "packages": [], "pools": [], "volumes": []}}


I change the var too_large_size to 12T , the failed message will prompt "can not resize to 12T", but before will prompt "cannot be resized to '87.32 TiB'", so please confirm if it's expect ?

    too_large_size: '12T'
    #too_large_size: '{{ unused_disk_subfact.sectors|int * 1.2 *
    #                    unused_disk_subfact.sectorsize|int }}'
    disk_size: '9T'
    #disk_size: '{{ unused_disk_subfact.sectors|int *
    #               unused_disk_subfact.sectorsize|int }}

TASK [rhel-system-roles.storage : failed message] **************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:71
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"actions": [], "changed": false, "crypts": [], "failed": true, "invocation": {"module_args": {"disklabel_type": null, "diskvolume_mkfs_option_map": {}, "packages_only": false, "pool_defaults": {"disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": []}, "pools": [{"disks": ["sdb"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "name": "foo", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": [{"compression": null, "deduplication": null, "disks": ["sdb"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "/opt/test1", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": "12T", "state": "present", "type": "lvm", "vdo_pool_size": null}]}], "safe_mode": false, "use_partitions": null, "volume_defaults": {"compression": null, "deduplication": null, "disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "xfs", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "lvm", "vdo_pool_size": null}, "volumes": []}}, "leaves": [], "mounts": [], "msg": "volume 'test1' cannot be resized to '12 TiB'", "packages": [], "pools": [], "volumes": []}}

Comment 2 Rich Megginson 2021-08-07 16:00:32 UTC
I cannot reproduce this locally on my laptop.  Can you give me access to a system which has these large disks?

@vtrefny @dlehman @japokorn - any ideas?

Comment 3 guazhang@redhat.com 2021-08-11 12:09:38 UTC
Hi, 

I retest the case with other server which include nmve device and can not hit the error.


TASK [Try to create LVM with a too-large volume size, resize to "1152236548915.2"] *****************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tests/tests_resize.yml:79



TASK [rhel-system-roles.storage : manage the pools and volumes to match the specified state] *******************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:57
fatal: [localhost]: FAILED! => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "msg": "volume 'test1' cannot be resized to '1.05 TiB'", "packages": [], "pools": [], "volumes": []}

TASK [rhel-system-roles.storage : failed message] **************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:71
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"actions": [], "changed": false, "crypts": [], "failed": true, "invocation": {"module_args": {"disklabel_type": null, "diskvolume_mkfs_option_map": {}, "packages_only": false, "pool_defaults": {"disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": []}, "pools": [{"disks": ["nvme1n1"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "name": "foo", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": [{"compression": null, "deduplication": null, "disks": ["nvme1n1"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "/opt/test1", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": "1152236548915.2", "state": "present", "type": "lvm", "vdo_pool_size": null}]}], "safe_mode": false, "use_partitions": null, "volume_defaults": {"compression": null, "deduplication": null, "disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "xfs", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "lvm", "vdo_pool_size": null}, "volumes": []}}, "leaves": [], "mounts": [], "msg": "volume 'test1' cannot be resized to '1.05 TiB'", "packages": [], "pools": [], "volumes": []}}


# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0   223G  0 disk 
|-sda1                        8:1    0     1G  0 part /boot
`-sda2                        8:2    0   222G  0 part 
  |-rhel_storageqe--70-root 253:0    0    70G  0 lvm  /
  |-rhel_storageqe--70-swap 253:1    0   7.7G  0 lvm  [SWAP]
  `-rhel_storageqe--70-home 253:2    0 144.4G  0 lvm  /home
nvme1n1                     259:0    0 894.3G  0 disk 
nvme5n1                     259:1    0 894.3G  0 disk 
nvme0n1                     259:2    0 894.3G  0 disk 
nvme4n1                     259:3    0 894.3G  0 disk 
nvme3n1                     259:4    0 894.3G  0 disk 
nvme2n1                     259:5    0 894.3G  0 disk 


the blivet feedback the failed message looks right.

Comment 4 David Lehman 2021-08-11 15:04:51 UTC
The blivet log (/tmp/blivet.log, taken from the failing system) would be very helpful in diagnosing this problem. Although it is possible there is a bug in blivet, it's far more likely that the issue is either in the role itself or somewhere in the OS (either the kernel reporting for the problematic device or somewhere like parted).

Comment 12 David Lehman 2021-08-12 21:36:00 UTC
It sounds like we should add a debug line showing the unused_disk_subfact value.

Comment 13 Rich Megginson 2021-08-12 21:47:50 UTC
(In reply to David Lehman from comment #12)
> It sounds like we should add a debug line showing the unused_disk_subfact
> value.

It is really odd that this calculation:

    disk_size: '{{ unused_disk_subfact.sectors|int *
                   unused_disk_subfact.sectorsize|int }}'

gives a value that is ~ 9 times as large as the available space . . .

Comment 14 guazhang@redhat.com 2021-08-12 23:45:09 UTC
Hi


Maybe the question is here, my test server disk sector size is 4K, other server disk sector is 512.


Disk /dev/sdf: 9.1 TiB, 10000831348736 bytes, 2441609216 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Comment 15 Rich Megginson 2021-08-13 02:25:09 UTC
(In reply to guazhang from comment #14)
> Hi
> 
> 
> Maybe the question is here, my test server disk sector size is 4K, other
> server disk sector is 512.
> 
> 
> Disk /dev/sdf: 9.1 TiB, 10000831348736 bytes, 2441609216 sectors
> Units: sectors of 1 * 4096 = 4096 bytes
> Sector size (logical/physical): 4096 bytes / 4096 bytes
> I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Are you saying that in 

    disk_size: '{{ unused_disk_subfact.sectors|int *
                   unused_disk_subfact.sectorsize|int }}'

the number of sectors is correct, but the sector size is reported as 4096 instead of 512?  So if the number of sectors is really 156262989824, and instead of using a sector size of 512 you used a sector size of 4096 for the calculation, you would get 80006650789888 or 72.76 TB?

I'm not sure what you are saying

Comment 16 guazhang@redhat.com 2021-08-13 11:52:09 UTC
> I'm not sure what you are saying
just provides the info, maybe it will help to find the root cause.

Comment 18 guazhang@redhat.com 2021-08-15 10:36:41 UTC
thanks for the confirm , please close it.