Project

General

Profile

Bug #41104

Bug fix for iSCSI target_authgroup in APIv1

Added by Arnaud Veron over 1 year ago. Updated over 1 year ago.

Status:
Done
Priority:
No priority
Assignee:
Waqar Ahmed
Category:
Middleware
Target version:
Seen in:
Severity:
Med High
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

hi

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 = self.post('/services/iscsi/targetgroup/', d)
        try:
            return json.loads(buff)
        except ValueError:
            raise ex.excError(buff)

Full code is available here : https://git.opensvc.com/?p=opensvc/.git;a=blob;f=lib/rcFreenas.py;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/resources.py\", line 219, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/resources.py\", line 450, in dispatch_list\n    return self.dispatch('list', request, **kwargs)\n\n  File \"./freenasUI/api/utils.py\", line 251, in dispatch\n    request_type, request, *args, **kwargs\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/resources.py\", line 482, in dispatch\n    response = method(request, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/tastypie/resources.py\", 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/resources.py\", line 2175, in obj_create\n    return self.save(bundle)\n\n  File \"./freenasUI/api/utils.py\", line 415, in save\n    form.save()\n\n  File \"./freenasUI/middleware/form.py\", line 55, in save\n    result = self.__save()\n\n  File \"./freenasUI/middleware/form.py\", line 114, in __save\n    raise\n\n  File \"./freenasUI/middleware/form.py\", line 109, in __save\n    return c.call(f\"{self.middleware_plugin}.{self._middleware_action}\", *args, **kwargs)\n\n  File \"/usr/local/lib/python3.6/site-packages/middlewared/client/client.py\", 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
29261

Associated revisions

Revision ca668142 (diff)
Added by Waqar Ahmed over 1 year 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

History

#1 Updated by Dru Lavigne over 1 year 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 over 1 year 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 over 1 year ago

  • Status changed from Unscreened to In Progress

#4 Updated by Dru Lavigne over 1 year 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 over 1 year ago

29261

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

#9 Updated by Dru Lavigne over 1 year ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF