@@ -279,16 +279,15 @@ cib_delete_callback(xmlNode *msg, int call_id, int rc, xmlNode *output,
279279
280280/*!
281281 * \internal
282- * \brief Get the XPath and description of a node state section to be deleted
282+ * \brief Get the XPath and description of resource history to be deleted
283283 *
284- * \param[in] uname Desired node
285- * \param[in] section Subsection of \c PCMK__XE_NODE_STATE to be deleted
286- * \param[out] xpath Where to store XPath of \p section
287- * \param[out] desc If not \c NULL, where to store description of \p section
284+ * \param[in] uname Name of node to delete resource history for
285+ * \param[in] unlocked_only If true, delete history of only unlocked resources
286+ * \param[out] xpath Where to store XPath for history deletion
287+ * \param[out] desc If not NULL, where to store loggable description
288288 */
289289void
290- controld_node_state_deletion_strings (const char * uname ,
291- enum controld_section_e section ,
290+ controld_node_state_deletion_strings (const char * uname , bool unlocked_only ,
292291 char * * xpath , char * * desc )
293292{
294293 const char * desc_pre = NULL ;
@@ -297,20 +296,13 @@ controld_node_state_deletion_strings(const char *uname,
297296 long long expire = (long long ) time (NULL )
298297 - controld_globals .shutdown_lock_limit ;
299298
300- switch (section ) {
301- case controld_section_lrm :
302- * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM , uname );
303- desc_pre = "resource history" ;
304- break ;
305- case controld_section_lrm_unlocked :
306- * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM_UNLOCKED , uname ,
307- uname , expire );
308- desc_pre = "resource history (other than shutdown locks)" ;
309- break ;
310- default :
311- // We called this function incorrectly
312- pcmk__assert (false);
313- break ;
299+ if (unlocked_only ) {
300+ * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM_UNLOCKED ,
301+ uname , uname , expire );
302+ desc_pre = "resource history (other than shutdown locks)" ;
303+ } else {
304+ * xpath = pcmk__assert_asprintf (XPATH_NODE_LRM , uname );
305+ desc_pre = "resource history" ;
314306 }
315307
316308 if (desc != NULL ) {
@@ -320,15 +312,14 @@ controld_node_state_deletion_strings(const char *uname,
320312
321313/*!
322314 * \internal
323- * \brief Delete subsection of a node's CIB \c PCMK__XE_NODE_STATE
315+ * \brief Delete a node's resource history from the CIB
324316 *
325- * \param[in] uname Desired node
326- * \param[in] section Subsection of \c PCMK__XE_NODE_STATE to delete
327- * \param[in] options CIB call options to use
317+ * \param[in] uname Name of node to delete resource history for
318+ * \param[in] unlocked_only If true, delete history of only unlocked resources
319+ * \param[in] options CIB call options to use
328320 */
329321void
330- controld_delete_node_state (const char * uname , enum controld_section_e section ,
331- int options )
322+ controld_delete_node_state (const char * uname , bool unlocked_only , int options )
332323{
333324 cib_t * cib = controld_globals .cib_conn ;
334325 char * xpath = NULL ;
@@ -337,8 +328,7 @@ controld_delete_node_state(const char *uname, enum controld_section_e section,
337328
338329 pcmk__assert ((uname != NULL ) && (cib != NULL ));
339330
340- controld_node_state_deletion_strings (uname , section , & xpath , & desc );
341-
331+ controld_node_state_deletion_strings (uname , unlocked_only , & xpath , & desc );
342332 cib__set_call_options (options , "node state deletion" ,
343333 cib_xpath |cib_multiple );
344334 cib_rc = cib -> cmds -> remove (cib , xpath , NULL , options );
0 commit comments