Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Ram Pai
On Wed, 2009-07-15 at 18:04 +0300, Blue Swirl wrote:
 On 7/15/09, Ram Pai linux...@us.ibm.com wrote:
  Problem: It is impossible to feed filenames with the character colon because
   qemu interprets such names as a protocol. For example filename scsi:0, is
   interpreted as a protocol by name scsi.
 
   --- a/block/raw-posix.c
   +++ b/block/raw-posix.c
   +static int qemu_open(const char *filename, int flags, ...)
 
   --- a/block/raw-win32.c
   +++ b/block/raw-win32.c
   +fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
 
 I bet this won't compile on win32.

yes. good catch. fix is in the next revision(rev 6). However I do not
have a setup to compile and test changes in win32-raw.c . I will have to
rely on somebody to do the testing. 

RP



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Kevin Wolf
Ram Pai schrieb:
 On Wed, 2009-07-15 at 18:04 +0300, Blue Swirl wrote:
 On 7/15/09, Ram Pai linux...@us.ibm.com wrote:
 Problem: It is impossible to feed filenames with the character colon because
  qemu interprets such names as a protocol. For example filename scsi:0, is
  interpreted as a protocol by name scsi.
  --- a/block/raw-posix.c
  +++ b/block/raw-posix.c
  +static int qemu_open(const char *filename, int flags, ...)
  --- a/block/raw-win32.c
  +++ b/block/raw-win32.c
  +fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
 I bet this won't compile on win32.
 
 yes. good catch. fix is in the next revision(rev 6). However I do not
 have a setup to compile and test changes in win32-raw.c . I will have to
 rely on somebody to do the testing. 

It's not that complicated to set up a mingw cross build environment.
Have you tried that? At least it would help you to catch compile errors.
(And I usually run it in Wine then to check that it's not completely broken)

Kevin
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Amit Shah
On (Wed) Jul 15 2009 [10:40:37], Anthony Liguori wrote:
 Blue Swirl wrote:
 Then how about something like:
  -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
  -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
  -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
   

 The explicit ordering part seems clunky to me.  How about:

 -drive name=vda,if=virtio -drive.vda.file filename.img

 What's nice about this syntax is it generalizes well.  You could have:

 -drive.vda.if virtio -drive.vda.file filename.img

How would you differentiate between multiple files? For example,
filename1.img should be the boot drive and filename2.img should be the
secondary drive.

Amit
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Markus Armbruster
Anthony Liguori aligu...@us.ibm.com writes:

 Blue Swirl wrote:
 Then how about something like:
  -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
  -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
  -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
   

 The explicit ordering part seems clunky to me.  How about:

 -drive name=vda,if=virtio -drive.vda.file filename.img

 What's nice about this syntax is it generalizes well.  You could have:

 -drive.vda.if virtio -drive.vda.file filename.img
 -net nic,model=rtl8139,name=foo -net.foo.macaddr 00:11:43:55:44:22

Sanest proposal so far.  Just put filenames in separate arguments, as
with almost every other program.

Instead of name=, let's use id= from Gerd's qdev work.

Why -drive.ID.NAME VALUE, -net.ID.NAME VALUE and so forth, i.e. one
option per object with parameters?  Assuming the ID name space is flat,
a single option suffices.  What about -set ID.NAME=VALUE?

Quoting is problematic.  Not only because it necessarily breaks some
filenames that used to work, also because the shell quotes, too.  I
don't enjoy counting backslashes.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Anthony Liguori

Markus Armbruster wrote:

Anthony Liguori aligu...@us.ibm.com writes:

  

Blue Swirl wrote:


Then how about something like:
 -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
 -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
 -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
  
  

The explicit ordering part seems clunky to me.  How about:

-drive name=vda,if=virtio -drive.vda.file filename.img

What's nice about this syntax is it generalizes well.  You could have:

-drive.vda.if virtio -drive.vda.file filename.img
-net nic,model=rtl8139,name=foo -net.foo.macaddr 00:11:43:55:44:22



Sanest proposal so far.  Just put filenames in separate arguments, as
with almost every other program.

Instead of name=, let's use id= from Gerd's qdev work.
  


Works for me.


Why -drive.ID.NAME VALUE, -net.ID.NAME VALUE and so forth, i.e. one
option per object with parameters?  Assuming the ID name space is flat,
a single option suffices.  What about -set ID.NAME=VALUE?
  


Looks attractive on the surface.  Feels really difficult to implement :-)


Quoting is problematic.  Not only because it necessarily breaks some
filenames that used to work, also because the shell quotes, too.  I
don't enjoy counting backslashes.
  


Yup.

Regards,

Anthony Liguori
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Gerd Hoffmann

On 07/16/09 15:43, Markus Armbruster wrote:


Why -drive.ID.NAME VALUE, -net.ID.NAME VALUE and so forth, i.e. one
option per object with parameters?  Assuming the ID name space is flat,
a single option suffices.  What about -set ID.NAME=VALUE?


Hmm, I think we will have multiple namespaces.  At least one for guest 
devices and one for host backends.  Probably also different namespaces 
for different kinds of host backends (disk / net / char / ...).


-set or maybe -drive-set id.name= should be easier to handle then 
-drive.id.name with qemu's command line option parser.


cheers,
  Gerd
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-16 Thread Gerd Hoffmann

On 07/16/09 16:10, Anthony Liguori wrote:

Why -drive.ID.NAME VALUE, -net.ID.NAME VALUE and so forth, i.e. one
option per object with parameters? Assuming the ID name space is flat,
a single option suffices. What about -set ID.NAME=VALUE?


Looks attractive on the surface. Feels really difficult to implement :-)


Shouldn't be that horrible.  Look at QemuOpts in the drive patches v3 ;)

cheers,
  Gerd

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Blue Swirl
On 7/15/09, Ram Pai linux...@us.ibm.com wrote:
 Problem: It is impossible to feed filenames with the character colon because
  qemu interprets such names as a protocol. For example filename scsi:0, is
  interpreted as a protocol by name scsi.

  --- a/block/raw-posix.c
  +++ b/block/raw-posix.c
  +static int qemu_open(const char *filename, int flags, ...)

  --- a/block/raw-win32.c
  +++ b/block/raw-win32.c
  +fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,

I bet this won't compile on win32.

Instead of this (IMHO doomed) escape approach, maybe the filename
parameter could be specified as the next argument, for example:
-hda format=qcow2,blah,blah,filename_is_next_arg -hda filename with
funky characters like ',' ':'  '!'
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Anthony Liguori

Blue Swirl wrote:

I bet this won't compile on win32.

Instead of this (IMHO doomed) escape approach, maybe the filename
parameter could be specified as the next argument, for example:
-hda format=qcow2,blah,blah,filename_is_next_arg -hda filename with
funky characters like ',' ':'  '!'
  


-drive name=hda,if=ide,cache=off -hda foo.img
-drive name=vda,if=virtio,cache=writeback -vda foo.img
-drive name=sdb,if=scsi,unit=1 -sdb boo.img

But Paul has long objected to having -vda or -sda syntaxes.  I do agree 
though that the most sane thing to do is to make the filename an 
independent argument.


--
Regards,

Anthony Liguori

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Blue Swirl
On 7/15/09, Anthony Liguori aligu...@us.ibm.com wrote:
 Blue Swirl wrote:

  I bet this won't compile on win32.
 
  Instead of this (IMHO doomed) escape approach, maybe the filename
  parameter could be specified as the next argument, for example:
  -hda format=qcow2,blah,blah,filename_is_next_arg -hda
 filename with
  funky characters like ',' ':'  '!'
 
 

  -drive name=hda,if=ide,cache=off -hda foo.img
  -drive name=vda,if=virtio,cache=writeback -vda foo.img
  -drive name=sdb,if=scsi,unit=1 -sdb boo.img

  But Paul has long objected to having -vda or -sda syntaxes.  I do agree
 though that the most sane thing to do is to make the filename an independent
 argument.

Then how about something like:
 -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
 -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
 -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Anthony Liguori

Kevin Wolf wrote:

Anthony Liguori schrieb:
  

Blue Swirl wrote:


I bet this won't compile on win32.

Instead of this (IMHO doomed) escape approach, maybe the filename
parameter could be specified as the next argument, for example:
-hda format=qcow2,blah,blah,filename_is_next_arg -hda filename with
funky characters like ',' ':'  '!'
  
  

-drive name=hda,if=ide,cache=off -hda foo.img
-drive name=vda,if=virtio,cache=writeback -vda foo.img
-drive name=sdb,if=scsi,unit=1 -sdb boo.img



So the names would need to be out of some reserved namespace like hdX,
sdX and vdX only? Or can I choose freely and call my disks net and
vnc and have them conflict with the respective existing options?
  


Yup, bad suggestion on my part.  See my next suggestion.


Also, when discussing the syntax, don't forget that there also is
-usbdevice disk: which would need to be changed in some way, too.

Kevin
  



--
Regards,

Anthony Liguori

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Anthony Liguori

Blue Swirl wrote:

Then how about something like:
 -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
 -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
 -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
  


The explicit ordering part seems clunky to me.  How about:

-drive name=vda,if=virtio -drive.vda.file filename.img

What's nice about this syntax is it generalizes well.  You could have:

-drive.vda.if virtio -drive.vda.file filename.img
-net nic,model=rtl8139,name=foo -net.foo.macaddr 00:11:43:55:44:22

--
Regards,

Anthony Liguori

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Paul Brook
On Wednesday 15 July 2009, Anthony Liguori wrote:
 Blue Swirl wrote:
  I bet this won't compile on win32.
 
  Instead of this (IMHO doomed) escape approach, maybe the filename
  parameter could be specified as the next argument, for example:
  -hda format=qcow2,blah,blah,filename_is_next_arg -hda filename with
  funky characters like ',' ':'  '!'

 -drive name=hda,if=ide,cache=off -hda foo.img
 -drive name=vda,if=virtio,cache=writeback -vda foo.img
 -drive name=sdb,if=scsi,unit=1 -sdb boo.img

 But Paul has long objected to having -vda or -sda syntaxes.  I do agree
 though that the most sane thing to do is to make the filename an
 independent argument.

I dislike implicit ordering of arguments even less. Having -foo -bar behave 
differently to -bar -foo is bad. We already have this a bit for things like 
-net, but splitting something into two as a parsing hack seems really lame.

How about -drive args=whatever,unparsed_name=bah

Where unparsed_name is defined to be the last argument, and blah is 
interpreted literally.

Paul
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Gerd Hoffmann

On 07/15/09 17:14, Anthony Liguori wrote:

Blue Swirl wrote:

I bet this won't compile on win32.

Instead of this (IMHO doomed) escape approach, maybe the filename
parameter could be specified as the next argument, for example:
-hda format=qcow2,blah,blah,filename_is_next_arg -hda filename with
funky characters like ',' ':'  '!'


-drive name=hda,if=ide,cache=off -hda foo.img
-drive name=vda,if=virtio,cache=writeback -vda foo.img
-drive name=sdb,if=scsi,unit=1 -sdb boo.img

But Paul has long objected to having -vda or -sda syntaxes. I do agree
though that the most sane thing to do is to make the filename an
independent argument.


Jumping in here as I'm looking into this from the qdev-ifying point of 
view ;)


I'd like to move to a model where -drive adds host-side state only and
the actual disks are added via -device, i.e. something like

  -drive if=none,name=foo,file=/path/to/file
  -device virtio-blk-pci,drive=foo

Instead of using '-drive if=none' we could use some other syntax where 
the filename can be passed as separate argument.  Can switches have two 
arguments?  If so, maybe this:


  -hostdrive $file $options

comments?

cheers,
  Gerd
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Paul Brook
 Instead of using '-drive if=none' we could use some other syntax where
 the filename can be passed as separate argument.  Can switches have two
 arguments?  If so, maybe this:

-hostdrive $file $options

This only works for a single mandatory argument that needs to contain awkward 
characters.

Paul
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Kevin Wolf
Anthony Liguori schrieb:
 Blue Swirl wrote:
 Then how about something like:
  -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
  -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
  -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
   
 
 The explicit ordering part seems clunky to me.  How about:
 
 -drive name=vda,if=virtio -drive.vda.file filename.img
 
 What's nice about this syntax is it generalizes well.  You could have:
 
 -drive.vda.if virtio -drive.vda.file filename.img
 -net nic,model=rtl8139,name=foo -net.foo.macaddr 00:11:43:55:44:22

Looks like a very verbose syntax. However, it's the cleanest suggestion
so far, IMHO. It might be perfectly reasonable to use for management
apps or for a single option (the file name) manually as needed. We'll
need to retain the old, more convenient syntax anyway for compatibility.
Your examples are mixed style already, so this is probably what you
intended anyway.

Kevin
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH] rev5: support colon in filenames

2009-07-15 Thread Michael S. Tsirkin
On Wed, Jul 15, 2009 at 10:40:37AM -0500, Anthony Liguori wrote:
 Blue Swirl wrote:
 Then how about something like:
  -drive name=hda,if=ide,cache=off,file_is_arg -filearg foo.img
  -drive name=vda,if=virtio,cache=writeback,file_comes_next  -patharg  foo.img
  -drive name=sdb,if=scsi,unit=1,fnarg -fnarg boo.img
   

 The explicit ordering part seems clunky to me.  How about:

 -drive name=vda,if=virtio -drive.vda.file filename.img

 What's nice about this syntax is it generalizes well.  You could have:

 -drive.vda.if virtio -drive.vda.file filename.img
 -net nic,model=rtl8139,name=foo -net.foo.macaddr 00:11:43:55:44:22

nice.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html