On Fri, Nov 26, 2010 at 04:30:06PM +0000, Maciej Bliziński wrote:
> Here's a patch that allows to install Red Hat based systems, for example 
> Oracle
> Linux.  Tested with OEL.
> 
> The hypervisor by default offers a device named 'sda'.  If the SCSI module is
> already loaded, the disk device can't be created due to naming conflict, and
> the disk is not available.  A workaround is to modify the initrd by removing
> the scsi driver from it.  This helps, but doesn't allow to install the OS.
> 
> Red Hat's installer, anaconda, runs parted, which tries to execute a check
> against /dev/sda and fails.  This makes anaconda think that the disk is 
> faulty,
> and not available.  The best way to work around this, is to declare 'xvda' as
> the xen disk device.
> 
> This patch allows to pass -H xen-pvm:blockdev_prefix="xvd" and successfully 
> run
> the Red Hat installer.

The patch looks good overall, but this bit worries me:

> @@ -639,13 +642,20 @@ class XenHvmHypervisor(XenHypervisor):
>        vif_data.append("'%s'" % nic_str)
>  
>      config.write("vif = [%s]\n" % ",".join(vif_data))
> -    disk_data = cls._GetConfigFileDiskData(block_devices)
> +
> +    blockdev_prefix = hvp[constants.HV_BLOCKDEV_PREFIX]
> +    # A special case for HT_DISK_IOEMU; if the blockdev prefix hasn't been
> +    # specified, use "ioemu:hd".
> +    default_blockdev = (
> +        constants.HVC_DEFAULTS[HT_XEN_HVM[constants.HV_BLOCKDEV_PREFIX]])
>      disk_type = hvp[constants.HV_DISK_TYPE]
> -    if disk_type in (None, constants.HT_DISK_IOEMU):
> -      replacement = ",ioemu:hd"
> -    else:
> -      replacement = ",hd"
> -    disk_data = [line.replace(",sd", replacement) for line in disk_data]
> +    disk_is_ioemu = disk_type in (None, constants.HT_DISK_IOEMU)
> +    prefix_is_default = blockdev_prefix == default_blockdev
> +    if (prefix_is_default and disk_is_ioemu):
> +      blockdev_prefix = "ioemu:hd"
> +
> +    disk_data = cls._GetConfigFileDiskData(block_devices, blockdev_prefix)

Basically we do allow partial customization, but not complete. There's
no way to enforce the default (what if we specifically set it to
default?). I wonder if it makes sense at all to allow customization for
HVM, and not (like before) use hd for non-ioemu and ioemu:hd for ioemu.

iustin

Reply via email to