[libvirt] [PATCH v2.5 03/10] conf: Introduce scsi hostdev
Han Cheng
hanc.fnst at cn.fujitsu.com
Mon Apr 15 12:27:10 UTC 2013
Thanks for your best efforts.
I only have one problem. Please find it at the end.
于 2013/4/10 16:59, Osier Yang 写道:
> On 09/04/13 10:32, Han Cheng wrote:
>> Add scsi hostdev, it looks like:
>>
>> <hostdev mode='subsystem' type='scsi'>
>> <source>
>> <adapter name='scsi_host0'/>
>> <address bus='0' target='0' unit='0'/>
>> </source>
>> <address type='drive' controller='0' bus='0' target='4' unit='8'/>
>> </hostdev>
>> @@ -11028,6 +11154,18 @@ virDomainDefParseXML(xmlDocPtr xml,
>> goto error;
>> }
>>
>> + if (hostdev->source.subsys.type ==
> VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
>> + hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
> {
>> + /* We define default mapping to be 1 controller, 1 bus,
>> + * 1 target and many units. And we reserve first 16 unit
> for
>> + * disk usage in virDomainDiskDefAssignAddress */
>> + hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
>> + hostdev->info->addr.drive.controller = 0;
>> + hostdev->info->addr.drive.bus = 0;
>> + hostdev->info->addr.drive.target = 0;
>> + hostdev->info->addr.drive.unit = 16 + i;
> Why do we need to set the default values here? Per the "address" is
> mandatory.
>
I don't think so.
The <address> in <source> is mandatory and is parsed by
virDomainHostdevSubsysScsiDefParseXML
called by virDomainHostdevSubsysUsbDefParseXML. The <address> out of
<source> is not mandatory and is
parsed by virDomainDeviceInfoParseXML which is called by
virDomainHostdevDefParseXML. So we may need to
set the default values.
I'm afraid you have mixed these two addresses.
Cheng,
Regards
More information about the libvir-list
mailing list