'Create target on nas and return target index.'

@_connection_checker
def create_target(self, target_name, controller_name):

    res_details = self._get_res_details('/cgi-bin/disk/iscsi_target_setting.cgi?', func='add_target', targetName=target_name, targetAlias=target_name, bTargetDataDigest='0', bTargetHeaderDigest='0', bTargetClusterEnable='1', sid=self.sid)
    root = ET.fromstring(res_details['data'])
    if (root.find('authPassed').text == '0'):
        raise exception.VolumeBackendAPIException(data=_('Session    id    expired'))
    if (root.find('result').text < '0'):
        raise exception.VolumeBackendAPIException(data=_('Create    target    failed'))
    root = ET.fromstring(res_details['data'])
    target_index = root.find('result').text
    return target_index
