On Tue, Jan 02, 2018 at 06:12:10PM +0100, Michal Privoznik wrote:
For given domain fetch list of defined interfaces. This can be
used for commands like domif-getlink and others. If available,
the interface name is returned (e.g. "vnet0", usually available
only for running domains), if not the MAC address is returned.
Moreover, the detach-interface command requires only MAC address
and therefore we have new flag that forces the completer to
return just the MAC address.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-completer.c | 60 ++++++++++++++++++++++++++++++++++++++++++++
tools/virsh-completer.h | 8 ++++++
tools/virsh-domain-monitor.c | 3 +++
tools/virsh-domain.c | 4 +++
4 files changed, 75 insertions(+)
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 288e17909..680cd12ff 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -30,4 +30,12 @@ char ** virshDomainNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+enum {
+ VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC = 1 << 1, /* Return just MACs */
Why are you starting from 2? Why not start from 1? Didn't you mean 1 << 0?