[libvirt] [PATCH v2] virsh domxml-from-native to treat SCSI as the bus type for pseries by default

Ján Tomko jtomko at redhat.com
Thu Nov 14 10:02:02 UTC 2013


On 10/28/2013 10:20 AM, Shivaprasad G Bhat wrote:
> The bus type IDE being enum Zero, the bus type on pseries system appears as IDE for all the disk types. Pseries platform needs this to appear as SCSI instead of IDE.
> 
> Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
> ---
>  src/qemu/qemu_domain.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index b8aec2d..df06c13 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -827,6 +827,12 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>      if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
>          virDomainDiskDefPtr disk = dev->data.disk;
>  
> +        if ((def->os.arch == VIR_ARCH_PPC64) &&
> +            def->os.machine && STREQ(def->os.machine, "pseries") &&
> +            (disk->bus == VIR_DOMAIN_DISK_BUS_IDE)) {
> +            disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
> +        }
> +
>          /* both of these require data from the driver config */
>          if (driver && (cfg = virQEMUDriverGetConfig(driver))) {
>              /* assign default storage format and driver according to config */
> @@ -868,6 +874,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>          (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X))
>          dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
>  
> +    if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
> +        dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
> +        def->os.machine && STREQ(def->os.machine, "pseries"))
> +        dev->data.controller->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
> +
>      /* set the default USB model to none for s390 unless an address is found */
>      if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
>          dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
> 

This would also affect XML parsing, as these PostParse functions are called
when parsing the XML too, not just when doing a XML->native translation.

This also affect all the disks specified on the command line. You shouldn't
assume the disk is SCSI when IDE was explicitly specified.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131114/d2207f3a/attachment-0001.sig>


More information about the libvir-list mailing list