提交 c616f16e 编写于 作者: T Thomas Huth 提交者: Kevin Wolf

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: NThomas Huth <thuth@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 6b4df548
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "qmp-commands.h" #include "qmp-commands.h"
#include "block/trace.h" #include "block/trace.h"
#include "sysemu/arch_init.h" #include "sysemu/arch_init.h"
#include "sysemu/qtest.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/help_option.h" #include "qemu/help_option.h"
#include "qemu/throttle-options.h" #include "qemu/throttle-options.h"
...@@ -798,6 +799,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) ...@@ -798,6 +799,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
const char *filename; const char *filename;
Error *local_err = NULL; Error *local_err = NULL;
int i; int i;
const char *deprecated[] = {
"serial", "trans", "secs", "heads", "cyls", "addr"
};
/* Change legacy command line options into QMP ones */ /* Change legacy command line options into QMP ones */
static const struct { static const struct {
...@@ -881,6 +885,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) ...@@ -881,6 +885,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
"update your scripts.\n"); "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 */ /* Media type */
value = qemu_opt_get(legacy_opts, "media"); value = qemu_opt_get(legacy_opts, "media");
if (value) { if (value) {
......
...@@ -818,6 +818,8 @@ of available connectors of a given interface type. ...@@ -818,6 +818,8 @@ of available connectors of a given interface type.
This option defines the type of the media: disk or cdrom. This option defines the type of the media: disk or cdrom.
@item cyls=@var{c},heads=@var{h},secs=@var{s}[,trans=@var{t}] @item cyls=@var{c},heads=@var{h},secs=@var{s}[,trans=@var{t}]
These options have the same definition as they have in @option{-hdachs}. These options have the same definition as they have in @option{-hdachs}.
These parameters are deprecated, use the corresponding parameters
of @code{-device} instead.
@item snapshot=@var{snapshot} @item snapshot=@var{snapshot}
@var{snapshot} is "on" or "off" and controls snapshot mode for the given drive @var{snapshot} is "on" or "off" and controls snapshot mode for the given drive
(see @option{-snapshot}). (see @option{-snapshot}).
...@@ -852,9 +854,12 @@ Specify which disk @var{format} will be used rather than detecting ...@@ -852,9 +854,12 @@ Specify which disk @var{format} will be used rather than detecting
the format. Can be used to specify format=raw to avoid interpreting the format. Can be used to specify format=raw to avoid interpreting
an untrusted format header. an untrusted format header.
@item serial=@var{serial} @item serial=@var{serial}
This option specifies the serial number to assign to the device. This option specifies the serial number to assign to the device. This
parameter is deprecated, use the corresponding parameter of @code{-device}
instead.
@item addr=@var{addr} @item addr=@var{addr}
Specify the controller's PCI address (if=virtio only). Specify the controller's PCI address (if=virtio only). This parameter is
deprecated, use the corresponding parameter of @code{-device} instead.
@item werror=@var{action},rerror=@var{action} @item werror=@var{action},rerror=@var{action}
Specify which @var{action} to take on write and read errors. Valid actions are: Specify which @var{action} to take on write and read errors. Valid actions are:
"ignore" (ignore the error and try to continue), "stop" (pause QEMU), "ignore" (ignore the error and try to continue), "stop" (pause QEMU),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册