Re: [PATCH 13/19] virsh-domain: Introduce 2 macros for domain options 'interface' and 'mac'

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

 



On 11/2/20 9:26 AM, Lin Ma wrote:
The macro VIRSH_DOMAIN_OPT_INTERFACE for domain option '--interface',
The macro VIRSH_DOMAIN_OPT_MAC for domain option '--mac'.

Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
  tools/virsh-domain.h | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)

diff --git a/tools/virsh-domain.h b/tools/virsh-domain.h
index 0d59c579d4..ac05f983f9 100644
--- a/tools/virsh-domain.h
+++ b/tools/virsh-domain.h
@@ -39,3 +39,21 @@ typedef enum {
  VIR_ENUM_DECL(virshDomainHostnameSource);
extern const vshCmdDef domManagementCmds[];
+
+#define VIRSH_DOMAIN_OPT_INTERFACE(_helpstr, oflags, cflags) \
+    {.name = "interface", \
+     .type = VSH_OT_STRING, \
+     .flags = oflags, \
+     .help = _helpstr, \
+     .completer = virshDomainInterfaceCompleter, \
+     .completer_flags = cflags, \
+    }
+
+#define VIRSH_DOMAIN_OPT_MAC(_helpstr, oflags) \
+    {.name = "mac", \
+     .type = VSH_OT_STRING, \
+     .flags = oflags, \
+     .help = _helpstr, \
+     .completer = virshDomainInterfaceCompleter, \
+     .completer_flags = VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, \
+    }


So, if we had two distinct completers, as I suggested, then this would look a bit different and both macros could accept cflags. We could then print MAC addresses only of running/inactive/all interfaces, which could be helpful.

I'm stopping my review here. I think you get the gist of my review. Looking forward to v2.

Michal




[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