Skip to contentSkip to conversation

QEMU/pc and scsi disks

Qemu-devel Laurent Vivier 8 participants 19 messages Mar 1, 2007 – Mar 25, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, but I propose a little patch to make SCSI disks visible. Disks are not bootable, I think we should write a BIOS for that ?

Regards,
Laurent

Signature · 3 lines
------------- [email protected]  --------------
       "Any sufficiently advanced technology is
  indistinguishable from magic." - Arthur C. Clarke
hw/lsi53c895a.c +0 -3
Index: qemu-0.9.0/hw/lsi53c895a.c
===================================================================
@@ -149,9 +149,6 @@
 #define PHASE_MI          7
 #define PHASE_MASK        7
 
-/* The HBA is ID 7, so for simplicitly limit to 7 devices.  */
-#define LSI_MAX_DEVS      7
-
 /* Maximum length of MSG IN data.  */
 #define LSI_MAX_MSGIN_LEN 8
 
vl.h +4 -1
Index: qemu-0.9.0/vl.h
===================================================================
@@ -917,7 +917,10 @@
 /* ide.c */
 #define MAX_DISKS 4
 
-extern BlockDriverState *bs_table[MAX_DISKS + 1];
+/* lsi53c895a.c */
+#define LSI_MAX_DEVS 7
+
+extern BlockDriverState *bs_table[MAX_DISKS + LSI_MAX_DEVS + 1];
 
 void isa_ide_init(int iobase, int iobase2, int irq,
                   BlockDriverState *hd0, BlockDriverState *hd1);
vl.c +44 -2

94 lines not on this page · raw message

hw/pc.c +5 -12
Index: qemu-0.9.0/hw/pc.c
===================================================================
@@ -711,23 +711,16 @@
     if (i440fx_state) {
         i440fx_init_memory_mappings(i440fx_state);
     }
-#if 0
-    /* ??? Need to figure out some way for the user to
-       specify SCSI devices.  */
+
     if (pci_enabled) {
         void *scsi;
-        BlockDriverState *bdrv;
 
         scsi = lsi_scsi_init(pci_bus, -1);
-        bdrv = bdrv_new("scsidisk");
-        bdrv_open(bdrv, "scsi_disk.img", 0);
-        lsi_scsi_attach(scsi, bdrv, -1);
-        bdrv = bdrv_new("scsicd");
-        bdrv_open(bdrv, "scsi_cd.iso", 0);
-        bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM);
-        lsi_scsi_attach(scsi, bdrv, -1);
+	for (i = 0; i < LSI_MAX_DEVS; i++) {
+	    if (bs_table[i + MAX_DISKS])
+        	lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1);
+	}
     }
-#endif
 }
 
 static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
#1 lore raw
Quoted 4 lines · Laurent Vivier

Hi,

As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, but I propose a little patch to make SCSI disks visible.

See previous discussion about how the disk options need to be fixed properly. Apart from anything else your patch completely ignores non-x86 targets. There's also no reason to limit to 7 disks, and we should support scsi cdroms.

Paul

#2 lore raw
Quoted 7 lines · Paul Brook
Quoted 4 lines · Laurent Vivier

Hi,

As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, but I propose a little patch to make SCSI disks visible.

See previous discussion about how the disk options need to be fixed properly.

Sorry, I didn't find it, but now I've found it.

Quoted 1 line

Apart from anything else your patch completely ignores non-x86 targets.

This patch was just to validate my approach... and it seems bad :-P

Quoted 2 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus. Of course, we could manage several bus. To add cdroms support, we can add parameters "-scd0", "-scd1", ...

Thank you for your comments.

Laurent

Signature · 3 lines
------------- [email protected]  --------------
       "Any sufficiently advanced technology is
  indistinguishable from magic." - Arthur C. Clarke
#3 lore raw
Quoted 11 lines · Laurent Vivier
Quoted 7 lines · Paul Brook
Quoted 4 lines · Laurent Vivier

Hi,

As I'm a newcomer, I don't know the story about qemu/pc and scsi disks, but I propose a little patch to make SCSI disks visible.

See previous discussion about how the disk options need to be fixed properly.

Sorry, I didn't find it, but now I've found it.

Quoted 8 lines
Quoted 1 line

Apart from anything else your patch completely ignores non-x86 targets.

This patch was just to validate my approach... and it seems bad :-P

Quoted 2 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus.

For wide scsi it is 15.

Quoted 3 lines

Of course, we
could manage several bus. To add cdroms support, we can add parameters "-scd0", "-scd1", ...

This gets unwieldy quickly.

Thiemo

#4 lore raw
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus.

For wide scsi it is 15.

I wouldn't bet on wide scsi working.
For PCI based systems you can add more host adapters to get more devices. I haven't actually tested this, but it should work.

Paul

#5 lore raw
Quoted 11 lines · Paul Brook
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus.

For wide scsi it is 15.

I wouldn't bet on wide scsi working.
For PCI based systems you can add more host adapters to get more devices. I haven't actually tested this, but it should work.

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

So, any comments on that patch? Any requirements on a format?

Regards,

Anthony Liguori

Quoted 9 lines

Paul

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#6 lore raw

I disagree. /bin/sh makes a very flexible config file format that I use. I use it on win32, Linux and Mac OS X.

I would prefer that you write another cross platform shell, than another config file. At least that way I could use the same config tool for more than one application.

Everytime this comes up, do I have to disagree again, so that my voice is not lost?

Any yes, adding features that I do not use increases the complexity and decreases the stability of the features I do use, so it would effect me. I have the same feeling about embedding VNC authentication, the samba server, etc.

Joe

Quoted 37 lines · Anthony Liguori
Quoted 11 lines · Paul Brook
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus.

For wide scsi it is 15.

I wouldn't bet on wide scsi working.
For PCI based systems you can add more host adapters to get more devices. I haven't actually tested this, but it should work.

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

So, any comments on that patch? Any requirements on a format?

Regards,

Anthony Liguori

Quoted 9 lines

Paul

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#9 lore raw
In reply to Anthony Liguori
Quoted 5 lines · Anthony Liguori

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

So, any comments on that patch? Any requirements on a format?

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

2. The %(blah)s syntax is a bit ugly. It's one of the few things in python I dislike. I'd prefer ${blah} and ${blah:modifier}.

3. It would be nice to be able to embed a config file in a qcow3 format so that one can ship an image with some default options in one file.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#10 lore raw
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

So, any comments on that patch? Any requirements on a format?

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

I think we should still provide the ability to set the most common options via the command line. I'm also fine with specifying single options on the command line. I suspect though that being able to do -config - is more useful for management tools than building large strings of command line options.

Quoted 1 line

2. The %(blah)s syntax is a bit ugly. It's one of the few things in python I dislike. I'd prefer ${blah} and ${blah:modifier}.

Yeah, I've never liked their printf syntax. I was interested in interpolation, the syntax really doesn't matter to me. sh is probably a bit easier on the eyes.

Quoted 1 line

3. It would be nice to be able to embed a config file in a qcow3 format so that one can ship an image with some default options in one file.

Yeah, definitely.

Regards,

Anthony Liguor

#11 lore raw
Quoted 6 lines · Anthony Liguori
Quoted 2 lines

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

I think we should still provide the ability to set the most common options via the command line. I'm also fine with specifying single options on the command line. I suspect though that being able to do -config - is more useful for management tools than building large
strings of command line options.

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

Of course the config file is very useful for a user maintaining a few virtual machines on their own, but when qemu is part of a longer food chain, I think it's just a complication.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#12 lore raw
Quoted 13 lines · Avi Kivity
Quoted 11 lines · Anthony Liguori
Quoted 5 lines

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

I think we should still provide the ability to set the most common options via the command line. I'm also fine with specifying single options on the command line. I suspect though that being able to do -config - is more useful for management tools than building large strings of command line options.

Quoted 6 lines

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

You're going to start hitting commandline length limits fairly rapidly (Windows in particular has a fairly low limit).

Paul

#13 lore raw
Quoted 11 lines · Paul Brook
Quoted 7 lines

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

You're going to start hitting commandline length limits fairly rapidly (Windows in particular has a fairly low limit).

Well, at list on linux, the limit is sane (1024 or 10240?).

Signature · 1 line
error compiling committee.c: too many arguments to function
#14 lore raw
Quoted 8 lines · Avi Kivity
Quoted 7 lines · Paul Brook
Quoted 6 lines

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

Quoted 4 lines
Quoted 2 lines

You're going to start hitting commandline length limits fairly rapidly (Windows in particular has a fairly low limit).

Well, at list on linux, the limit is sane (1024 or 10240?).

IIRC linux has a ~32k commandline limit. I wouldn't be surprised if configs end up exceeding that. If you're running on linux then creating a temporary file is also trivial[1].

Paul

[1] see mkstemp(3) and tmpfile(3).

#15 lore raw
In reply to Avi Kivity

Hi Avi,

Quoted 8 lines · Avi Kivity
Quoted 5 lines · Anthony Liguori

I think we should still provide the ability to set the most common options via the command line. I'm also fine with specifying single options on the command line. I suspect though that being able to do -config - is more useful for management tools than building large strings of command line options.

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

I think Anthony was suggesting that "-config -" would read the config from standard input, avoiding the need for any temporary file, and also avoiding any command-line length limits on any platforms (Win32 is unlikely to accept as much as Linux).

Cheers, Chris.

Signature · 4 lines
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |
#17 lore raw
In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori
Quoted 2 lines

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

I think we should still provide the ability to set the most common options via the command line. I'm also fine with specifying single options on the command line. I suspect though that being able to do -config - is more useful for management tools than building large
strings of command line options.

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

Sorry, I should have been more specific. I mean '-config -' where '-' would indicate reading from stdin.

Regards,

Anthony Liguori

Quoted 2 lines

Of course the config file is very useful for a user maintaining a few virtual machines on their own, but when qemu is part of a longer food chain, I think it's just a complication.

#16 lore raw
In reply to Chris Wilson
Quoted 4 lines · Chris Wilson

Hi Avi,

Quoted 1 line · Avi Kivity

Anthony Liguori wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

I think we should still provide the ability to set the most common
options via the command line. I'm also fine with specifying single
options on the command line. I suspect though that being able to
do -config - is more useful for management tools than building large strings of command line options.

Out of curiosity, why? If the options are store in some database, as is likely, surely it is easier to generate a longish command line than to generate a unique name for a file, remove it if it already exists, write out the data, launch qemu, and clean up the file later? And for migration, you have to regenerate it, since some options may have changed (cdrom media).

I think Anthony was suggesting that "-config -" would read the config from standard input, avoiding the need for any temporary file, and also avoiding any command-line length limits on any platforms (Win32 is unlikely to accept as much as Linux).

Ah, I missed the '-'. Thanks. Indeed it's quite easy to feed a config file from memory into qemu.

Signature · 1 line
error compiling committee.c: too many arguments to function
#18 lore raw
In reply to Avi Kivity
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

Quoted 9 lines
Quoted 2 lines

So, any comments on that patch? Any requirements on a format?

1. Any option should be settable either in the config file or command line. In other words, the user should not be forced to use a config file. This is useful for management programs who keep all options in an internal database, and for users who can experiment via a ^P edit edit edit <enter>.

2. The %(blah)s syntax is a bit ugly. It's one of the few things in python I dislike. I'd prefer ${blah} and ${blah:modifier}.

3. It would be nice to be able to embed a config file in a qcow3 format so that one can ship an image with some default options in one file.

No. 3 would be an outstanding feature to have. I think that *.vmx and *.vmdk is the stupidest thing ever for a commercial company like that trying to be portable.

-Joseph

#7 lore raw
In reply to Joe Batt
Quoted 1 line · Joe Batt

I disagree. /bin/sh makes a very flexible config file format that I use. I use it on win32, Linux and Mac OS X.

The problem with only taking command line arguments is that the number and size of command line arguments are severely limited on certain platforms. This is why almost every sufficiently aged/portable program supports either a config file or a method of taking command line options via a file. The later is really just a particular format of a config file.

If you care about scripting QEMU, then just do something like:

qemu -config - <<EOF
hda=${myhda}
hdb=${myhdb}
EOF

Regards,

Anthony Liguori

Quoted 51 lines

I would prefer that you write another cross platform shell, than another config file. At least that way I could use the same config tool for more than one application.

Everytime this comes up, do I have to disagree again, so that my voice is not lost?

Any yes, adding features that I do not use increases the complexity and decreases the stability of the features I do use, so it would effect me. I have the same feeling about embedding VNC authentication, the samba server, etc.

Joe

Quoted 37 lines · Anthony Liguori
Quoted 11 lines · Paul Brook
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

There's also no reason to limit to 7 disks, and we should support scsi cdroms.

The reason for 7 is the number of available id on the scsi bus.

For wide scsi it is 15.

I wouldn't bet on wide scsi working.
For PCI based systems you can add more host adapters to get more devices. I haven't actually tested this, but it should work.

I think most people agree that we need a config file. I haven't seen any comments on my config file patch though.

So, any comments on that patch? Any requirements on a format?

Regards,

Anthony Liguori

Quoted 9 lines

Paul

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#8 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 2 lines · Joe Batt

I disagree. /bin/sh makes a very flexible config file format that I use. I use it on win32, Linux and Mac OS X.

The problem with only taking command line arguments is that the number and size of command line arguments are severely limited on certain platforms. This is why almost every sufficiently aged/portable program supports either a config file or a method of taking command line options via a file. The later is really just a particular format of a config file.

FWIW, if somebody comes up with a patch for the latter method without duplicating the option parser I'll consider applying it.

Thiemo