X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fovs-vsctl.c;h=9c019cc00d1f9a12d9e79d98c103f6724ae2df8f;hb=45a7de56bbcb2adfabf2082b1133e768777d44d6;hp=e86cb7cd949ce48dc0fd9095e4afba8f4e52fdc0;hpb=524555d18bda66f4f2c4bcb7bfb83b22bf50a942;p=openvswitch diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index e86cb7cd..9c019cc0 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -45,6 +45,9 @@ static const char *db; /* --oneline: Write each command's output as a single line? */ static bool oneline; +/* --dry-run: Do not commit any changes. */ +static bool dry_run; + static void vsctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2) NO_RETURN; static char *default_db(void); static void usage(void) NO_RETURN; @@ -138,12 +141,14 @@ parse_options(int argc, char *argv[]) OPT_DB = UCHAR_MAX + 1, OPT_ONELINE, OPT_NO_SYSLOG, - OPT_NO_WAIT + OPT_NO_WAIT, + OPT_DRY_RUN }; static struct option long_options[] = { {"db", required_argument, 0, OPT_DB}, {"no-syslog", no_argument, 0, OPT_NO_SYSLOG}, {"no-wait", no_argument, 0, OPT_NO_WAIT}, + {"dry-run", no_argument, 0, OPT_DRY_RUN}, {"oneline", no_argument, 0, OPT_ONELINE}, {"verbose", optional_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, @@ -176,6 +181,10 @@ parse_options(int argc, char *argv[]) /* XXX not yet implemented */ break; + case OPT_DRY_RUN: + dry_run = true; + break; + case 'h': usage(); @@ -1192,6 +1201,9 @@ do_vsctl(int argc, char *argv[], struct ovsdb_idl *idl) int i, start; txn = ovsdb_idl_txn_create(idl); + if (dry_run) { + ovsdb_idl_txn_set_dry_run(txn); + } ovs = ovsrec_open_vswitch_first(idl); if (!ovs) {