From 6beeca77be0d43fe25c9e3c68b956da485f12441 Mon Sep 17 00:00:00 2001 From: Han Han Date: Mon, 4 Dec 2023 18:07:20 +0800 Subject: [PATCH] vir-qemu-sev-validate: Use string() method in xpath 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 Reviewed-by: Michal Privoznik --- 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")