From: smiley@akasha.eng.hou.compaq.com (Colin Smiley)
Newsgroups: comp.sys.isis
Subject: On the fly group memberships...
Keywords: joining, and leaving...and joining....and leaving...
Date: 29 Sep 92 22:29:27 GMT
Article-I.D.: twisto.1992Sep29.222927.7848
Followup-To: smiley@compaq.com
Organization: Compaq Computer Corporation


I am having a problem doing something that I believe should be able to
be done with the ISIS 3.0.6 toolkit.

First a description.

Say that we have some master group.  This group is responsible for
telling machines (or resources) where to go (as in what group(s) to
join).  If a resource contacts the master group (does not join it,
just checks for its existance and does a bcast to it), and gets the
name of the group that the resource belongs to, shouldn't the
resource be able to join the designated group?  As far as I have been
able to tell from the docs, what I am trying to do is possible.  It
just doesn't seem to be working.

Here are some more concrete examples...

for master.c

void
main ( argc , argv )
int argc ;
char **argv ;
{
	
  .
  .
  .

  isis_remote_init ( ac_IsisHost , i_IsisPort , 0 , ISIS_NOCOPYRIGHTNOTICE ) ;
  
  isis_task ( adminInit , "adminInit" ) ;
  isis_task ( adminGroupChange , "adminGroupChange" ) ; 
  isis_entry ( ADMIN_RUN_REQ, reportGroup, "reportGroup" ) ;
  isis_mainloop ( adminInit, NULLARG ) ;
}

The init and the group change are pretty standard...

void 
reportGroup ( pMS_msg ) 
message *pMS_msg ;
{
  char ac_member[STRING_SIZE] ;
  
  msg_get ( pMS_msg , "%s" , ac_member ) ;
  printf ("Just recieved a request from %s.\n", ac_member ) ;
  reply ( pMS_msg ,"%s", RUN ) ;
  printf ("Replied with %s.\n", RUN ) ;

  return ;
}


Now this all seems to work fine.  The problem is in the resource
program who is trying to get assigned to a group....

excerpts from resource.c....

void
main ( argc , argv )
int argc ;
char **argv ;
{
  
  .
  .
  .


  isis_remote_init ( ac_IsisHost , i_IsisPort , 0 ,
		    ISIS_NOCOPYRIGHTNOTICE | ISIS_PANIC ) ;

  isis_task ( runSetup , "runSetup" ) ;

  isis_mainloop ( runSetup , 0 ) ;
}

void
runSetup () 
{
  groupview *pGV_group ;
  char ac_host[STRING_SIZE] ;
  

  pAD_Master = pg_lookup ( MASTER_GRP ) ;
  if ( addr_isnull ( pAD_Master ) ) {
    fprintf ( stderr ,"%s service does not exist yet.\n",
	     MASTER_GRP ) ;
    exit ( NOERR ) ;
  }
    
  gethostname ( ac_host , STRING_SIZE ) ;
  bcast ( pAD_Master ,ADMIN_RUN_REQ,"%s", ac_host ,1,"%s" , ac_Group ) ;
  if ( NIL (char *) != ac_Group ) {
    printf ("Joining %s\n", ac_Group ) ;
    pAD_Run = pg_join ( ac_Group , PG_DONTCREATE ) ;
  }
  isis_start_done () ;
  if ( NIL (groupview *) == ( pGV_group = pg_getview ( pAD_Run ) ) ) {
    fprintf ( stderr ,"Could not get group info, bye...\n") ;
    pg_leave ( pAD_Run ) ;
    exit ( 0 ) ;
  }
  printf ("There are %d group members...\n", pGV_group->gv_nmemb ) ;
  return ;
}


Now, I know the group that resource is trying to join exists.  When
the resource runs, it gets the group name from the master group, then
the pg_join() appears to succeed, but when I do the getview() I get a
NULL pointer back.

Now for the questions...

1) Is what I'm trying to do possible?  I am assuming that it is.

2) Could this problem be due to where I am doing the
isis_start_done()?

3) Have I missed something painfully obvious?


Thanks for your help...

Colin

P.S.  Keep in mind that I am still learning the toolkit.  The
documentation does not help much either.  Is IDS planning to update
the docs anytime soon?


-- 
-------------------------------------------------------------------------
Colin Smiley, Compaq Computer Corporation, Houston, Texas 77269-2000
e-mail: smiley@compaq.com                           Phone: (713) 378-8426
-------------------------------------------------------------------------
Disclaimer:  Any opinions expressed here do not reflect the opinions of
Compaq Computer Corp.  They make computers.  I make noise.
Newsgroups: comp.sys.isis