root/tools/crm_mon_runtime.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. blank_screen
  2. compare_attribute
  3. append_attr_list
  4. crm_mon_get_parameters
  5. get_resource_display_options

   1 /*
   2  * Copyright 2019 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU General Public License version 2
   7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #include <glib.h>
  11 #include <stdio.h>
  12 #include <stdlib.h>
  13 
  14 #include <crm/crm.h>
  15 #include <crm/msg_xml.h>
  16 #include <crm/common/curses_internal.h>
  17 #include <crm/pengine/common.h>
  18 #include <crm/pengine/internal.h>
  19 #include <crm/pengine/pe_types.h>
  20 #include <crm/stonith-ng.h>
  21 #include <crm/common/internal.h>
  22 #include <crm/common/util.h>
  23 
  24 #include "crm_mon.h"
  25 
  26 void
  27 blank_screen(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29 #if CURSES_ENABLED
  30     int lpc = 0;
  31 
  32     for (lpc = 0; lpc < LINES; lpc++) {
  33         move(lpc, 0);
  34         clrtoeol();
  35     }
  36     move(0, 0);
  37     refresh();
  38 #endif
  39 }
  40 
  41 static int
  42 compare_attribute(gconstpointer a, gconstpointer b)
     /* [previous][next][first][last][top][bottom][index][help] */
  43 {
  44     int rc;
  45 
  46     rc = strcmp((const char *)a, (const char *)b);
  47 
  48     return rc;
  49 }
  50 
  51 GList *
  52 append_attr_list(GList *attr_list, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54     int i;
  55     const char *filt_str[] = FILTER_STR;
  56 
  57     CRM_CHECK(name != NULL, return attr_list);
  58 
  59     /* filtering automatic attributes */
  60     for (i = 0; filt_str[i] != NULL; i++) {
  61         if (g_str_has_prefix(name, filt_str[i])) {
  62             return attr_list;
  63         }
  64     }
  65 
  66     return g_list_insert_sorted(attr_list, name, compare_attribute);
  67 }
  68 
  69 void
  70 crm_mon_get_parameters(pe_resource_t *rsc, pe_working_set_t * data_set)
     /* [previous][next][first][last][top][bottom][index][help] */
  71 {
  72     get_rsc_attributes(rsc->parameters, rsc, NULL, data_set);
  73     if(rsc->children) {
  74         GListPtr gIter = NULL;
  75 
  76         for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
  77             crm_mon_get_parameters(gIter->data, data_set);
  78         }
  79     }
  80 }
  81 
  82 /*!
  83  * \internal
  84  * \brief Return resource display options corresponding to command-line choices
  85  *
  86  * \return Bitmask of pe_print_options suitable for resource print functions
  87  */
  88 unsigned int
  89 get_resource_display_options(unsigned int mon_ops)
     /* [previous][next][first][last][top][bottom][index][help] */
  90 {
  91     int print_opts = 0;
  92 
  93     if (pcmk_is_set(mon_ops, mon_op_print_pending)) {
  94         print_opts |= pe_print_pending;
  95     }
  96     if (pcmk_is_set(mon_ops, mon_op_print_clone_detail)) {
  97         print_opts |= pe_print_clone_details|pe_print_implicit;
  98     }
  99     if (!pcmk_is_set(mon_ops, mon_op_inactive_resources)) {
 100         print_opts |= pe_print_clone_active;
 101     }
 102     if (pcmk_is_set(mon_ops, mon_op_print_brief)) {
 103         print_opts |= pe_print_brief;
 104     }
 105     return print_opts;
 106 }

/* [previous][next][first][last][top][bottom][index][help] */