Re: [PATCH v3 13/28] hw/xen: automatically assign device index to block devices

David Woodhouse
2023-10-27T08:46:15Z

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

On Fri, 2023-10-27 at 08:30 +0100, Durrant, Paul wrote:
>
> > +    if (blockdev->props.vdev.type == XEN_BLOCK_VDEV_TYPE_INVALID) {
> > +        XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev)));
> > +        char fe_path[XENSTORE_ABS_PATH_MAX + 1];
> > +        char *value;
> > +        int disk = 0;
> > +        unsigned long idx;
> > +
> > +        /* Find an unoccupied device name */
>
> Not sure this is going to work is it? What happens if 'hda' or 'sda', or
> 'd0' exists? I think you need to use the core of the code in
> xen_block_set_vdev() to generate names and search all possible encodings
> for each disk.

Do we care? You're allowed to have *all* of "hda", "sda" and "xvda" at
the same time. If a user explicitly provides "sda" and then provides
another disk without giving it a name, we're allowed to use "xvda".

Hell, you can also have *separate* backing stores provided as "hda1",
"sda1" and "xvda1". I *might* have tolerated a heckle that this
function should check for at least the latter of those, but when I was
first coding it up I was more inclined to argue "Don't Do That Then".

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]