qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 05/10] QemuOpts: add -set option


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 05/10] QemuOpts: add -set option
Date: Mon, 03 Aug 2009 10:44:28 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

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 via email to

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