From 155f32761f7f6569fde7c4c718169fb4f514d2c3 Mon Sep 17 00:00:00 2001
Message-Id: <155f32761f7f6569fde7c4c718169fb4f514d2c3@dist-git>
From: John Ferlan
Date: Mon, 25 Jul 2016 12:42:48 -0400
Subject: [PATCH] encryption: Add luks parsing for storageencryption
https://bugzilla.redhat.com/show_bug.cgi?id=1301021
Add parse and format of the luks/passphrase secret including tests for
volume XML parsing.
Signed-off-by: John Ferlan
(cherry picked from commit 9bbf0d7e6457e5a0668017eb8e17276f747fc9cc)
Resolved conflict in docs/formatsecret.html.in since commit id
c84380106fe69f86842dc7e8c032af6740bef77e is not present downstream
Signed-off-by: John Ferlan
---
docs/formatstorageencryption.html.in | 26 ++++++++++++-
docs/schemas/storagecommon.rng | 2 +
src/qemu/qemu_process.c | 6 +++
src/storage/storage_backend.c | 3 +-
src/storage/storage_backend_fs.c | 7 +++-
src/storage/storage_backend_gluster.c | 2 +
src/util/virstorageencryption.c | 2 +-
src/util/virstorageencryption.h | 1 +
tests/qemuxml2argvdata/qemuxml2argv-luks-disks.xml | 45 ++++++++++++++++++++++
.../qemuxml2xmlout-luks-disks.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
tests/storagevolxml2xmlin/vol-luks.xml | 21 ++++++++++
tests/storagevolxml2xmlout/vol-luks.xml | 21 ++++++++++
tests/storagevolxml2xmltest.c | 1 +
14 files changed, 134 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-luks-disks.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-luks-disks.xml
create mode 100644 tests/storagevolxml2xmlin/vol-luks.xml
create mode 100644 tests/storagevolxml2xmlout/vol-luks.xml
diff --git a/docs/formatstorageencryption.html.in b/docs/formatstorageencryption.html.in
index 58e1073..380763e 100644
--- a/docs/formatstorageencryption.html.in
+++ b/docs/formatstorageencryption.html.in
@@ -56,8 +56,20 @@
the secret
element is not present during volume creation,
a secret is automatically generated and attached to the volume.
+
+
+ The luks
format is specific to a luks encrypted volume
+ and the secret used in order to either encrypt or decrypt the volume.
+ A single <secret type='passphrase'...>
element is
+ expected. The secret may be referenced via either a uuid
or
+ usage
attribute. One of the two must be present. When
+ present for volume creation, the secret will be used in order for
+ volume encryption. When present for domain usage, the secret will
+ be used as the passphrase to decrypt the volume.
+ Since 2.1.0.
+
-
+
Here is a simple example, specifying use of the qcow
format:
@@ -67,5 +79,17 @@
<encryption format='qcow'>
<secret type='passphrase' uuid='c1f11a6d-8c5d-4a3e-ac7a-4e171c5e0d4a' />
</encryption>
+
+
+ Here is a simple example, specifying use of the luks
format
+ where it's assumed that a secret
has been defined using a
+ usage
element with a id
of "luks_example":
+
+
+ <encryption format='luks'>
+ <secret type='passphrase' usage='luks_example'/>
+ </encryption>
+
+