mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
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>
This commit is contained in:
parent
196ebfc240
commit
f023a8acd9
@ -316,14 +316,14 @@ 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;
|
||||
|
||||
tmp = g_new0(char *, naliases + 1);
|
||||
|
||||
for (i = 0; i < naliases; i++) {
|
||||
if (!(tmp[i] = virXMLNodeContentString(aliases[i])))
|
||||
if (!(tmp[i] = virXMLPropString(aliases[i], "name")))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user