[libvirt] [PATCH v2.5 03/10] conf: Introduce scsi hostdev

Hu Tao hutao at cn.fujitsu.com
Thu Apr 18 03:55:05 UTC 2013


On Mon, Apr 15, 2013 at 08:27:10PM +0800, Han Cheng wrote:
> 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

s/virDomainHostdevSubsysUsbDefParseXML/virDomainHostdevDefParseXMLSubsys/

> <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.

I think Osier means hostdev/address, but not hostdev/source/address.





More information about the libvir-list mailing list