[PATCH] schemas: rng: Make secret optional in storage vol

Han Han posted 1 patch 1 year, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220706024202.895610-1-hhan@redhat.com
src/conf/schemas/storagecommon.rng | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
[PATCH] schemas: rng: Make secret optional in storage vol
Posted by Han Han 1 year, 9 months ago
For a qcow2 storage volume with luks encryption created by qemu-img, its
dumped storage vol XML has no secret element in encryption:
<volume type='file'>
    ...
    <encryption format='luks'>
    </encryption>
    ...
</volume>

That will cause a failure in rng validation. Fix that validation failure.

Signed-off-by: Han Han <hhan@redhat.com>
---
 src/conf/schemas/storagecommon.rng | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/conf/schemas/storagecommon.rng b/src/conf/schemas/storagecommon.rng
index 10f1bc6a15..76714c9aad 100644
--- a/src/conf/schemas/storagecommon.rng
+++ b/src/conf/schemas/storagecommon.rng
@@ -24,17 +24,19 @@
           </choice>
         </attribute>
       </optional>
-      <interleave>
-        <ref name="secret"/>
-        <optional>
-          <element name="cipher">
-            <ref name="keycipher"/>
-          </element>
-          <element name="ivgen">
-            <ref name="keyivgen"/>
-          </element>
-        </optional>
-      </interleave>
+      <optional>
+        <interleave>
+          <ref name="secret"/>
+          <optional>
+            <element name="cipher">
+              <ref name="keycipher"/>
+            </element>
+            <element name="ivgen">
+              <ref name="keyivgen"/>
+            </element>
+          </optional>
+        </interleave>
+      </optional>
     </element>
   </define>
 
-- 
2.36.1
Re: [PATCH] schemas: rng: Make secret optional in storage vol
Posted by Michal Prívozník 1 year, 9 months ago
On 7/6/22 04:42, Han Han wrote:
> For a qcow2 storage volume with luks encryption created by qemu-img, its
> dumped storage vol XML has no secret element in encryption:
> <volume type='file'>
>     ...
>     <encryption format='luks'>
>     </encryption>
>     ...
> </volume>
> 
> That will cause a failure in rng validation. Fix that validation failure.
> 
> Signed-off-by: Han Han <hhan@redhat.com>
> ---
>  src/conf/schemas/storagecommon.rng | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)

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

Michal