提交 7a995c6b 编写于 作者: M Michal Privoznik

virsh: Deal with multiple matching devices in domif-getlink

The command tries to match interface in domain definition by MAC
address or interface name. However, since it's possible to
configure two interfaces with the same MAC address, it may
happen that the XPath returns two or more nodes. We should check
for that.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 0d3d020b
......@@ -707,13 +707,16 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
if (ninterfaces != 1) {
if (ninterfaces < 1) {
if (macstr[0])
vshError(ctl, _("Interface (mac: %s) not found."), macstr);
else
vshError(ctl, _("Interface (dev: %s) not found."), iface);
goto cleanup;
} else if (ninterfaces > 1) {
vshError(ctl, _("multiple matching interfaces found"));
goto cleanup;
}
ctxt->node = interfaces[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册