when using Brocade-FC-Zone-Driver with zoning_policy as initiator, attaching 2nd volume to a VM fails

Bug #1928929 reported by Jacky Wang
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
New
Low
Unassigned

Bug Description

- Openstack Zone driver supports two types of zoning_policies:
    * initiator-target
    * initiator <<<< bug exists only for this policy

- Use case: attaching 2nd volume to a VM

- The test of the use case failed the same way by using below two clients.
 a. /cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py << SSH protocol
 b. /cinder/zonemanager/drivers/brocade/brcd_rest_fc_zone_client.py << REST_HTTP

- The bug only exists when zoning_policy set as initiator.

- Detailed description about the bug:

1. set zoning_policy as initiator for Brocade FC Zone Driver

2. Attach 1st volume to a VM successfully,
   where zone(zone_name:openstackc05076de33000345) was created expectedly by Brocade driver

    # /var/log/cinder/volume-xxx.log
    INFO cinder.zonemanager.drivers.driver_utils
        Friendly zone name after forming: openstackc05076de33000345
    INFO cinder.zonemanager.drivers.brocade.brcd_fc_zone_driver
        Zone map to create: {'openstackc05076de33000345':
                                ['c0:50:76:de:33:00:03:45',
                                 '50:05:07:68:0b:23:ba:c7',
                                 '50:05:07:68:0b:21:ba:c7'
                            ]}
    INFO cinder.zonemanager.drivers.brocade.brcd_fc_zone_driver
        Zone map to update: {}

    # check from Brocade switch cmdline
    fcsw60:admin_icic> zoneshow openstackc05076de33000345
            c0:50:76:de:33:00:03:45
            50:05:07:68:0b:23:ba:c7
            50:05:07:68:0b:21:ba:c7

3. However, attaching 2nd volume to the above VM failed with error below !

    # /var/log/cinder/volume-xxx.log
    INFO cinder.zonemanager.drivers.brocade.brcd_fc_zone_driver
        Zone map to create: {}
    INFO cinder.zonemanager.drivers.brocade.brcd_fc_zone_driver
        Zone map to update {'openstackc05076de33000345':
                            ['c0:50:76:de:33:00:03:45',
                             '50:05:07:68:0b:23:ba:c7',
                             '50:05:07:68:0b:21:ba:c7']}
    ERROR cinder.zonemanager.drivers.brocade.brcd_fc_zone_client_cli
        Error while running zoning CLI:
        (command=['zoneadd', '"openstackc05076de33000345",',
            '"c0:50:76:de:33:00:03:45;50:05:07:68:0b:23:ba:
              c7;50:05:07:68:0b:21:ba:c7"']
        error="openstackc05076de33000345" already contains
            "c0:50:76:de:33:00:03:45;50:05:07:68:0b:23:ba:c7;
             50:05:07:68:0b:21:ba:c7).

4. The failure of executing zoneadd -> points to a bug of Brocade driver shown below:

    #### Root Cause has 2 items:
    #### a. The if-condition(line 215) does NOT work as designed
    #### due to the different formats:
               target_list may NOT contains ":"
               cfgmap_from_fabric['zones'][zone_name] contains ":"

     #### b. As the comments (line 210/211) states,
             the existing code only handle target WWNs.
             However,
             it is also needed to add logic to handle initiator WWNs
    ```
    /cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py(216)add_connection()
    206 # If zone exists, then do a zoneadd to update
    207 # the zone members in the existing zone. Otherwise,
    208 # do a zonecreate to create a new zone.
    209 if len(zone_names) > 0 and (zone_name in zone_names):
    210 # Verify that the target WWNs are not already members
    211 # of the existing zone. If so, remove them from the
    212 # list of members to add, otherwise error will be
    213 # returned from the switch.
    214 for t in target_list:
    215 if t in cfgmap_from_fabric['zones'][zone_name]: <<<<
    216 zone_members.remove(utils.get_formatted_wwn(t))
    217 if zone_members:
    218 zone_update_map[zone_name] = zone_members
    ```
    - cfgmap_from_fabric['zones'][zone_name]
      a. it is returned by Brocade switch
      b. its member contains ":"

        #example
         (Pdb) pp cfgmap_from_fabric['zones'][zone_name]
         ['c0:50:76:de:33:00:03:45',
          '50:05:07:68:0b:23:ba:c7',
          '50:05:07:68:0b:21:ba:c7',
          '50:05:07:68:0b:22:ba:c7',
          '50:05:07:68:0b:24:ba:c7',
          '50:05:07:68:0b:22:ba:c6',
          '50:05:07:68:0b:21:ba:c6',
          '50:05:07:68:0b:24:ba:c6',
          '50:05:07:68:0b:23:ba:c6']

    - target_list: items may NOT contains ":"

        #example
          (Pdb) pp target_list
          ['500507680b23bac7',
          '500507680b21bac7',
          '500507680b22bac7',
          '500507680b24bac7',
          '500507680b22bac6',
          '500507680b21bac6',
          '500507680b24bac6',
          '500507680b23bac6']

- A suggestion for the fix:
    ```
    214 for t in target_list:

             # fix item a:
             # handling target WWNs by replacing line 215 with below example

    215 if utils.get_formatted_wwn(t) in cfgmap_from_fabric['zones'][zone_name]:
    216 zone_members.remove(utils.get_formatted_wwn(t))

         # fix item b:
         # handling initiator WWNs by adding below code(line 217,218)

    217 if utils.get_formatted_wwn(initiator) in cfgmap_from_fabric['zones'][zone_name]:
    218 zone_members.remove(utils.get_formatted_wwn(initiator))
    219 if zone_members:
    220 zone_update_map[zone_name] = zone_members
    ```

Tags: brocade zone
Changed in cinder:
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.