aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2017-05-12 12:33:49 +0200
committerKevin Wolf <kwolf@redhat.com>2017-07-10 13:18:06 +0200
commitc616f16e0c9a2d0b2f13785d37ca0f18d54d571f (patch)
treedee8dfb99b0445021ab925c46d86cf0e5625f204 /blockdev.c
parent6b4df5483333fc6ad950aadba8194f04ff450197 (diff)
blockdev: Print a warning for legacy drive options that belong to -device
We likely do not want to carry these legacy -drive options along forever. Let's emit a deprecation warning for the -drive options that have a replacement with the -device option, so that the (hopefully few) remaining users are aware of this and can adapt their scripts / behaviour accordingly. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index f92dcf24bf..e2016b6f37 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -50,6 +50,7 @@
#include "qmp-commands.h"
#include "block/trace.h"
#include "sysemu/arch_init.h"
+#include "sysemu/qtest.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/throttle-options.h"
@@ -798,6 +799,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
const char *filename;
Error *local_err = NULL;
int i;
+ const char *deprecated[] = {
+ "serial", "trans", "secs", "heads", "cyls", "addr"
+ };
/* Change legacy command line options into QMP ones */
static const struct {
@@ -881,6 +885,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
"update your scripts.\n");
}
+ /* Other deprecated options */
+ if (!qtest_enabled()) {
+ for (i = 0; i < ARRAY_SIZE(deprecated); i++) {
+ if (qemu_opt_get(legacy_opts, deprecated[i]) != NULL) {
+ error_report("'%s' is deprecated, please use the corresponding "
+ "option of '-device' instead", deprecated[i]);
+ }
+ }
+ }
+
/* Media type */
value = qemu_opt_get(legacy_opts, "media");
if (value) {