Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
23cc9708
Commit
23cc9708
authored
11 years ago
by
Morris Jette
Browse files
Options
Downloads
Patches
Plain Diff
switch/generic: add node name to node_info data structure
parent
81fac899
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/switch/generic/switch_generic.c
+20
-3
20 additions, 3 deletions
src/plugins/switch/generic/switch_generic.c
with
20 additions
and
3 deletions
src/plugins/switch/generic/switch_generic.c
+
20
−
3
View file @
23cc9708
...
@@ -67,6 +67,7 @@ typedef struct sw_gen_node_info {
...
@@ -67,6 +67,7 @@ typedef struct sw_gen_node_info {
uint32_t
magic
;
uint32_t
magic
;
uint16_t
ifa_cnt
;
uint16_t
ifa_cnt
;
sw_gen_ifa_t
**
ifa_array
;
sw_gen_ifa_t
**
ifa_array
;
char
*
node_name
;
}
sw_gen_node_info_t
;
}
sw_gen_node_info_t
;
typedef
struct
sw_gen_node
{
typedef
struct
sw_gen_node
{
...
@@ -142,6 +143,7 @@ int switch_p_libstate_save(char * dir_name)
...
@@ -142,6 +143,7 @@ int switch_p_libstate_save(char * dir_name)
{
{
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
info
(
"switch_p_libstate_save() starting"
);
info
(
"switch_p_libstate_save() starting"
);
/* No state saved or restored for this plugin */
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
...
@@ -149,6 +151,7 @@ int switch_p_libstate_restore(char * dir_name, bool recover )
...
@@ -149,6 +151,7 @@ int switch_p_libstate_restore(char * dir_name, bool recover )
{
{
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
info
(
"switch_p_libstate_restore() starting"
);
info
(
"switch_p_libstate_restore() starting"
);
/* No state saved or restored for this plugin */
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
...
@@ -519,11 +522,19 @@ extern int switch_p_build_node_info(switch_node_info_t *switch_node)
...
@@ -519,11 +522,19 @@ extern int switch_p_build_node_info(switch_node_info_t *switch_node)
sw_gen_ifa_t
*
ifa_ptr
;
sw_gen_ifa_t
*
ifa_ptr
;
void
*
addr_ptr
=
NULL
;
void
*
addr_ptr
=
NULL
;
char
addr_str
[
INET6_ADDRSTRLEN
],
*
ip_family
;
char
addr_str
[
INET6_ADDRSTRLEN
],
*
ip_family
;
char
hostname
[
256
],
*
tmp
;
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
info
(
"switch_p_build_node_info() starting"
);
info
(
"switch_p_build_node_info() starting"
);
xassert
(
gen_node_info
);
xassert
(
gen_node_info
);
xassert
(
gen_node_info
->
magic
==
SW_GEN_NODE_INFO_MAGIC
);
xassert
(
gen_node_info
->
magic
==
SW_GEN_NODE_INFO_MAGIC
);
if
(
gethostname
(
hostname
,
sizeof
(
hostname
))
<
0
)
return
SLURM_ERROR
;
/* remove the domain portion, if necessary */
tmp
=
strstr
(
hostname
,
"."
);
if
(
tmp
)
*
tmp
=
'\0'
;
gen_node_info
->
node_name
=
xstrdup
(
hostname
);
if
(
getifaddrs
(
&
if_array
)
==
0
)
{
if
(
getifaddrs
(
&
if_array
)
==
0
)
{
for
(
if_rec
=
if_array
;
if_rec
;
if_rec
=
if_rec
->
ifa_next
)
{
for
(
if_rec
=
if_array
;
if_rec
;
if_rec
=
if_rec
->
ifa_next
)
{
if
(
!
if_rec
->
ifa_addr
->
sa_data
)
if
(
!
if_rec
->
ifa_addr
->
sa_data
)
...
@@ -577,6 +588,7 @@ extern int switch_p_pack_node_info(switch_node_info_t *switch_node,
...
@@ -577,6 +588,7 @@ extern int switch_p_pack_node_info(switch_node_info_t *switch_node,
xassert
(
gen_node_info
);
xassert
(
gen_node_info
);
xassert
(
gen_node_info
->
magic
==
SW_GEN_NODE_INFO_MAGIC
);
xassert
(
gen_node_info
->
magic
==
SW_GEN_NODE_INFO_MAGIC
);
pack16
(
gen_node_info
->
ifa_cnt
,
buffer
);
pack16
(
gen_node_info
->
ifa_cnt
,
buffer
);
packstr
(
gen_node_info
->
node_name
,
buffer
);
for
(
i
=
0
;
i
<
gen_node_info
->
ifa_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
gen_node_info
->
ifa_cnt
;
i
++
)
{
ifa_ptr
=
gen_node_info
->
ifa_array
[
i
];
ifa_ptr
=
gen_node_info
->
ifa_array
[
i
];
packstr
(
ifa_ptr
->
ifa_addr
,
buffer
);
packstr
(
ifa_ptr
->
ifa_addr
,
buffer
);
...
@@ -600,6 +612,8 @@ extern int switch_p_unpack_node_info(switch_node_info_t *switch_node,
...
@@ -600,6 +612,8 @@ extern int switch_p_unpack_node_info(switch_node_info_t *switch_node,
safe_unpack16
(
&
gen_node_info
->
ifa_cnt
,
buffer
);
safe_unpack16
(
&
gen_node_info
->
ifa_cnt
,
buffer
);
gen_node_info
->
ifa_array
=
xmalloc
(
sizeof
(
sw_gen_ifa_t
*
)
*
gen_node_info
->
ifa_array
=
xmalloc
(
sizeof
(
sw_gen_ifa_t
*
)
*
gen_node_info
->
ifa_cnt
);
gen_node_info
->
ifa_cnt
);
safe_unpackstr_xmalloc
(
&
gen_node_info
->
node_name
,
&
uint32_tmp
,
buffer
);
for
(
i
=
0
;
i
<
gen_node_info
->
ifa_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
gen_node_info
->
ifa_cnt
;
i
++
)
{
ifa_ptr
=
xmalloc
(
sizeof
(
sw_gen_ifa_t
));
ifa_ptr
=
xmalloc
(
sizeof
(
sw_gen_ifa_t
));
gen_node_info
->
ifa_array
[
i
]
=
ifa_ptr
;
gen_node_info
->
ifa_array
[
i
]
=
ifa_ptr
;
...
@@ -608,9 +622,10 @@ extern int switch_p_unpack_node_info(switch_node_info_t *switch_node,
...
@@ -608,9 +622,10 @@ extern int switch_p_unpack_node_info(switch_node_info_t *switch_node,
buffer
);
buffer
);
safe_unpackstr_xmalloc
(
&
ifa_ptr
->
ifa_name
,
&
uint32_tmp
,
buffer
);
safe_unpackstr_xmalloc
(
&
ifa_ptr
->
ifa_name
,
&
uint32_tmp
,
buffer
);
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
{
if
(
debug_flags
&
DEBUG_FLAG_SWITCH
)
{
info
(
"%s: name=%s ip_family=%s address=%s"
,
info
(
"%s: node=%s name=%s ip_family=%s address=%s"
,
plugin_type
,
ifa_ptr
->
ifa_name
,
plugin_type
,
gen_node_info
->
node_name
,
ifa_ptr
->
ifa_family
,
ifa_ptr
->
ifa_addr
);
ifa_ptr
->
ifa_name
,
ifa_ptr
->
ifa_family
,
ifa_ptr
->
ifa_addr
);
}
}
}
}
...
@@ -624,6 +639,7 @@ unpack_error:
...
@@ -624,6 +639,7 @@ unpack_error:
xfree
(
gen_node_info
->
ifa_array
[
i
]);
xfree
(
gen_node_info
->
ifa_array
[
i
]);
}
}
xfree
(
gen_node_info
->
ifa_array
);
xfree
(
gen_node_info
->
ifa_array
);
xfree
(
gen_node_info
->
node_name
);
gen_node_info
->
ifa_cnt
=
0
;
gen_node_info
->
ifa_cnt
=
0
;
return
SLURM_ERROR
;
return
SLURM_ERROR
;
}
}
...
@@ -644,6 +660,7 @@ extern int switch_p_free_node_info(switch_node_info_t **switch_node)
...
@@ -644,6 +660,7 @@ extern int switch_p_free_node_info(switch_node_info_t **switch_node)
xfree
(
gen_node_info
->
ifa_array
[
i
]);
xfree
(
gen_node_info
->
ifa_array
[
i
]);
}
}
xfree
(
gen_node_info
->
ifa_array
);
xfree
(
gen_node_info
->
ifa_array
);
xfree
(
gen_node_info
->
node_name
);
xfree
(
gen_node_info
);
xfree
(
gen_node_info
);
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment