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

Li Zhang zhlcindy at linux.vnet.ibm.com
Fri Nov 15 03:20:59 UTC 2013


On 2013年11月14日 18:02, Ján Tomko wrote:
> 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.

This patch is to parse "-hda" as SCSI device type because Power doesn't 
support IDE device.
I am not sure whether it's necessary to keep IDE device type for Power 
in libvirt.
Currently, QEMU set "-hda" as SCSI for Power platform.

>
> Jan
>


-- 

Li Zhang
IBM China Linux Technology Centre




More information about the libvir-list mailing list