qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] blockdev: Print a warning for legacy drive options that belong to -device
Date: Wed, 10 May 2017 18:12:25 +0200	[thread overview]
Message-ID: <c8e08409-3b6d-6b65-37f9-ea17381e687c@redhat.com> (raw)
In-Reply-To: <51843a32-50ee-391c-0377-a9b7db470ed1@redhat.com>

On 10.05.2017 17:55, Paolo Bonzini wrote:
> 
> 
> On 10/05/2017 17:50, Thomas Huth wrote:
>> 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.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  blockdev.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/blockdev.c b/blockdev.c
>> index 4d8cded..87a025a 100644
>> --- a/blockdev.c
>> +++ b/blockdev.c
>> @@ -797,6 +797,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"
>> +    };
>>  
>>      /* Change legacy command line options into QMP ones */
>>      static const struct {
>> @@ -880,6 +883,14 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
>>                  "update your scripts.\n");
>>      }
>>  
>> +    /* Other deprecated options */
>> +    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) {
> 
> This one should be deprecated too (separate patch if you prefer).

I tried to add it, but then the deprecation message is always shown. I
think this happens because of the default CD-ROM drive is create in vl.c
with CDROM_OPTS (that is defined to "media=cdrom").
So no clue how to properly print a deprecation option for "media" here
right now (and it should likely be in a separate patch if there is a
solution).

 Thomas

  reply	other threads:[~2017-05-10 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 15:50 [Qemu-devel] [PATCH] blockdev: Print a warning for legacy drive options that belong to -device Thomas Huth
2017-05-10 15:55 ` Paolo Bonzini
2017-05-10 16:12   ` Thomas Huth [this message]
2017-05-11  6:45     ` Markus Armbruster
2017-05-11  6:59       ` Thomas Huth
2017-05-11  7:09 ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8e08409-3b6d-6b65-37f9-ea17381e687c@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).