[torquedev] [Bug 211] New: pbs_sched does not read TRQ_IFNAME
bugzilla-daemon at supercluster.org
bugzilla-daemon at supercluster.org
Tue Jul 31 08:55:42 MDT 2012
http://www.clusterresources.com/bugzilla/show_bug.cgi?id=211
Summary: pbs_sched does not read TRQ_IFNAME
Product: TORQUE
Version: 3.0.x
Platform: All
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: pbs_sched
AssignedTo: jrosenquist at adaptivecomputing.com
ReportedBy: taras.shapovalov at brightcomputing.com
CC: torquedev at supercluster.org
Estimated Hours: 0.0
The issue: if TRQ_IFNAME is defined in torque.cfg, then this affects just
pbs_server, but not pbs_sched daemon.
I have created patch which allows pbs_sched to use TRQ_IFNAME interface as well
as pbs_server already do. We have being testing the patch on 3.0.5, but it
suits for 2.5.x as well (pbs_sched.c files are the same in the both versions).
For 4.x it should be similar, but I have not tried it yet. This is my first
patch for torque, so I hope you will review it thoroughly.
--- ./torque-3.0.5/src/scheduler.cc/pbs_sched.c 2010-12-06
23:44:13.000000000 +0100
+++ ./torque-3.0.5_new/src/scheduler.cc/pbs_sched.c 2012-07-31
15:53:02.083264191 +0200
@@ -101,6 +101,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
#if defined(FD_SET_IN_SYS_SELECT_H)
# include <sys/select.h>
@@ -995,6 +997,26 @@
die(0);
}
+ // If TRQ_IFNAME is set in torque.cfg then listen to it
+ char *if_name = trq_get_if_name();
+ if(if_name)
+ {
+ struct ifreq ifr;
+ strncpy(ifr.ifr_name, if_name, sizeof(if_name));
+ if(ioctl(server_sock, SIOCGIFADDR, &ifr) < 0)
+ {
+ fprintf(stderr, "can not resolve the network interface: %s\n", if_name);
+ if(if_name)
+ free(if_name);
+ die(0);
+ }
+ struct in_addr *if_addr = &((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr;
+ char *if_addr_str = inet_ntoa(*if_addr);
+ memcpy(host, if_addr_str, strlen(if_addr_str));
+ memcpy(hp->h_addr, if_addr, sizeof(struct in_addr));
+ free(if_name);
+ }
+
if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR,
(char *)&t, sizeof(t)) == -1)
{
--
Configure bugmail: http://www.clusterresources.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the torquedev
mailing list