@@ -281,16 +281,15 @@ cib_delete_callback(xmlNode *msg, int call_id, int rc, xmlNode *output,
281281
282282/*!
283283 * \internal
284- * \brief Get the XPath and description of a node state section to be deleted
284+ * \brief Get the XPath and description of resource history to be deleted
285285 *
286- * \param[in] uname Desired node
287- * \param[in] section Subsection of \c PCMK__XE_NODE_STATE to be deleted
288- * \param[out] xpath Where to store XPath of \p section
289- * \param[out] desc If not \c NULL, where to store description of \p section
286+ * \param[in] uname Name of node to delete resource history for
287+ * \param[in] unlocked_only If true, delete history of only unlocked resources
288+ * \param[out] xpath Where to store XPath for history deletion
289+ * \param[out] desc If not NULL, where to store loggable description
290290 */
291291void
292- controld_node_state_deletion_strings (const char * uname ,
293- enum controld_section_e section ,
292+ controld_node_state_deletion_strings (const char * uname , bool unlocked_only ,
294293 char * * xpath , char * * desc )
295294{
296295 const char * desc_pre = NULL ;
@@ -299,20 +298,13 @@ controld_node_state_deletion_strings(const char *uname,
299298 long long expire = (long long ) time (NULL )
300299 - controld_globals .shutdown_lock_limit ;
301300
302- switch (section ) {
303- case controld_section_lrm :
304- * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM , uname );
305- desc_pre = "resource history" ;
306- break ;
307- case controld_section_lrm_unlocked :
308- * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM_UNLOCKED , uname ,
309- uname , expire );
310- desc_pre = "resource history (other than shutdown locks)" ;
311- break ;
312- default :
313- // We called this function incorrectly
314- pcmk__assert (false);
315- break ;
301+ if (unlocked_only ) {
302+ * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM_UNLOCKED ,
303+ uname , uname , expire );
304+ desc_pre = "resource history (other than shutdown locks)" ;
305+ } else {
306+ * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM , uname );
307+ desc_pre = "resource history" ;
316308 }
317309
318310 if (desc != NULL ) {
@@ -322,15 +314,14 @@ controld_node_state_deletion_strings(const char *uname,
322314
323315/*!
324316 * \internal
325- * \brief Delete subsection of a node's CIB \c PCMK__XE_NODE_STATE
317+ * \brief Delete a node's resource history from the CIB
326318 *
327- * \param[in] uname Desired node
328- * \param[in] section Subsection of \c PCMK__XE_NODE_STATE to delete
329- * \param[in] options CIB call options to use
319+ * \param[in] uname Name of node to delete resource history for
320+ * \param[in] unlocked_only If true, delete history of only unlocked resources
321+ * \param[in] options CIB call options to use
330322 */
331323void
332- controld_delete_node_state (const char * uname , enum controld_section_e section ,
333- int options )
324+ controld_delete_node_state (const char * uname , bool unlocked_only , int options )
334325{
335326 cib_t * cib = controld_globals .cib_conn ;
336327 char * xpath = NULL ;
@@ -339,8 +330,7 @@ controld_delete_node_state(const char *uname, enum controld_section_e section,
339330
340331 pcmk__assert ((uname != NULL ) && (cib != NULL ));
341332
342- controld_node_state_deletion_strings (uname , section , & xpath , & desc );
343-
333+ controld_node_state_deletion_strings (uname , unlocked_only , & xpath , & desc );
344334 cib__set_call_options (options , "node state deletion" ,
345335 cib_xpath |cib_multiple );
346336 cib_rc = cib -> cmds -> remove (cib , xpath , NULL , options );
0 commit comments