From 40f53a97d3ab6786d2bb609e0cbfcd8cde2d5500 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 2 Jul 2002 20:44:25 +0000 Subject: [PATCH] Partition update API enabled and scontrol converted. --- src/api/partition_info.c | 35 ++++++++++++++++++++++++++++++----- src/api/slurm.h | 2 +- src/api/update_config.c | 23 ++++++++++++++++++----- 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/api/partition_info.c b/src/api/partition_info.c index add5600ed14..225362e597f 100644 --- a/src/api/partition_info.c +++ b/src/api/partition_info.c @@ -52,11 +52,36 @@ void slurm_print_partition_table ( FILE* out, partition_table_t * part_ptr ) { int j ; - fprintf ( out, "PartitionName=%s MaxTime=%u ", part_ptr->name, part_ptr->max_time); - fprintf ( out, "MaxNodes=%u TotalNodes=%u ", part_ptr->max_nodes, part_ptr->total_nodes); - fprintf ( out, "TotalCPUs=%u Key=%u\n", part_ptr->total_cpus, part_ptr->key); - fprintf ( out, " Default=%u ", part_ptr->default_part); - fprintf ( out, "Shared=%u StateUp=%u ", part_ptr->shared, part_ptr->state_up); + fprintf ( out, "PartitionName=%s ", part_ptr->name); + if (part_ptr->max_time == INFINITE) + fprintf ( out, "MaxTime=INFINITE "); + else + fprintf ( out, "MaxTime=%u ", part_ptr->max_time); + if (part_ptr->max_nodes == INFINITE) + fprintf ( out, "MaxNodes=INFINITE "); + else + fprintf ( out, "MaxNodes=%u ", part_ptr->max_nodes); + fprintf ( out, "TotalNodes=%u ", part_ptr->total_nodes); + fprintf ( out, "TotalCPUs=%u ", part_ptr->total_cpus); + if (part_ptr->key) + fprintf ( out, "Key=YES\n"); + else + fprintf ( out, "Key=NO\n"); + if (part_ptr->default_part) + fprintf ( out, " Default=YES "); + else + fprintf ( out, " Default=NO "); + if (part_ptr->shared == SHARED_NO) + fprintf ( out, "Shared=NO "); + else if (part_ptr->shared == SHARED_YES) + fprintf ( out, "Shared=YES "); + else + fprintf ( out, "Shared=FORCE "); + if (part_ptr->state_up) + fprintf ( out, "State=UP "); + else + fprintf ( out, "State=DOWN "); + fprintf ( out, "Nodes=%s AllowGroups=%s\n", part_ptr->nodes, part_ptr->allow_groups); fprintf ( out, " NodeIndecies="); for (j = 0; part_ptr->node_inx; j++) { diff --git a/src/api/slurm.h b/src/api/slurm.h index 48d835d2e4b..589cf1fb233 100644 --- a/src/api/slurm.h +++ b/src/api/slurm.h @@ -188,4 +188,4 @@ extern int slurm_reconfigure (); * slurm_update_node - updates the node state */ int slurm_update_node ( update_node_msg_t * node_msg ) ; -int slurm_update_partition ( partition_desc_msg_t * desc_msg ) ; +int slurm_update_partition ( update_part_msg_t * desc_msg ) ; diff --git a/src/api/update_config.c b/src/api/update_config.c index fb936874fa4..6b12bfb055c 100644 --- a/src/api/update_config.c +++ b/src/api/update_config.c @@ -22,7 +22,7 @@ */ int slurm_update_node ( update_node_msg_t * node_msg ) { - int msg_size ; + int msg_size; int rc ; slurm_fd sockfd ; slurm_msg_t request_msg ; @@ -34,7 +34,6 @@ int slurm_update_node ( update_node_msg_t * node_msg ) if ( ( sockfd = slurm_open_controller_conn ( ) ) == SLURM_SOCKET_ERROR ) return SLURM_SOCKET_ERROR ; - /* send request message */ request_msg . msg_type = REQUEST_UPDATE_NODE ; request_msg . data = node_msg ; @@ -42,7 +41,6 @@ int slurm_update_node ( update_node_msg_t * node_msg ) if ( ( rc = slurm_send_controller_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR ) return SLURM_SOCKET_ERROR ; - /* receive message */ if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR ) return SLURM_SOCKET_ERROR ; @@ -64,18 +62,33 @@ int slurm_update_node ( update_node_msg_t * node_msg ) return SLURM_SUCCESS ; } -int slurm_update_partition ( partition_desc_msg_t * desc_msg ) +int slurm_update_partition ( update_part_msg_t * desc_msg ) { + int msg_size; int rc ; + slurm_fd sockfd ; slurm_msg_t request_msg ; slurm_msg_t response_msg ; return_code_msg_t * rc_msg ; + /* init message connection for message communication with controller */ + + if ( ( sockfd = slurm_open_controller_conn ( ) ) == SLURM_SOCKET_ERROR ) + return SLURM_SOCKET_ERROR ; + /* send request message */ request_msg . msg_type = REQUEST_UPDATE_PARTITION ; request_msg . data = desc_msg ; - if ( ( rc = slurm_send_recv_controller_msg ( & request_msg , & response_msg ) ) == SLURM_SOCKET_ERROR ) + if ( ( rc = slurm_send_controller_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR ) + return SLURM_SOCKET_ERROR ; + + + /* receive message */ + if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR ) + return SLURM_SOCKET_ERROR ; + /* shutdown message connection */ + if ( ( rc = slurm_shutdown_msg_conn ( sockfd ) ) == SLURM_SOCKET_ERROR ) return SLURM_SOCKET_ERROR ; switch ( response_msg . msg_type ) -- GitLab