Comment 0 for bug 1964395

Revision history for this message
Gorka Eguileor (gorka) wrote :

The os-brick code skips half the subsystems when looking for the paths in the connected subsystems, and the half that doesn't skip just uses the wrong paths in the search.

Offending code is:

# Find nvme name among subsystems
for i in range(0, int(len(subsystems) / 2)):
    subsystem = subsystems[i * 2]
    if 'NQN' in subsystem and subsystem['NQN'] == conn_nqn:
        for path in subsystems[i * 2 + 1]['Paths']:
            if (path['Transport'] == nvme_transport_type
                    and path['Address'] == nvme_address):
                nvme_name = path['Name']
                break

This is because the code was written based on the output from an nvme client version that had a bug and returned the wrong json output, it returned each subsystem as 2 different elements on the list:
{
  "Subsystems" : [
    {
      "Name" : "nvme-subsys0",
      "NQN" : "nqn.2016-06.io.spdk:cnode1"
    },
    {
      "Paths" : [
        {
          "Name" : "nvme0",
          "Transport" : "rdma",
          "Address" : "traddr=10.0.2.15 trsvcid=4420",
          "Status" : "live"
        }
      ]
    }
  ]
}

Instead of returning the right output:
{
  "Subsystems" : [
    {
      "Name" : "nvme-subsys0",
      "NQN" : "nqn.2016-06.io.spdk:cnode1"
      "Paths" : [
        {
          "Name" : "nvme0",
          "Transport" : "rdma",
          "Address" : "traddr=10.0.2.15 trsvcid=4420",
          "Status" : "live"
        }
      ]
    }
  ]
}

But this was fixed on commit 2a2d5b438cbd4c345cf6a4a79ad81e3413f9cc8f, so if the nvme version present in the system has that commit the os-brick code will not only be skipping half the entries, but it will also mix the paths from 2 different subsystems.