]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Create macro for common "persistent" option
authorJohn Ferlan <jferlan@redhat.com>
Sat, 9 Jan 2016 13:36:25 +0000 (08:36 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 11 Jan 2016 23:14:00 +0000 (18:14 -0500)
Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically.  Note that not all
'{.name = "persistent",' entries are replaced, just those that have the
common .help string of "make live change persistent".

Non replaced instances are unique to the command.

Signed-off-by: John Ferlan <jferlan@redhat.com>
tools/virsh-domain.c

index c96905b5d65a3401b097f2e0145a64d2ff5cc046..f59c3eda3541f58d8e727a4c7c94ad0d9ed82bb3 100644 (file)
 #define VIRSH_COMMON_OPT_DOMAIN_FULL                       \
     VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \
 
+#define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT             \
+    {.name = "persistent",                             \
+     .type = VSH_OT_BOOL,                              \
+     .help = N_("make live change persistent")         \
+    }                                                  \
+
 static virDomainPtr
 virshLookupDomainInternal(vshControl *ctl,
                           const char *cmdname,
@@ -214,10 +220,7 @@ static const vshCmdOptDef opts_attach_device[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("XML file")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -377,10 +380,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
      .type = VSH_OT_BOOL,
      .help = N_("print XML document rather than attach the disk")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -837,10 +837,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
      .type = VSH_OT_STRING,
      .help = N_("control domain's outgoing traffics")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -10863,10 +10860,7 @@ static const vshCmdOptDef opts_detach_device[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("XML file")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -10960,10 +10954,7 @@ static const vshCmdOptDef opts_update_device[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("XML file")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -11062,10 +11053,7 @@ static const vshCmdOptDef opts_detach_interface[] = {
      .type = VSH_OT_STRING,
      .help = N_("MAC address")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")
@@ -11474,10 +11462,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("target of disk device")
     },
-    {.name = "persistent",
-     .type = VSH_OT_BOOL,
-     .help = N_("make live change persistent")
-    },
+    VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
     {.name = "config",
      .type = VSH_OT_BOOL,
      .help = N_("affect next boot")