[PATCH] vir-qemu-sev-validate: Use string() method in xpath

Han Han posted 1 patch 4 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20231204100726.1258573-1-hhan@redhat.com
tools/virt-qemu-sev-validate | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] vir-qemu-sev-validate: Use string() method in xpath
Posted by Han Han 4 months, 3 weeks ago
For the xpath "/domain/cpu/@mode", it will return a list type not a
string. Use string() method in the xpath for the string result.

Fixes: 6b95437c17

Signed-off-by: Han Han <hhan@redhat.com>
---
 tools/virt-qemu-sev-validate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virt-qemu-sev-validate b/tools/virt-qemu-sev-validate
index 67edbd085f..115266976b 100755
--- a/tools/virt-qemu-sev-validate
+++ b/tools/virt-qemu-sev-validate
@@ -1054,7 +1054,7 @@ class LibvirtConfidentialVM(ConfidentialVM):
                 raise InsecureUsageException(
                     "Using CPU SKU from capabilities is not secure")
 
-            mode = doc.xpath("/domain/cpu/@mode")
+            mode = doc.xpath("string(/domain/cpu/@mode)")
             if mode != "host-passthrough":
                 raise UnsupportedUsageException(
                     "Using CPU family/model/stepping from host not possible unless 'host-passthrough' is used")
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH] vir-qemu-sev-validate: Use string() method in xpath
Posted by Michal Prívozník 4 months, 3 weeks ago
On 12/4/23 11:07, Han Han wrote:
> For the xpath "/domain/cpu/@mode", it will return a list type not a
> string. Use string() method in the xpath for the string result.
> 
> Fixes: 6b95437c17
> 
> Signed-off-by: Han Han <hhan@redhat.com>
> ---
>  tools/virt-qemu-sev-validate | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

and pushed.

Michal
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org