From nobody Fri May 3 08:08:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611304759; cv=none; d=zohomail.com; s=zohoarc; b=EvKh+Ay3narytPWKyTYNzmNsesoHP8daqBDnOYrI/SZ9y+b0Ocu8OFv46QPrGzyppVOdfRCzJyiZdsYvArYQhIPoaD4hkIim7lG+puECbxLkaxfwsx3T+Ha/aOAsP9xAoXCTvJXgfy6r0RdoogwycSrxQJfGIM1+YA/DTzRobVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611304759; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=VpqykJUNAMOOHSytgArSx6/mf37/ePYClVMs5jPjMk8=; b=lXZK1j1W+GMaCQPZIK74rdaKTamVJiSBga9APNbQM7tsEsNrDSUQq0BYM0tc+DMwmtx4DTJHqfmsJeDYVYsK3PfQF7xE3gNJrSIY49N1AMOViWx04ITTA6yx7eydq34jyEQWZNLjA+O2gNcoVI3xaTuNBKsx3/pLu+usfFSFE/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611304759470953.7465861236884; Fri, 22 Jan 2021 00:39:19 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-V-U49fiQNnuQVImkzIEi6Q-1; Fri, 22 Jan 2021 03:39:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5BA48018AC; Fri, 22 Jan 2021 08:39:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 929896A8ED; Fri, 22 Jan 2021 08:39:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 147C64BB7B; Fri, 22 Jan 2021 08:39:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10M8d9Ys015063 for ; Fri, 22 Jan 2021 03:39:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2CFD310023BF; Fri, 22 Jan 2021 08:39:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id A306C10013BD for ; Fri, 22 Jan 2021 08:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611304758; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VpqykJUNAMOOHSytgArSx6/mf37/ePYClVMs5jPjMk8=; b=O0koxPMkVx7x1aKDeMiAnz5zMq6p3uXCa57bwhSzJXPOfC1kDks08WeRbT+883fA5nmbQ7 aBVVk7B6eeoyFgfaaokfMfD/bNPw9uX6wPv1xeThakC2eDbp5BYIYxnYGvyBCCIuk9gNFh YyRdszQJM50OJfWnId0kV+peVWVV2yQ= X-MC-Unique: V-U49fiQNnuQVImkzIEi6Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virsh: Fix XPATH in virshDomainDeviceAliasCompleter() Date: Fri, 22 Jan 2021 09:39:01 +0100 Message-Id: <06d734343021267255dfba38dab2275f6ddb4cf2.1611304674.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The way this completer works is that it dumps XML of specified domain and then tries to look for @name attribute of element. However, the XPATH it uses is not correct which results in no aliases returned by the completer. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- 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 4a3459f12a..e773af6552 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -316,14 +316,14 @@ virshDomainDeviceAliasCompleter(vshControl *ctl, if (virshDomainGetXML(ctl, cmd, domainXMLFlags, &xmldoc, &ctxt) < 0) return NULL; =20 - naliases =3D virXPathNodeSet("./devices//alias/@name", ctxt, &aliases); + naliases =3D virXPathNodeSet("/domain/devices//alias[@name]", ctxt, &a= liases); if (naliases < 0) return NULL; =20 tmp =3D g_new0(char *, naliases + 1); =20 for (i =3D 0; i < naliases; i++) { - if (!(tmp[i] =3D virXMLNodeContentString(aliases[i]))) + if (!(tmp[i] =3D virXMLPropString(aliases[i], "name"))) return NULL; } =20 --=20 2.26.2