From 18bcba55cdb2cfcba671c6ccfd4b6ae49cb384e3 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 9 Feb 2015 15:53:54 +0100 Subject: [PATCH] virsh attach-interface: Use enum instead of arbitrary integers The type of interface to attach is held in the variable 'typ'. Depending on interface type selected by user, the variable is set either to 1 (network), or 2 (bridge). Lets use already existing enum from domain_conf.h instead: virDomainNetType. Signed-off-by: Michal Privoznik --- tools/virsh-domain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 20bafbeb81..da8eb0f506 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -906,7 +906,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) *type = NULL, *source = NULL, *model = NULL, *inboundStr = NULL, *outboundStr = NULL; virNetDevBandwidthRate inbound, outbound; - int typ; + virDomainNetType typ; int ret; bool functionReturn = false; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -946,9 +946,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) /* check interface type */ if (STREQ(type, "network")) { - typ = 1; + typ = VIR_DOMAIN_NET_TYPE_NETWORK; } else if (STREQ(type, "bridge")) { - typ = 2; + typ = VIR_DOMAIN_NET_TYPE_BRIDGE; } else { vshError(ctl, _("No support for %s in command 'attach-interface'"), type); @@ -982,9 +982,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) virBufferAsprintf(&buf, "\n", type); virBufferAdjustIndent(&buf, 2); - if (typ == 1) + if (typ == VIR_DOMAIN_NET_TYPE_NETWORK) virBufferAsprintf(&buf, "\n", source); - else if (typ == 2) + else if (typ == VIR_DOMAIN_NET_TYPE_BRIDGE) virBufferAsprintf(&buf, "\n", source); if (target != NULL)