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

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