root/tools/crm_resource.h

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

INCLUDED FROM


   1 
   2 /*
   3  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   4  *
   5  * This program is free software; you can redistribute it and/or
   6  * modify it under the terms of the GNU Lesser General Public
   7  * License as published by the Free Software Foundation; either
   8  * version 2 of the License, or (at your option) any later version.
   9  *
  10  * This software is distributed in the hope that it will be useful,
  11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13  * General Public License for more details.
  14  *
  15  * You should have received a copy of the GNU Lesser General Public
  16  * License along with this library; if not, write to the Free Software
  17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  18  */
  19 
  20 #include <crm_internal.h>
  21 #include <crm/crm.h>
  22 
  23 #include <crm/msg_xml.h>
  24 #include <crm/services.h>
  25 #include <crm/common/xml.h>
  26 #include <crm/common/mainloop.h>
  27 
  28 #include <crm/cib.h>
  29 #include <crm/attrd.h>
  30 #include <crm/pengine/rules.h>
  31 #include <crm/pengine/status.h>
  32 #include <crm/pengine/internal.h>
  33 #include "../pengine/pengine.h"
  34 #include "fake_transition.h"
  35 
  36 extern bool print_pending;
  37 
  38 extern bool scope_master;
  39 extern bool do_force;
  40 extern bool BE_QUIET;
  41 extern int resource_verbose;
  42 
  43 extern int cib_options;
  44 extern int crmd_replies_needed;
  45 
  46 extern char *move_lifetime;
  47 
  48 extern const char *attr_set_type;
  49 
  50 /* ban */
  51 int cli_resource_prefer(const char *rsc_id, const char *host, cib_t * cib_conn);
  52 int cli_resource_ban(const char *rsc_id, const char *host, GListPtr allnodes, cib_t * cib_conn);
  53 int cli_resource_clear(const char *rsc_id, const char *host, GListPtr allnodes, cib_t * cib_conn);
  54 
  55 /* print */
  56 void cli_resource_print_cts(resource_t * rsc);
  57 void cli_resource_print_raw(resource_t * rsc);
  58 void cli_resource_print_cts_constraints(pe_working_set_t * data_set);
  59 void cli_resource_print_location(resource_t * rsc, const char *prefix);
  60 void cli_resource_print_colocation(resource_t * rsc, bool dependents, bool recursive, int offset);
  61 
  62 int cli_resource_print(resource_t *rsc, pe_working_set_t *data_set,
  63                        bool expanded);
  64 int cli_resource_print_list(pe_working_set_t * data_set, bool raw);
  65 int cli_resource_print_attribute(resource_t *rsc, const char *attr,
  66                                  pe_working_set_t *data_set);
  67 int cli_resource_print_property(resource_t *rsc, const char *attr,
  68                                 pe_working_set_t *data_set);
  69 int cli_resource_print_operations(const char *rsc_id, const char *host_uname, bool active, pe_working_set_t * data_set);
  70 
  71 /* runtime */
  72 void cli_resource_check(cib_t * cib, resource_t *rsc);
  73 int cli_resource_fail(crm_ipc_t * crmd_channel, const char *host_uname, const char *rsc_id, pe_working_set_t * data_set);
  74 int cli_resource_search(resource_t *rsc, const char *requested_name,
  75                         pe_working_set_t *data_set);
  76 int cli_resource_delete(crm_ipc_t *crmd_channel, const char *host_uname,
  77                         resource_t *rsc, const char *operation,
  78                         const char *interval, pe_working_set_t *data_set);
  79 int cli_resource_restart(resource_t * rsc, const char *host, int timeout_ms, cib_t * cib);
  80 int cli_resource_move(resource_t *rsc, const char *rsc_id,
  81                       const char *host_name, cib_t *cib,
  82                       pe_working_set_t *data_set);
  83 int cli_resource_execute(resource_t *rsc, const char *requested_name,
  84                          const char *rsc_action, GHashTable *override_hash,
  85                          int timeout_ms, cib_t *cib,
  86                          pe_working_set_t *data_set);
  87 
  88 int cli_resource_update_attribute(resource_t *rsc, const char *requested_name,
  89                                   const char *attr_set, const char *attr_id,
  90                                   const char *attr_name, const char *attr_value,
  91                                   bool recursive, cib_t *cib,
  92                                   pe_working_set_t *data_set);
  93 int cli_resource_delete_attribute(resource_t *rsc, const char *requested_name,
  94                                   const char *attr_set, const char *attr_id,
  95                                   const char *attr_name, cib_t *cib,
  96                                   pe_working_set_t *data_set);
  97 
  98 int update_working_set_xml(pe_working_set_t *data_set, xmlNode **xml);
  99 int wait_till_stable(int timeout_ms, cib_t * cib);
 100 void cli_resource_why(cib_t *cib_conn, GListPtr resources, resource_t *rsc,
 101                       node_t *node);
 102 
 103 extern xmlNode *do_calculations(pe_working_set_t * data_set, xmlNode * xml_input, crm_time_t * now);
 104 extern void cleanup_alloc_calculations(pe_working_set_t * data_set);
 105 
 106 #define CMD_ERR(fmt, args...) do {              \
 107         crm_warn(fmt, ##args);                  \
 108         fprintf(stderr, fmt"\n", ##args);               \
 109     } while(0)
 110 

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