netdev-linux: Cleanup tap netdev.
[openvswitch] / utilities / ovs-vsctl.c
index a63970b513ed4b97bbc605691d253abb436ad860..f3bb88e2c3f91d25cd62a3c68286f0976c35b0ad 100644 (file)
@@ -153,7 +153,8 @@ parse_options(int argc, char *argv[])
         OPT_ONELINE,
         OPT_NO_SYSLOG,
         OPT_NO_WAIT,
-        OPT_DRY_RUN
+        OPT_DRY_RUN,
+        VLOG_OPTION_ENUMS
     };
     static struct option long_options[] = {
         {"db", required_argument, 0, OPT_DB},
@@ -162,15 +163,14 @@ parse_options(int argc, char *argv[])
         {"dry-run", no_argument, 0, OPT_DRY_RUN},
         {"oneline", no_argument, 0, OPT_ONELINE},
         {"timeout", required_argument, 0, 't'},
-        {"verbose", optional_argument, 0, 'v'},
         {"help", no_argument, 0, 'h'},
         {"version", no_argument, 0, 'V'},
+        VLOG_LONG_OPTIONS,
         {0, 0, 0, 0},
     };
 
 
     for (;;) {
-        unsigned long int timeout;
         int c;
 
         c = getopt_long(argc, argv, "+v::hVt:", long_options, NULL);
@@ -214,9 +214,7 @@ parse_options(int argc, char *argv[])
             }
             break;
 
-        case 'v':
-            vlog_set_verbosity(optarg);
-            break;
+        VLOG_OPTION_HANDLERS
 
         case '?':
             exit(EXIT_FAILURE);
@@ -1003,7 +1001,7 @@ cmd_list_ports(struct vsctl_context *ctx)
 
 static void
 add_port(const struct ovsrec_open_vswitch *ovs,
-         const char *br_name, const char *port_name,
+         const char *br_name, const char *port_name, bool fake_iface,
          char *iface_names[], int n_ifaces)
 {
     struct vsctl_info info;
@@ -1027,6 +1025,7 @@ add_port(const struct ovsrec_open_vswitch *ovs,
     port = ovsrec_port_insert(txn_from_openvswitch(ovs));
     ovsrec_port_set_name(port, port_name);
     ovsrec_port_set_interfaces(port, ifaces, n_ifaces);
+    ovsrec_port_set_bond_fake_iface(port, fake_iface);
     free(ifaces);
 
     if (bridge->vlan) {
@@ -1043,13 +1042,16 @@ add_port(const struct ovsrec_open_vswitch *ovs,
 static void
 cmd_add_port(struct vsctl_context *ctx)
 {
-    add_port(ctx->ovs, ctx->argv[1], ctx->argv[2], &ctx->argv[2], 1);
+    add_port(ctx->ovs, ctx->argv[1], ctx->argv[2], false, &ctx->argv[2], 1);
 }
 
 static void
 cmd_add_bond(struct vsctl_context *ctx)
 {
-    add_port(ctx->ovs, ctx->argv[1], ctx->argv[2], &ctx->argv[3], ctx->argc - 3);
+    bool fake_iface = shash_find(&ctx->options, "--fake-iface");
+
+    add_port(ctx->ovs, ctx->argv[1], ctx->argv[2], fake_iface,
+             &ctx->argv[3], ctx->argc - 3);
 }
 
 static void
@@ -1346,7 +1348,7 @@ cmd_get_fail_mode(struct vsctl_context *ctx)
     }
 
     if (fail_mode && strlen(fail_mode)) {
-        ds_put_format(&ctx->output, "%s\n", info.ctrl->fail_mode);
+        ds_put_format(&ctx->output, "%s\n", fail_mode);
     }
 
     free_info(&info);
@@ -1631,7 +1633,7 @@ get_vsctl_handler(int argc, char *argv[], struct vsctl_context *ctx)
         /* Port commands. */
         {"list-ports", 1, 1, cmd_list_ports, ""},
         {"add-port", 2, 2, cmd_add_port, ""},
-        {"add-bond", 4, INT_MAX, cmd_add_bond, ""},
+        {"add-bond", 4, INT_MAX, cmd_add_bond, "--fake-iface"},
         {"del-port", 1, 2, cmd_del_port, "--if-exists"},
         {"port-to-br", 1, 1, cmd_port_to_br, ""},
         {"port-set-external-id", 2, 3, cmd_port_set_external_id, ""},