|
|
9ae3a8 |
From b1e9937d355d28809635967f3ada98c2ecf8ae7f Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 23 Oct 2014 10:10:08 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 03/19] blockdev: Fail blockdev-add with encrypted images
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1414059011-15516-6-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 61839
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 5/8] blockdev: Fail blockdev-add with encrypted images
|
|
|
9ae3a8 |
Bugzilla: 1088176
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Encrypted images need a password before they can be used, and we don't
|
|
|
9ae3a8 |
want blockdev-add to create BDSes that aren't fully initialised. So for
|
|
|
9ae3a8 |
now simply forbid encrypted images; we can come back to it later if we
|
|
|
9ae3a8 |
need the functionality.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 8ae8e904fcba484ff7c3f8f31339b56ebd88fbad)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
blockdev.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Trivial bonus bugfix so that the backported test 087 won't fail.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
blockdev.c | 9 ++++++++-
|
|
|
9ae3a8 |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
9ae3a8 |
index 7d4a53f..a2d5f02 100644
|
|
|
9ae3a8 |
--- a/blockdev.c
|
|
|
9ae3a8 |
+++ b/blockdev.c
|
|
|
9ae3a8 |
@@ -1793,6 +1793,7 @@ void qmp___com_redhat_change_backing_file(const char *device,
|
|
|
9ae3a8 |
void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
QmpOutputVisitor *ov = qmp_output_visitor_new();
|
|
|
9ae3a8 |
+ DriveInfo *dinfo;
|
|
|
9ae3a8 |
QObject *obj;
|
|
|
9ae3a8 |
QDict *qdict;
|
|
|
9ae3a8 |
Error *local_err = NULL;
|
|
|
9ae3a8 |
@@ -1828,12 +1829,18 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
qdict_flatten(qdict);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- blockdev_init(qdict, IF_NONE, &local_err);
|
|
|
9ae3a8 |
+ dinfo = blockdev_init(qdict, IF_NONE, &local_err);
|
|
|
9ae3a8 |
if (error_is_set(&local_err)) {
|
|
|
9ae3a8 |
error_propagate(errp, local_err);
|
|
|
9ae3a8 |
goto fail;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ if (bdrv_key_required(dinfo->bdrv)) {
|
|
|
9ae3a8 |
+ drive_uninit(dinfo);
|
|
|
9ae3a8 |
+ error_setg(errp, "blockdev-add doesn't support encrypted devices");
|
|
|
9ae3a8 |
+ goto fail;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
fail:
|
|
|
9ae3a8 |
qmp_output_visitor_cleanup(ov);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|