d759b5
From f1589cb88dc71bb7bf20a4a3a14f79b36228fdd2 Mon Sep 17 00:00:00 2001
d759b5
Message-Id: <f1589cb88dc71bb7bf20a4a3a14f79b36228fdd2@dist-git>
d759b5
From: Peter Krempa <pkrempa@redhat.com>
d759b5
Date: Thu, 20 Jun 2019 17:45:02 +0200
d759b5
Subject: [PATCH] docs: schemas: Add 'seclabel' for external disk snapshot
d759b5
d759b5
Allow using seclabels the same way as disk images allow it. Currently
d759b5
the snapshot code copies the seclabels from the original image if no
d759b5
seclabel is provided. Also there's no code change required as the
d759b5
snapshot XML parser actually uses parts of the disk parser thus
d759b5
seclabels are already parsed and formatted and even applied thus this is
d759b5
just a formalization of our support for this.
d759b5
d759b5
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d759b5
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
d759b5
(cherry picked from commit ac88a8cfad1c93897ddbbfa1cc1aabcf0245255c)
d759b5
https: //bugzilla.redhat.com/show_bug.cgi?id=1584682
d759b5
Message-Id: <9a9636c4fb2cf2f6d08056ad13b6c7dc94611b90.1561045343.git.pkrempa@redhat.com>
d759b5
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
d759b5
---
d759b5
 docs/formatsnapshot.html.in                          | 12 ++++++++++++
d759b5
 docs/schemas/domainsnapshot.rng                      |  6 ++++++
d759b5
 .../{disk-seclabel-invalid.xml => disk-seclabel.xml} |  0
d759b5
 3 files changed, 18 insertions(+)
d759b5
 rename tests/domainsnapshotxml2xmlin/{disk-seclabel-invalid.xml => disk-seclabel.xml} (100%)
d759b5
d759b5
diff --git a/docs/formatsnapshot.html.in b/docs/formatsnapshot.html.in
d759b5
index 23f20d7c33..bcd9e72983 100644
d759b5
--- a/docs/formatsnapshot.html.in
d759b5
+++ b/docs/formatsnapshot.html.in
d759b5
@@ -173,6 +173,12 @@
d759b5
               snapshots, the original file name becomes the read-only
d759b5
               snapshot, and the new file name contains the read-write
d759b5
               delta of all disk changes since the snapshot.
d759b5
+              

d759b5
+              The source element also may contain the
d759b5
+              seclabel element (described in the
d759b5
+              domain XML documentation)
d759b5
+              which can be used to override the domain security labeling policy
d759b5
+              for source.
d759b5
               
d759b5
               
driver
d759b5
               
An optional sub-element driver,
d759b5
@@ -180,6 +186,7 @@
d759b5
               as qcow2), of the new file created by the external
d759b5
               snapshot of the new file.
d759b5
               
d759b5
+              
seclabel
d759b5
             
d759b5
 
d759b5
             Since 1.2.2 the disk element
d759b5
@@ -255,6 +262,11 @@
d759b5
       <source file='/path/to/new'/>
d759b5
     </disk>
d759b5
     <disk name='vdb' snapshot='no'/>
d759b5
+    <disk name='vdc'>
d759b5
+      <source file='/path/to/newc'>
d759b5
+        <seclabel model='dac' relabel='no'/>
d759b5
+      </source>
d759b5
+    </disk>
d759b5
   </disks>
d759b5
 </domainsnapshot>
d759b5
 
d759b5
diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng
d759b5
index 2680887095..005a573928 100644
d759b5
--- a/docs/schemas/domainsnapshot.rng
d759b5
+++ b/docs/schemas/domainsnapshot.rng
d759b5
@@ -158,6 +158,9 @@
d759b5
                     <optional>
d759b5
                       <ref name='storageStartupPolicy'/>
d759b5
                     </optional>
d759b5
+                    <zeroOrMore>
d759b5
+                      <ref name='devSeclabel'/>
d759b5
+                    </zeroOrMore>
d759b5
                     <empty/>
d759b5
                   </element>
d759b5
                 </optional>
d759b5
@@ -174,6 +177,9 @@
d759b5
                     <attribute name="dev">
d759b5
                       <ref name="absFilePath"/>
d759b5
                     </attribute>
d759b5
+                    <zeroOrMore>
d759b5
+                      <ref name='devSeclabel'/>
d759b5
+                    </zeroOrMore>
d759b5
                     <empty/>
d759b5
                   </element>
d759b5
                 </optional>
d759b5
diff --git a/tests/domainsnapshotxml2xmlin/disk-seclabel-invalid.xml b/tests/domainsnapshotxml2xmlin/disk-seclabel.xml
d759b5
similarity index 100%
d759b5
rename from tests/domainsnapshotxml2xmlin/disk-seclabel-invalid.xml
d759b5
rename to tests/domainsnapshotxml2xmlin/disk-seclabel.xml
d759b5
-- 
d759b5
2.22.1
d759b5