1 Star 0 Fork 71

lIshaohui/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virsh-Fix-XPATH-in-virshDomainDeviceAliasCompleter.patch 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
From 97672f8da837bbe9e1a57714db3b2ce5f299b8d3 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 22 Jan 2021 09:29:54 +0100
Subject: [PATCH 085/108] virsh: Fix XPATH in virshDomainDeviceAliasCompleter()
The way this completer works is that it dumps XML of specified
domain and then tries to look for @name attribute of <alias/>
element. However, the XPATH it uses is not correct which results
in no aliases returned by the completer.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit f023a8acd9c08ea3bc72bf8f968ad63426b033bd)
---
tools/virsh-completer-domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index 4472ee08f2..7e155d9ee2 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -266,7 +266,7 @@ virshDomainDeviceAliasCompleter(vshControl *ctl,
if (virshDomainGetXML(ctl, cmd, domainXMLFlags, &xmldoc, &ctxt) < 0)
return NULL;
- naliases = virXPathNodeSet("./devices//alias/@name", ctxt, &aliases);
+ naliases = virXPathNodeSet("/domain/devices//alias[@name]", ctxt, &aliases);
if (naliases < 0)
return NULL;
@@ -274,7 +274,7 @@ virshDomainDeviceAliasCompleter(vshControl *ctl,
return NULL;
for (i = 0; i < naliases; i++) {
- if (!(tmp[i] = virXMLNodeContentString(aliases[i])))
+ if (!(tmp[i] = virXMLPropString(aliases[i], "name")))
return NULL;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li-shaohui/libvirt.git
git@gitee.com:li-shaohui/libvirt.git
li-shaohui
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385