xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Mathieu Gagné" <mgagne@iweb.com>
To: xen-devel@lists.xensource.com
Cc: ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com
Subject: [PATCH 2 of 4 v2] xl: xl network-attach -N (dry run) option
Date: Mon, 16 Apr 2012 21:58:24 -0400	[thread overview]
Message-ID: <0303c3ef7788de6522f9.1334627904@mgagne.users.dev.iweb.com> (raw)
In-Reply-To: <patchbomb.1334627902@mgagne.users.dev.iweb.com>

Add dryrun for testing and debugging purposes.

Signed-off-by: Mathieu Gagné <mgagne@iweb.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4916,6 +4916,16 @@ int main_networkattach(int argc, char **
             return 1;
         }
     }
+
+    if (dryrun_only) {
+        char *json = libxl_device_nic_to_json(ctx, &nic);
+        printf("vif: %s\n", json);
+        free(json);
+        libxl_device_nic_dispose(&nic);
+        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+        return 0;
+    }
+
     if (libxl_device_nic_add(ctx, domid, &nic)) {
         fprintf(stderr, "libxl_device_nic_add failed.\n");
         return 1;
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -288,7 +288,7 @@ struct cmd_spec cmd_table[] = {
       "",
     },
     { "network-attach",
-      &main_networkattach, 0,
+      &main_networkattach, 1,
       "Create a new virtual network device",
       "<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] "
       "[ip=<ip>] [script=<script>] [backend=<BackDomain>] [vifname=<name>] "
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2012-04-17  1:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17  1:58 [PATCH 0 of 4 v2] xl: add support for vif rate limiting Mathieu Gagné
2012-04-17  1:58 ` [PATCH 1 of 4 v2] xl: cleanup indentation Mathieu Gagné
2012-04-17  1:58 ` Mathieu Gagné [this message]
2012-04-17  1:58 ` [PATCH 3 of 4 v2] xl: add support for vif rate limiting Mathieu Gagné
2012-04-17 10:48   ` Ian Campbell
2012-04-17  1:58 ` [PATCH 4 of 4 v2] xl: add "check-xl-vif-parse" test script Mathieu Gagné
2012-04-17 10:50   ` Ian Campbell
2012-04-17 18:15 ` [PATCH 0 of 4 v2] xl: add support for vif rate limiting Ian Jackson
2012-04-17 20:37   ` Mathieu Gagné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0303c3ef7788de6522f9.1334627904@mgagne.users.dev.iweb.com \
    --to=mgagne@iweb.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).