qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 05/10] QemuOpts: add -set option
Date: Mon, 03 Aug 2009 10:44:28 +0200	[thread overview]
Message-ID: <4A76A36C.6070209@redhat.com> (raw)
In-Reply-To: <4A732385.1030806@codemonkey.ws>

On 07/31/09 19:01, Anthony Liguori wrote:
> Gerd Hoffmann wrote:
>> One use case will be file for drives (no filename quoting issues), i.e.
>>
>> -drive id=test,if=virtio
>> -set drive.test.file=/vmdisk/test-virtio.img
>>
>> It will work for any other option (assuming handled by QemuOpts) though.
>> Except for id= for obvious reasons ;).
>
> How can we make it work for id?

Do we want to?

> That is, it would be good to be able to fully define the drive via -set.
> I think this is necessary to introduce a config file.

Here is a short writeup how IDs are handled in the current implementation:

-drive params
   creates a new drive without id.  You can't use -set with that one.

-drive params,id=foo
   creates a new drive named 'foo'.  Trying to create another one named
   'foo' doesn't work, qemu will complain that it already exists.

-set drive.foo.param=value
   configure the (existing) drive foo.

So you need '-drive id=something' as minimum to create a new drive, then 
you can set all parameters via -set if you want.

Ordering of the command line options is important, the -drive switch 
which creates the new drive must come first.


This all isn't set in stone, it can be changed without too much effort. 
  We can make -set silently create a new drive in case the used id 
doesn't exist.  We can allow two -drive switches with the same id, so 
you could do -drive id=foo,if=scsi -drive id=foo,unit=3 and have the 
same effect as -drive id=foo,id=scsi,unit=3.  I just found the current 
behavior most useful for the command line.  If you mistype an ID you 
most likely get a useful error message from the parser for example.


A config file is a completely different story, the config file parser 
can implement different behavior.  It also depends on the config file 
format of course.  We could use git-style:

[drive "foo"]
   if=scsi
   unit=3
   file=/path/to/image

In that case we don't have that problem in the first place ;)

We could use somthing simliar to -set, i.e.

drive.foo.if = scsi
drive.foo.unit = 4
drive.foo.file = /path/to/image

Then the parser will of course create drive "foo" when it finds config 
entries for it.

cheers,
   Gerd

  reply	other threads:[~2009-08-03  8:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-31 10:25 [Qemu-devel] [PATCH 0/10] QemuOpts+qdev patches Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 01/10] QemuOpts: add some functions Gerd Hoffmann
2009-07-31 14:54   ` Luiz Capitulino
2009-07-31 10:25 ` [Qemu-devel] [PATCH 02/10] QemuOpts: qemu_opts_parse: fix id= parsing Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 03/10] QemuOpts: make the drive id actually show up in "info block" Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 04/10] QemuOpts: create qemu-config.h Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 05/10] QemuOpts: add -set option Gerd Hoffmann
2009-07-31 17:01   ` Anthony Liguori
2009-08-03  8:44     ` Gerd Hoffmann [this message]
2009-07-31 10:25 ` [Qemu-devel] [PATCH 06/10] QemuOpts: switch over -device Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 07/10] constify drive_get_by_id arg Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 08/10] add -drive if=none Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 09/10] qdev/prop: add drive property Gerd Hoffmann
2009-07-31 10:25 ` [Qemu-devel] [PATCH 10/10] qdev-ify virtio-blk Gerd Hoffmann

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=4A76A36C.6070209@redhat.com \
    --to=kraxel@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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).