pbs_mom hostname patch - WAS: [torquedev] any other patches?

Toni L. Harbaugh-Blackford [Contr] harbaugh at ncifcrf.gov
Wed Feb 14 04:17:57 MST 2007


On Wed, 14 Feb 2007, Garrick Staples wrote:

  > I think I've got all of the recent contributions in svn.  Did I miss
  > anything?

Please consider the attached patch for inclusion.  It allows pbs_mom to startup
with an alternate hostname, similar to the '-h' flag for pbs_server.  It is
useful in the case where, for instance, mom needs to be associated with an
infiniband interface but the system hostname cannot be.

Thanks,
Toni

-------------------------------------------------------------------
Toni Harbaugh-Blackford                   harbaugh at abcc.ncifcrf.gov
System Administrator
Advanced Biomedical Computing Center (ABCC)
National Cancer Institute
Contractor - SAIC/Frederick
-------------- next part --------------
--- torque-2.2.0-snap.200611291634/src/resmom/mom_main.c_orig	2006-11-28 15:41:51.000000000 -0500
+++ torque-2.2.0-snap.200611291634/src/resmom/mom_main.c	2007-02-09 08:32:10.000000000 -0500
@@ -169,6 +169,7 @@
 int		lockfds = -1;
 time_t		loopcnt;		/* used for MD5 calc */
 float		max_load_val = -1.0;
+int		hostname_specified = 0;
 char		mom_host[PBS_MAXHOSTNAME + 1];
 char		pbs_servername[PBS_MAXSERVER][PBS_MAXSERVERNAME + 1];
 u_long		MOMServerAddrs[PBS_MAXSERVER];
@@ -6000,7 +6001,7 @@
 
   errflg = 0;
 
-  while ((c = getopt(argc,argv,"a:c:C:d:L:M:prR:S:vx")) != -1) 
+  while ((c = getopt(argc,argv,"a:c:h:C:d:L:M:prR:S:vx")) != -1) 
     {
     switch (c) 
       {
@@ -6026,6 +6027,14 @@
 
         break;
 
+      case 'h':	/* multihomed host */
+
+        hostname_specified = 1;
+
+        strncpy(mom_host,optarg,PBS_MAXHOSTNAME);	/* remember name */
+
+        break;
+
       case 'C':
 
 #if MOM_CHECKPOINT == 1
@@ -6571,7 +6580,7 @@
   CLEAR_HEAD(svr_requests);
   CLEAR_HEAD(mom_varattrs);
 
-  if ((c = gethostname(mom_host,PBS_MAXHOSTNAME)) == 0) 
+  if ( hostname_specified || ( (c = gethostname(mom_host,PBS_MAXHOSTNAME)) == 0) ) 
     {
     strcpy(mom_short_name,mom_host);
 


More information about the torquedev mailing list