From: Robert W. <wrw...@us...> - 2006-12-18 23:00:09
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7738/isnsserver/src Modified Files: iSNSUtil.c iSNSdb.c iSNSdereg.c iSNSparse.c iSNSquery.c iSNSreg.c Log Message: Portal Group Update Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSUtil.c 15 Dec 2006 01:13:29 -0000 1.12 --- iSNSUtil.c 18 Dec 2006 23:00:04 -0000 1.13 *************** *** 871,875 **** case ISNS_ESI_INTERVAL : return("ESI Interval"); case ISNS_ESI_PORT : return("ESI/SCN UDP Port"); - case ISNS_PORTAL_GROUP : return("Portal Group"); case ISNS_PORTAL_CERT : return("Portal Certificate"); case ISNS_ISCSI_NODE_ID : return("iSCSI Name"); --- 871,874 ---- *************** *** 1019,1023 **** case ISNS_DDS_SYM_NAME : case ISNS_DD_SYM_NAME : - case ISNS_PORTAL_GROUP : case ISNS_ISCSI_NODE_ID : case ISNS_ISCSI_ALIAS : --- 1018,1021 ---- Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSquery.c 18 Dec 2006 19:02:47 -0000 1.12 --- iSNSquery.c 18 Dec 2006 23:00:05 -0000 1.13 *************** *** 156,160 **** case ISNS_PORTAL_PORT: case ISNS_PORTAL_SYM_NAME: - case ISNS_PORTAL_GROUP: case ISNS_PORTAL_IDX: status = SNSdbGetAttrPortal ( attr_indx, key_indx, --- 156,159 ---- *************** *** 2695,2699 **** case ISNS_ESI_INTERVAL: case ISNS_ESI_PORT: - case ISNS_PORTAL_GROUP: case ISNS_PORTAL_CERT: fetchPortalFlag = TRUE; --- 2694,2697 ---- *************** *** 2847,2854 **** p_portal->sym_name, 0); break; - case ISNS_PORTAL_GROUP: - ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP, ISNS_PORTAL_GROUP_SIZE, - NULL, p_portal->group); - break; case ISNS_ESI_PORT: ISNSAppendAttr (p_msg, ISNS_ESI_PORT, ISNS_ESI_PORT_SIZE, --- 2845,2848 ---- *************** *** 2946,2953 **** p_portal->sym_name, 0 ); break; - case ISNS_PORTAL_GROUP: - ISNSAppendAttr ( p_msg, ISNS_PORTAL_GROUP, ISNS_PORTAL_GROUP_SIZE, - NULL, p_portal->group ); - break; case ISNS_ESI_PORT: ISNSAppendAttr ( p_msg, ISNS_ESI_PORT, ISNS_ESI_PORT_SIZE, --- 2940,2943 ---- Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iSNSparse.c 15 Dec 2006 18:17:19 -0000 1.15 --- iSNSparse.c 18 Dec 2006 23:00:05 -0000 1.16 *************** *** 175,179 **** case ISNS_ESI_PORT: case ISNS_SCN_PORT: - case ISNS_PORTAL_GROUP: case ISNS_PORTAL_IDX: case ISNS_ISCSI_TYPE: --- 175,178 ---- *************** *** 440,444 **** case ISNS_IFCP_SCN_BITMAP: case ISNS_ISCSI_TYPE: - case ISNS_PORTAL_GROUP: case ISNS_ENTITY_PERIOD: case ISNS_DD_FEATURE_BITMAP: --- 439,442 ---- *************** *** 596,600 **** case ISNS_ISCSI_SCN_BITMAP: case ISNS_IFCP_SCN_BITMAP: - case ISNS_PORTAL_GROUP: case ISNS_ISCSI_TYPE: case ISNS_ENTITY_PERIOD: --- 594,597 ---- Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iSNSdereg.c 18 Dec 2006 19:02:47 -0000 1.16 --- iSNSdereg.c 18 Dec 2006 23:00:05 -0000 1.17 *************** *** 127,131 **** case ISNS_PORTAL_PORT: case ISNS_PORTAL_SYM_NAME: ! case ISNS_PORTAL_GROUP: deregPortalFlag = TRUE; break; --- 127,131 ---- case ISNS_PORTAL_PORT: case ISNS_PORTAL_SYM_NAME: ! // case ISNS_PORTAL_GROUP: deregPortalFlag = TRUE; break; Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iSNSreg.c 18 Dec 2006 19:02:47 -0000 1.16 --- iSNSreg.c 18 Dec 2006 23:00:05 -0000 1.17 *************** *** 130,134 **** case ISNS_PORTAL_PORT: case ISNS_PORTAL_SYM_NAME: - case ISNS_PORTAL_GROUP: case ISNS_PORTAL_CERT: case ISNS_ESI_INTERVAL: --- 130,133 ---- *************** *** 167,170 **** --- 166,172 ---- case ISNS_PORTAL_GROUP_ISCSI_NAME: + case ISNS_PORTAL_GROUP_TAG: + case ISNS_PORTAL_GROUP_PORT: + case ISNS_PORTAL_GROUP_IP: regPortalGroupFlag = TRUE; break; *************** *** 477,480 **** --- 479,483 ---- strcpy(p_portal->entity_id.id,p_entity->eid.id); + DEBUG_1 (isns_reg_debug &1, p_portal->entity_id.id is:%s,p_portal->entity_id.id); p_portal->entity_index = p_entity->entity_index; *************** *** 585,599 **** updateFlag = TRUE; break; - case ISNS_PORTAL_GROUP: - if (p_portal->group!=*(uint32_t *)&attr->val) - { - p_portal->group=*(uint32_t *)&attr->val; - - ISNSAppendKey( p_scn_all_msg_buffer, ISNS_PORTAL_GROUP, - ISNS_PORTAL_GROUP_SIZE, NULL, p_portal->group ); - - updateFlag = TRUE; - } - break; default: break; --- 588,591 ---- *************** *** 621,624 **** --- 613,618 ---- } + DEBUG_1(isns_reg_debug &1, Entity id:%s,p_portal->entity_id.id); + /* Send Out Detailed SCN */ if (newPortalRegFlag || updateFlag) *************** *** 691,699 **** ISNS_Attr *attr = NULL; SOIP_Portal_Group *p_portal_group; ! SOIP_Portal_Key db_portal_group; int ii; int rval; int portalIpIndex; int portalPortIndex; int saveIndex; int stopFlag = FALSE; --- 685,694 ---- ISNS_Attr *attr = NULL; SOIP_Portal_Group *p_portal_group; ! SOIP_Portal_Group_Key db_portal_group; int ii; int rval; int portalIpIndex; int portalPortIndex; + int iscsiIndex; int saveIndex; int stopFlag = FALSE; *************** *** 703,714 **** ISNS_DBKey read_key; ! DEBUG_0 (isns_reg_debug & 1, (Registering Portal)); newPortalRegFlag = FALSE; portalPortIndex = -1; portalIpIndex = -1; for (ii = 0; ii < SNS_MAX_ATTRS && key_indx[ ii ] ! && (portalIpIndex == -1 || portalPortIndex == -1); ii++) { key = (ISNS_Key *)( key_indx[ ii ] ); --- 698,710 ---- ISNS_DBKey read_key; ! DEBUG_0 (isns_reg_debug & 1, (Registering Portal Group)); newPortalRegFlag = FALSE; portalPortIndex = -1; portalIpIndex = -1; + iscsiIndex = -1; for (ii = 0; ii < SNS_MAX_ATTRS && key_indx[ ii ] ! && (portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1); ii++) { key = (ISNS_Key *)( key_indx[ ii ] ); *************** *** 733,736 **** --- 729,741 ---- portalPortIndex = ii; break; + case ISNS_ISCSI_NODE_ID: + /* Check to see if we already have an iscsi name */ + if (iscsiIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (ISCSI Name tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + iscsiIndex = ii; + break; default: break; *************** *** 762,766 **** for ( ii = saveIndex; ii < SNS_MAX_ATTRS && attr_indx[ii] ! && (portalIpIndex == -1 || portalPortIndex == -1); ii++ ) { attr = (ISNS_Attr *) attr_indx[ ii ]; --- 767,771 ---- for ( ii = saveIndex; ii < SNS_MAX_ATTRS && attr_indx[ii] ! && (portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1); ii++ ) { attr = (ISNS_Attr *) attr_indx[ ii ]; *************** *** 785,788 **** --- 790,802 ---- portalPortIndex = ii; break; + case ISNS_ISCSI_NODE_ID: + /* Check to see if we already had an iscsi name */ + if (iscsiIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (ISCSI Node tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + iscsiIndex = ii; + break; default: break; *************** *** 790,795 **** } ! /* Check to see if we have both indices */ ! if ( portalIpIndex == -1 || portalPortIndex == -1 ) { DEBUG_0 (isns_reg_debug & 1, (PORTAL REG, MISSING KEYS)); --- 804,809 ---- } ! /* Check to see if we have all three indices */ ! if ( portalIpIndex == -1 || portalPortIndex == -1 || iscsiIndex == -1) { DEBUG_0 (isns_reg_debug & 1, (PORTAL REG, MISSING KEYS)); *************** *** 797,803 **** } - DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),attr->val.ip_port); attr = (ISNS_Attr *) attr_indx[ portalPortIndex ]; db_portal_group.ip_port = attr->val.ip_port; attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; --- 811,817 ---- } attr = (ISNS_Attr *) attr_indx[ portalPortIndex ]; db_portal_group.ip_port = attr->val.ip_port; + DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),attr->val.ip_port); attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; *************** *** 805,825 **** ISNS_PORTAL_IP_SIZE ); saveIndex = ii; } else { - DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),key->val.ip_port); /* Use Keys to fetch the portal Object */ key = (ISNS_Key *) key_indx[ portalPortIndex ]; db_portal_group.ip_port = key->val.ip_port; - DEBUG_1 (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); key = (ISNS_Key *) key_indx[ portalIpIndex ]; memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, key->len ); saveIndex = 0; } DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal_group.ip_addr.v); read_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); --- 819,847 ---- ISNS_PORTAL_IP_SIZE ); + attr = (ISNS_Attr *) attr_indx[ iscsiIndex ]; + memcpy ( (char *) db_portal_group.id.v, &attr->val, MAX_ISCSI_NODE_ID_SIZE); + saveIndex = ii; } else { /* Use Keys to fetch the portal Object */ key = (ISNS_Key *) key_indx[ portalPortIndex ]; db_portal_group.ip_port = key->val.ip_port; + DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),key->val.ip_port); key = (ISNS_Key *) key_indx[ portalIpIndex ]; memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, key->len ); + DEBUG_1 (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); + + attr = (ISNS_Attr *) key_indx[ iscsiIndex ]; + memcpy ( (char *) db_portal_group.id.v, &attr->val,MAX_ISCSI_NODE_ID_SIZE); + saveIndex = 0; } DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal_group.ip_addr.v); + read_key.tag = PORTAL_GROUP_ID_KEY; memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); *************** *** 831,835 **** { DEBUG_0 (isns_reg_debug & 1,Deregistering PortalGroup); ! // SNSRemovePortalEntry ((char *)&db_portal_group, NULL, NULL); rval = ERROR; } --- 853,857 ---- { DEBUG_0 (isns_reg_debug & 1,Deregistering PortalGroup); ! rval = ISNSdbDelete(&read_key); rval = ERROR; } *************** *** 845,851 **** return ( ISNS_INVALID_REG_ERR ); } /* create a new node element */ memset (&entry2, 0, sizeof (SOIP_DB_Entry)); ! entry2.data_type = PORTAL_ID_KEY; attr = (ISNS_Attr *) attr_indx[portalIpIndex]; --- 867,874 ---- return ( ISNS_INVALID_REG_ERR ); } + /* create a new node element */ memset (&entry2, 0, sizeof (SOIP_DB_Entry)); ! entry2.data_type = PORTAL_GROUP_ID_KEY; attr = (ISNS_Attr *) attr_indx[portalIpIndex]; *************** *** 855,859 **** p_portal_group->ip_port = attr->val.ip_port; ! //p_portal_group->portal_index = ISNSGetNewPortalIdx(); newPortalRegFlag = TRUE; --- 878,883 ---- p_portal_group->ip_port = attr->val.ip_port; ! attr = (ISNS_Attr *) attr_indx[iscsiIndex]; ! memcpy (p_portal_group->id.v, attr->val.node_name.v, attr->len); newPortalRegFlag = TRUE; *************** *** 874,887 **** stopFlag = TRUE; break; ! case ISNS_PORTAL_GROUP: ! //if (p_portal->group!=*(uint32_t *)&attr->val) ! //{ ! // p_portal->group=*(uint32_t *)&attr->val; ! ! // ISNSAppendKey( p_scn_all_msg_buffer, ISNS_PORTAL_GROUP, ! // ISNS_PORTAL_GROUP_SIZE, NULL, p_portal->group ); ! //updateFlag = TRUE; ! //} break; default: --- 898,908 ---- stopFlag = TRUE; break; ! case ISNS_ISCSI_NODE_ID: ! { ! ISNSAppendKey( p_scn_all_msg_buffer, ISNS_ISCSI_NODE_ID, ! PAD4(strlen(p_portal_group->id.v)), p_portal_group->id.v,0); ! updateFlag = TRUE; ! } break; default: *************** *** 934,938 **** } ! DEBUG_0 (isns_reg_debug &1,return); return (ISNS_NO_ERR); } --- 955,959 ---- } ! DEBUG_0 (isns_reg_debug &1, End of AddAttrPortalGroup); return (ISNS_NO_ERR); } *************** *** 1567,1570 **** --- 1588,1592 ---- ISNS_DBKey key; int rval; + SOIP_DB_Entry lentry; pnode = NULL; *************** *** 1584,1588 **** key.tag = ISCSI_ID_KEY; strcpy(key.val.node_key.v,ptr); ! rval = ISNSdbRead(&key,&entry2); if ( rval != SUCCESS) --- 1606,1610 ---- key.tag = ISCSI_ID_KEY; strcpy(key.val.node_key.v,ptr); ! rval = ISNSdbRead(&key,&lentry); if ( rval != SUCCESS) *************** *** 1605,1609 **** else { ! p_node = (SOIP_Iscsi *)&entry2.data; new_member.node_idx = p_node->iscsi_index; } --- 1627,1631 ---- else { ! p_node = (SOIP_Iscsi *)&lentry.data; new_member.node_idx = p_node->iscsi_index; } Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** iSNSdb.c 18 Dec 2006 19:02:46 -0000 1.22 --- iSNSdb.c 18 Dec 2006 23:00:04 -0000 1.23 *************** *** 171,175 **** --- 171,178 ---- } if (entry->data_type != ENTITY_ID_KEY) + { + DEBUG_1 (isns_db_debug & 1, (read failed ENTITY node - invalid data in database %s),key->val.entity_key.id); return (ISNS_UNKNOWN_ERR); + } entry->data.entity.iportal_list.p_entry = &entry->data.entity; entry->data.entity.iscsi_node_list.p_entry = &entry->data.entity; *************** *** 329,332 **** --- 332,337 ---- k.dsize = 0; + entry.data_type = key->tag; + switch (key->tag) { *************** *** 357,361 **** --- 362,370 ---- break; case ENTITY_ID_KEY: + { + SOIP_Entity * p_entity; + p_entity = &entry.data.entity; DEBUG_1 (isns_db_debug &1,Entity write:%s,key->val.entity_key.id); + DEBUG_1 (isns_db_debug &1,Entity write:%s,p_entity->eid.id); k.dptr = (char *)key->val.entity_key.id; k.dsize = strlen(key->val.entity_key.id); *************** *** 365,368 **** --- 374,378 ---- //ISNSDisplay_Entity (&entry.data.entity,HI_DETAIL); break; + } case PORT_NAME_KEY: k.dptr = (char *)key->val.port_name.v; |