On Wed, 1 Jun 2011, Wei Liu wrote: > On Wed, Jun 1, 2011 at 9:59 PM, Ian Jackson wrote: > > Wei Liu writes ("[Xen-devel] Re: [PATCH] libxl: basic support for virtio disk"): > >> Revised patch. > >> > >> Add code in libxl__device_disk_string_of_backend. > >> > >> Upper limit of virtio disk follows scsi. > > > > I'm not sure what you mean here.  Do you mean that Linux only supports > > as many virtio disks as it supports scsi disks ?  Is this a > > fundamental limitation of the virtio protocol ? > > > > I asked about the limitation in qemu-devel, the answer is > > "virtio-blk as used by KVM is exposed as a virtio PCI adapter. There > is a 1:1 mapping between virtio-blk, PCI adapters, and block devices > being presented by QEMU: > > 1 virtio-blk device in guest == 1 virtio-pci adapter in guest == 1 > block device in QEMU > > The maximum number is really limited by the PCI bus, not virtio. In > terms of coding, you should try not to impose a hard limit at all." > > Thus Stefano suggest I use the same limitation as SCSI disk. The limitation on the number of partitions is meaningless for virtio and the limitation on the number of disks in arbitrary, as it is arbitrary the current limitation on the number of scsi disks. > >> +                else if (strncmp(disks[i].vdev, "vd", 2) == 0) > >> +                    drive = libxl__sprintf > >> +                        (gc, "file=%s,if=virtio,index=%d,media=disk,format=%s", > >> +                         disks[i].pdev_path, disk, format); > > > > Maybe I'm missing something but this seems not to use the partition > > number at all ? > > > > Also answered in qemu-devel > > "Partitions are not at the virtio-blk level. The guest operating > system will see the virtio-blk disk and scan its partition table to > determine which partitions are available. The limit then depends on > the partitioning scheme that you use (legacy boot record, GPT, etc)." > > So I'm not using the partition number here. > > In fact, we should not support vda1, vda2, right? > > The discussion thread is at > > http://marc.info/?l=qemu-devel&m=130689044627041&w=2 > Device names like xvda1, xvda2, etc, are currently supported only with PV guests. There is no way to specify a single partition with HVM guests. Considering that this patch is only meant for HVM guest, I think it is correct to leave out the partition number. > > The existing code seems rather broken TBH. > > > > Hmm... I'm not catching up with libxl. Should be more careful next time... Why should this code be broken? It seems all right to me. Does it break something?