qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 01/22] QemuOpts: fix a bug in QemuOpts when


From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: [PATCH 01/22] QemuOpts: fix a bug in QemuOpts when setting an option twice
Date: Tue, 08 Jun 2010 08:07:34 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4

On 06/08/2010 05:32 AM, Paolo Bonzini wrote:
On 06/08/2010 09:51 AM, Gerd Hoffmann wrote:
On 06/08/10 01:51, Anthony Liguori wrote:
Right now, if you set a QemuOpts option in a section twice, when
you get the option you'll receive the value that was set the first
time. This is less than ideal because if you're manipulating
options in two places like a global config followed by the command
line, you really want the later to override the former.

This patch fixes this behavior.

Note that this reverses the ordering for users which want multiple
values (slirp forwarding for example).

And qemu_opt_find seems to have thought about this too:

static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)
{
    QemuOpt *opt;

    QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
        if (strcmp(opt->name, name) != 0)
            continue;
        return opt;
    }
    return NULL;
}

Can you show the behavior with commandline arguments only?

The problem I was trying to address can be seen with something like:

-drive file=foo.img,if=virtio,file=bar.img

You get no error, and foo.img is what gets used. It's fair to argue this is a silly use case but what I'm trying to achieve is to make it possible to do:

-drive file=foo.img,if=virtio,id=bar -drive file=bar.img,id=bar

Or more specifically:

foo.conf:

[drive]
  file=foo.img
  if=virtio
  id=bar

qemu -readconfig foo.conf -drive file=bar.img,id=bar

IMHO, what's specified next on the command line ought to override what's in the config.

Suggestions how to achieve this in a more elegant way would be appreciated.

Regards,

Anthony Liguori

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]