[PATCH 14/19] virsh-domain: Apply macro VIRSH_DOMAIN_OPT_INTERFACE for interface option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
 tools/virsh-domain-monitor.c | 20 +++-----------------
 tools/virsh-domain-monitor.h |  1 +
 tools/virsh-domain.c         | 14 ++------------
 3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index e0491d48ac..313fdaf559 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -802,12 +802,7 @@ static const vshCmdInfo info_domif_getlink[] = {
 
 static const vshCmdOptDef opts_domif_getlink[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .completer = virshDomainInterfaceCompleter,
-     .help = N_("interface device (MAC Address)")
-    },
+    VIRSH_DOMAIN_OPT_INTERFACE(N_("interface device (MAC Address)"), VSH_OFLAG_REQ, 0),
     {.name = "persistent",
      .type = VSH_OT_ALIAS,
      .help = "config"
@@ -1138,12 +1133,7 @@ static const vshCmdInfo info_domifstat[] = {
 
 static const vshCmdOptDef opts_domifstat[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .completer = virshDomainInterfaceCompleter,
-     .help = N_("interface device specified by name or MAC Address")
-    },
+    VIRSH_DOMAIN_OPT_INTERFACE(N_("interface device specified by name or MAC Address"), VSH_OFLAG_REQ, 0),
     {.name = NULL}
 };
 
@@ -2328,11 +2318,7 @@ static const vshCmdInfo info_domifaddr[] = {
 
 static const vshCmdOptDef opts_domifaddr[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
-    {.name = "interface",
-     .type = VSH_OT_STRING,
-     .flags = VSH_OFLAG_NONE,
-     .completer = virshDomainInterfaceCompleter,
-     .help = N_("network interface name")},
+    VIRSH_DOMAIN_OPT_INTERFACE(N_("network interface name"), VSH_OFLAG_NONE, 0),
     {.name = "full",
      .type = VSH_OT_BOOL,
      .flags = VSH_OFLAG_NONE,
diff --git a/tools/virsh-domain-monitor.h b/tools/virsh-domain-monitor.h
index 0de47c50c4..540c266274 100644
--- a/tools/virsh-domain-monitor.h
+++ b/tools/virsh-domain-monitor.h
@@ -21,6 +21,7 @@
 #pragma once
 
 #include "virsh.h"
+#include "virsh-domain.h"
 
 char *virshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
                                 bool title, unsigned int flags)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5b9970fdf5..d50fdbad26 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3053,12 +3053,7 @@ static const vshCmdInfo info_domif_setlink[] = {
 
 static const vshCmdOptDef opts_domif_setlink[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .completer = virshDomainInterfaceCompleter,
-     .help = N_("interface device (MAC Address)")
-    },
+    VIRSH_DOMAIN_OPT_INTERFACE(N_("interface device (MAC Address)"), VSH_OFLAG_REQ, 0),
     {.name = "state",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
@@ -3225,12 +3220,7 @@ static const vshCmdInfo info_domiftune[] = {
 
 static const vshCmdOptDef opts_domiftune[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
-    {.name = "interface",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .completer = virshDomainInterfaceCompleter,
-     .help = N_("interface device (MAC Address)")
-    },
+    VIRSH_DOMAIN_OPT_INTERFACE(N_("interface device (MAC Address)"), VSH_OFLAG_REQ, 0),
     {.name = "inbound",
      .type = VSH_OT_STRING,
      .help = N_("control domain's incoming traffics")
-- 
2.26.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux