Blame SOURCES/libvirt-qemu-Fix-the-command-line-generation-for-rbd-auth-using-aes-secrets.patch

6ae9ed
From d15d6fce9e34e3b7241ca1f61328fc301678a3c0 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <d15d6fce9e34e3b7241ca1f61328fc301678a3c0@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Wed, 17 Aug 2016 08:18:10 -0400
6ae9ed
Subject: [PATCH] qemu: Fix the command line generation for rbd auth using aes
6ae9ed
 secrets
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1182074
6ae9ed
6ae9ed
Since libvirt still uses a legacy qemu arg format to add a disk, the
6ae9ed
manner in which the 'password-secret' argument is passed to qemu needs
6ae9ed
to change to prepend a 'file.' If in the future, usage of the more
6ae9ed
modern disk format, then the prepended 'file.' can be removed.
6ae9ed
6ae9ed
Fix based on Jim Fehlig <jfehlig@suse.com> posting and subsequent
6ae9ed
upstream list followups, see:
6ae9ed
6ae9ed
http://www.redhat.com/archives/libvir-list/2016-August/msg00777.html
6ae9ed
6ae9ed
for details. Introduced by commit id 'a1344f70'.
6ae9ed
6ae9ed
(cherry picked from commit d53d465083edeb64cc7b78249c030734c0d91c6b)
6ae9ed
6ae9ed
Resolved "conflict" in the .args file since upstream commit id '4808ebde'
6ae9ed
to alter the max length of .args output line length isn't present.
6ae9ed
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_command.c                                            | 7 ++++++-
6ae9ed
 .../qemuxml2argv-disk-drive-network-rbd-auth-AES.args              | 3 ++-
6ae9ed
 2 files changed, 8 insertions(+), 2 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
6ae9ed
index 4ce86bb..a001d2c 100644
6ae9ed
--- a/src/qemu/qemu_command.c
6ae9ed
+++ b/src/qemu/qemu_command.c
6ae9ed
@@ -1296,7 +1296,12 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
6ae9ed
     virBufferAddLit(buf, ",");
6ae9ed
 
6ae9ed
     if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) {
6ae9ed
-        virBufferAsprintf(buf, "password-secret=%s,",
6ae9ed
+        /* NB: If libvirt starts using the more modern option based
6ae9ed
+         *     syntax to build the command line (e.g., "-drive driver=rbd,
6ae9ed
+         *     filename=%s,...") instead of the legacy model (e.g."-drive
6ae9ed
+         *     file=%s,..."), then the "file." prefix can be removed
6ae9ed
+         */
6ae9ed
+        virBufferAsprintf(buf, "file.password-secret=%s,",
6ae9ed
                           secinfo->s.aes.alias);
6ae9ed
     }
6ae9ed
 
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
6ae9ed
index 7100d2d..8312d3d 100644
6ae9ed
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth-AES.args
6ae9ed
@@ -26,6 +26,7 @@ data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
6ae9ed
 keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
6ae9ed
 -drive 'file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
6ae9ed
 mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:6322,\
6ae9ed
-password-secret=virtio-disk0-secret0,format=raw,if=none,id=drive-virtio-disk0' \
6ae9ed
+file.password-secret=virtio-disk0-secret0,format=raw,if=none,\
6ae9ed
+id=drive-virtio-disk0' \
6ae9ed
 -device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
6ae9ed
 id=virtio-disk0
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed