Bug #41104

Bug fix for iSCSI target_authgroup in APIv1

Added by Arnaud Veron about 2 years ago. Updated about 2 years ago.

No priority
Waqar Ahmed
Target version:
Seen in:
Med High
Reason for Closing:
Reason for Blocked:
Needs QA:
Needs Doc:
Needs Merging:
Needs Automation:
Support Suite Ticket:
Hardware Configuration:
ChangeLog Required:



Bug discovered on FreeNAS-11.2-STABLE
Same code works fine on FreeNAS-11.1-U5

Code extract :

    def _add_iscsi_targetgroup(self, portal_id=None, initiatorgroup_id=None,
                               target_id=None, authtype="None",
                               authgroup_id=None, **kwargs):
        for key in ["portal_id", "initiatorgroup_id", "target_id"]:
            if locals()[key] is None:
                raise ex.excError("'%s' key is mandatory" % key)
        d = {
            "iscsi_target": target_id,
            "iscsi_target_initiatorgroup": initiatorgroup_id,
            "iscsi_target_portalgroup": portal_id,
            "iscsi_target_authtype": authtype,
            "iscsi_target_authgroup": -1,
            "iscsi_target_initialdigest": "Auto",
        if authgroup_id:
            d["iscsi_target_authgroup"] = authgroup_id

        print("payload <%s>"%json.dumps(d))
        buff ='/services/iscsi/targetgroup/', d)
            return json.loads(buff)
        except ValueError:
            raise ex.excError(buff)

Full code is available here :;a=blob;f=lib/;h=73a209b31ba87a5c5bc5096fd3ffae11d69fd75a;hb=HEAD

Stack :

payload <{"iscsi_target_initialdigest": "Auto", "iscsi_target_authtype": "None", "iscsi_target_initiatorgroup": 14, "iscsi_target_portalgroup": 1, "iscsi_target": 31, "iscsi_target_authgroup": -1}>

        "error_message": "[groups] Item#0 is not valid per list types: [auth] Not an integer",
        "traceback": "Traceback (most recent call last):\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/\", line 219, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/\", line 450, in dispatch_list\n    return self.dispatch('list', request, **kwargs)\n\n  File \"./freenasUI/api/\", line 251, in dispatch\n    request_type, request, *args, **kwargs\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/\", line 482, in dispatch\n    response = method(request, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/\", line 1384, in post_list\n    updated_bundle = self.obj_create(bundle, **self.remove_api_resource_names(kwargs))\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/\", line 2175, in obj_create\n    return\n\n  File \"./freenasUI/api/\", line 415, in save\n\n\n  File \"./freenasUI/middleware/\", line 55, in save\n    result = self.__save()\n\n  File \"./freenasUI/middleware/\", line 114, in __save\n    raise\n\n  File \"./freenasUI/middleware/\", line 109, in __save\n    return\"{self.middleware_plugin}.{self._middleware_action}\", *args, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/middlewared/client/\", line 437, in call\n    raise ClientException(c.error, c.errno, c.trace, c.extra)\n\nmiddlewared.client.client.ClientException: [groups] Item#0 is not valid per list types: [auth] Not an integer\n" 
success-2018-09-08.png (15 KB) success-2018-09-08.png Michael Reynolds, 09/08/2018 11:58 AM

Associated revisions

Revision ca668142 (diff)
Added by Waqar Ahmed about 2 years ago

Bug fix for iscsi targetgroup in api v1 This commit fixes a bug which prevented the end user from creating a targetgroup if -1 is provided for iscsi_target_authgroup value. Ticket: #41104


#1 Updated by Dru Lavigne about 2 years ago

  • Category changed from Services to Middleware
  • Assignee changed from Release Council to William Grzybowski
  • Seen in changed from 11.2-RC2 to 11.2-BETA2

#2 Updated by William Grzybowski about 2 years ago

  • Assignee changed from William Grzybowski to Waqar Ahmed
  • Target version changed from Backlog to 11.2-BETA3
  • Severity changed from New to Med High

Waqar, can you investigate, please?

#3 Updated by Waqar Ahmed about 2 years ago

  • Status changed from Unscreened to In Progress

#4 Updated by Dru Lavigne about 2 years ago

  • Subject changed from api entrypoint targetgroup issue (stack) to Bug fix for iSCSI target_authgroup in APIv1
  • Status changed from In Progress to Ready for Testing
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#8 Updated by Michael Reynolds about 2 years ago


I was able to successfully create iSCSI Target targetgroup1 using apiv1 calls.

#9 Updated by Dru Lavigne about 2 years ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF