Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-42359

FC PV configured with WWID is mapping the partition to the pod instead of LUN

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.15.0
    • Storage / Kubernetes
    • None
    • Important
    • None
    • False
    • Hide

      None

      Show
      None

      Description of problem:

      A PV was configured with wwid as below:

      # oc get pv pv0001 -o yaml |yq '.spec.fc'
      wwids:
        - 0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1

      Multipath was configured on the node and the disk already had a partition:

      # multipath -ll mpathb
      mpathb (0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1) dm-0 QEMU,QEMU HARDDISK
      size=100G features='0' hwhandler='0' wp=rw
      `-+- policy='service-time 0' prio=1 status=active
        `- 0:0:0:1 sdb 8:16 active ready running
      Device                          Boot Start     End Sectors Size Id Type
      /dev/disk/by-id/dm-name-mpathb1       2048 2099199 2097152   1G 83 Linux

      Then a PVC was created and attached to the pod:

      # oc get pod virt-launcher-rhel7-crimson-manatee-46-8r4lb -o yaml |yq '.spec.containers[0].volumeDevices,.spec.volumes[7]'
      
      - devicePath: /dev/disk-sapphire-reindeer-40
        name: disk-sapphire-reindeer-40
      name: disk-sapphire-reindeer-40
      persistentVolumeClaim:
        claimName: pv-new

      But the pod can only see 1 GiB:

      sh-5.1$ blockdev --getsize64 /dev/disk-sapphire-reindeer-40
      1073741824

      This is because the partition of the disk was mapped to the pod instead of full disk:

      crictl inspect 6d23a623beb6e |grep -A 4 -B 4 "/dev/disk-sapphire-reindeer-40"
                  "uid": 0,
                  "gid": 36
                },
                {
                  "path": "/dev/disk-sapphire-reindeer-40",
                  "type": "b",
                  "major": 253,
                  "minor": 1,
                  "uid": 0,
      
      # lsblk  |grep -B 1 "253:1"
      └─mpathb    253:0    0  100G  0 mpath
        └─mpathb1 253:1    0    1G  0 part

      It looks to be problem in how findDiskWWIDs find the multipath disk:

      • It fist looks at /dev/disk/by-id/ and look for scsi-wwid and find the symlink to get the SCSI device name.
      • Then it looks at /sys/block/dm-*/slaves/<dev-name> and match it with the found device name in step 1 to find the multipath device name.

      However, here /dev/disk/by-id/scsi-wwid will be already pointing to multipath device name.

      ls -l /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1
      lrwxrwxrwx. 1 root root 10 Sep 24 06:41 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-1 -> ../../dm-0

      So when it tries to find this device in  /sys/block/dm-/slaves/ , it match with the partition:

      ls -l /sys/block/dm-1/slaves/
      total 0
      lrwxrwxrwx. 1 root root 0 Sep 24 06:16 dm-0 -> ../../dm-0

      Also, below log shows same:

      Sep 24 06:42:32 openshift-worker-cygnus-0 kubenswrapper[3575]: I0924 06:42:32.404613    3575 fc_util.go:106] fc: find disk: /dev/dm-0, dm: /dev/dm-1

       

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

      4.16.8 (however I think it is reproducible on previous versions)

      How reproducible:

       100% 

      Steps to Reproduce:

      1. Enable multipath on the node.
      2. Map a disk which is having partition to the pod using wwid.
      3. Pod will see partition instead of whole disk.
          

      Actual results:

      FC PV configured with WWID is mapping the partition to the pod instead of LUN   

      Expected results:

      Additional info:

              rbednar@redhat.com Roman Bednar
              rhn-support-nashok Nijin Ashok
              Chao Yang Chao Yang
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: