[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

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'>
          <adapter name='scsi_host0'/>
          <address bus='0' target='0' unit='0'/>
        <address type='drive' controller='0' bus='0' target='4' unit='8'/>
@@ -11028,6 +11154,18 @@ virDomainDefParseXML(xmlDocPtr xml,
               goto error;

+        if (hostdev->source.subsys.type ==
+            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
+             * 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

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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]