ctdb-daemon: Drop --single-public-ip option and related code
authorMartin Schwenke <martin@meltin.net>
Sun, 10 Apr 2016 22:02:36 +0000 (08:02 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 15 Apr 2016 03:57:18 +0000 (05:57 +0200)
This has been replaced by scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/doc/ctdbd.1.xml
ctdb/include/ctdb_private.h
ctdb/server/ctdb_takeover.c
ctdb/server/ctdbd.c

index ae61792bcfd72f161ed45acd46ee03f2f59e9cf1..cf792135ccebef48dcc06693983a7153de38ddb5 100644 (file)
        <term>--public-interface=<parameter>INTERFACE</parameter></term>
        <listitem>
          <para>
-           INTERFACE on which to attach public IP addresses or on which
-           to attach the single-public-ip when used.
+           Default INTERFACE on which to attach public IP addresses.
          </para>
          <para>
            When using public IP addresses, this is only required if
        </listitem>
       </varlistentry>
 
-      <varlistentry>
-       <term>--single-public-ip=<parameter>IPADDR</parameter></term>
-       <listitem>
-         <para>
-           IPADDR specifies the single IP that CTDB will use in
-           conjunction with LVS.
-         </para>
-         <para>
-           Please see the <citetitle>LVS</citetitle> section in
-           <citerefentry><refentrytitle>ctdb</refentrytitle>
-           <manvolnum>7</manvolnum></citerefentry> for more
-           information.
-         </para>
-       </listitem>
-      </varlistentry>
-
       <varlistentry>
        <term>--start-as-disabled</term>
        <listitem>
index bf45246c548d21d2ada61f6c786d0d09ed11bab4..b17af53e744ba728e94c75696e83e725642577a7 100644 (file)
@@ -318,7 +318,6 @@ struct ctdb_context {
        struct reqid_context *idr;
        struct ctdb_node **nodes; /* array of nodes in the cluster - indexed by vnn */
        struct ctdb_vnn *vnn; /* list of public ip addresses and interfaces */
-       struct ctdb_vnn *single_ip_vnn; /* a structure for the single ip */
        struct ctdb_interface *ifaces; /* list of local interfaces */
        char *err_msg;
        const struct ctdb_methods *methods; /* transport methods */
@@ -977,8 +976,6 @@ int32_t ctdb_control_ipreallocated(struct ctdb_context *ctdb,
                                 bool *async_reply);
 
 int ctdb_set_public_addresses(struct ctdb_context *ctdb, bool check_addresses);
-int ctdb_set_single_public_ip(struct ctdb_context *ctdb, const char *iface,
-                             const char *ip);
 
 int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap,
                      uint32_t *force_rebalance_nodes,
index d8f09ddb2fb793ec9774edc14d3917ee3c8d4b08..88656f974444f093ca87bc0ff857719cf4aec327 100644 (file)
@@ -114,10 +114,9 @@ static bool vnn_has_interface_with_name(struct ctdb_vnn *vnn,
  * foolproof.  One alternative is reference counting, where the logic
  * is distributed and can, therefore, be broken in multiple places.
  * Another alternative is to build a red-black tree of interfaces that
- * can have addresses (by walking ctdb->vnn and ctdb->single_ip_vnn
- * once) and then walking ctdb->ifaces once and deleting those not in
- * the tree.  Let's go to one of those if the naive implementation
- * causes problems...  :-)
+ * can have addresses (by walking ctdb->vnn once) and then walking
+ * ctdb->ifaces once and deleting those not in the tree.  Let's go to
+ * one of those if the naive implementation causes problems...  :-)
  */
 static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
                                        struct ctdb_vnn *vnn)
@@ -135,13 +134,6 @@ static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
                        continue;
                }
 
-               /* Is the "single IP" on this interface? */
-               if ((ctdb->single_ip_vnn != NULL) &&
-                   (ctdb->single_ip_vnn->ifaces[0] != NULL) &&
-                   (strcmp(i->name, ctdb->single_ip_vnn->ifaces[0]) == 0)) {
-                       /* Found, next interface please... */
-                       continue;
-               }
                /* Search for a vnn with this interface. */
                found = false;
                for (tv=ctdb->vnn; tv; tv=tv->next) {
@@ -1140,58 +1132,6 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, bool check_addresses)
        return 0;
 }
 
-int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
-                             const char *iface,
-                             const char *ip)
-{
-       struct ctdb_vnn *svnn;
-       struct ctdb_interface *cur = NULL;
-       bool ok;
-       int ret;
-
-       svnn = talloc_zero(ctdb, struct ctdb_vnn);
-       CTDB_NO_MEMORY(ctdb, svnn);
-
-       svnn->ifaces = talloc_array(svnn, const char *, 2);
-       CTDB_NO_MEMORY(ctdb, svnn->ifaces);
-       svnn->ifaces[0] = talloc_strdup(svnn->ifaces, iface);
-       CTDB_NO_MEMORY(ctdb, svnn->ifaces[0]);
-       svnn->ifaces[1] = NULL;
-
-       ok = parse_ip(ip, iface, 0, &svnn->public_address);
-       if (!ok) {
-               talloc_free(svnn);
-               return -1;
-       }
-
-       ret = ctdb_add_local_iface(ctdb, svnn->ifaces[0]);
-       if (ret != 0) {
-               DEBUG(DEBUG_CRIT, (__location__ " failed to add iface[%s] "
-                                  "for single_ip[%s]\n",
-                                  svnn->ifaces[0],
-                                  ctdb_addr_to_str(&svnn->public_address)));
-               talloc_free(svnn);
-               return -1;
-       }
-
-       /* assume the single public ip interface is initially "good" */
-       cur = ctdb_find_iface(ctdb, iface);
-       if (cur == NULL) {
-               DEBUG(DEBUG_CRIT,("Can not find public interface %s used by --single-public-ip", iface));
-               return -1;
-       }
-       cur->link_up = true;
-
-       ret = ctdb_vnn_assign_iface(ctdb, svnn);
-       if (ret != 0) {
-               talloc_free(svnn);
-               return -1;
-       }
-
-       ctdb->single_ip_vnn = svnn;
-       return 0;
-}
-
 static void *add_ip_callback(void *parm, void *data)
 {
        struct public_ip_list *this_ip = parm;
@@ -2474,14 +2414,6 @@ int32_t ctdb_control_get_public_ip_info(struct ctdb_context *ctdb,
        addr = (ctdb_sock_addr *)indata.dptr;
 
        vnn = find_public_ip_vnn(ctdb, addr);
-       if (vnn == NULL) {
-               /* if it is not a public ip   it could be our 'single ip' */
-               if (ctdb->single_ip_vnn) {
-                       if (ctdb_same_ip(&ctdb->single_ip_vnn->public_address, addr)) {
-                               vnn = ctdb->single_ip_vnn;
-                       }
-               }
-       }
        if (vnn == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Could not get public ip info, "
                                 "'%s'not a public address\n",
index b8b979d922b49768038bae419647eb749f00b31c..1565eae6059c09efdb05daed883a090dca2c8006 100644 (file)
@@ -53,7 +53,6 @@ static struct {
        const char *db_dir_persistent;
        const char *db_dir_state;
        const char *public_interface;
-       const char *single_public_ip;
        int         valgrinding;
        int         nosetsched;
        int         start_as_disabled;
@@ -122,7 +121,6 @@ int main(int argc, const char *argv[])
                { "interactive", 'i', POPT_ARG_NONE, &interactive, 0, "don't fork", NULL },
                { "public-addresses", 0, POPT_ARG_STRING, &options.public_address_list, 0, "public address list file", "filename" },
                { "public-interface", 0, POPT_ARG_STRING, &options.public_interface, 0, "public interface", "interface"},
-               { "single-public-ip", 0, POPT_ARG_STRING, &options.single_public_ip, 0, "single public ip", "ip-address"},
                { "event-script-dir", 0, POPT_ARG_STRING, &options.event_script_dir, 0, "event script directory", "dirname" },
                { "logging", 0, POPT_ARG_STRING, &options.logging, 0, "logging method to be used", NULL },
                { "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
@@ -282,20 +280,6 @@ int main(int argc, const char *argv[])
                CTDB_NO_MEMORY(ctdb, ctdb->default_public_interface);
        }
 
-       if (options.single_public_ip) {
-               if (options.public_interface == NULL) {
-                       DEBUG(DEBUG_ALERT,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
-                       exit(10);
-               }
-
-               ret = ctdb_set_single_public_ip(ctdb, options.public_interface,
-                                               options.single_public_ip);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
-                       exit(10);
-               }
-       }
-
        if (options.event_script_dir != NULL) {
                ctdb->event_script_dir = options.event_script_dir;
        } else {