]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
vir-qemu-sev-validate: Use string() method in xpath
authorHan Han <hhan@redhat.com>
Mon, 4 Dec 2023 10:07:20 +0000 (18:07 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Dec 2023 11:21:38 +0000 (12:21 +0100)
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>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virt-qemu-sev-validate

index 67edbd085f258a1456df0b7d9c01f39d31508c09..115266976bbeab898add38ea7a7725cce5afad21 100755 (executable)
@@ -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")