The qemu-img dd command added --image-opts support, but missed the corresponding --object support. This prevented passing secrets (eg auth passwords) needed by certain disk images.
Reviewed-by: Eric Blake <[email protected]> Signed-off-by: Daniel P. Berrange <[email protected]> --- qemu-img.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qemu-img.c b/qemu-img.c index cff22e3..739345e 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3951,6 +3951,7 @@ static int img_dd(int argc, char **argv) }; const struct option long_options[] = { { "help", no_argument, 0, 'h'}, + { "object", required_argument, 0, OPTION_OBJECT}, { "image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, { 0, 0, 0, 0 } }; @@ -3973,6 +3974,15 @@ static int img_dd(int argc, char **argv) case 'h': help(); break; + case OPTION_OBJECT: { + QemuOpts *opts; + opts = qemu_opts_parse_noisily(&qemu_object_opts, + optarg, true); + if (!opts) { + ret = -1; + goto out; + } + } break; case OPTION_IMAGE_OPTS: image_opts = true; break; @@ -4017,6 +4027,14 @@ static int img_dd(int argc, char **argv) ret = -1; goto out; } + + if (qemu_opts_foreach(&qemu_object_opts, + user_creatable_add_opts_foreach, + NULL, NULL)) { + ret = -1; + goto out; + } + blk1 = img_open(image_opts, in.filename, fmt, 0, false, false); if (!blk1) { -- 2.9.3
