Acutally, I've changed xml from Paolo's proposal. I deleted the <target> as it is not easy to parse for virDomainDeviceInfoParseXML and there is nothing else. And I changed address type from scsi to drive as they are the same. On 03/06/2013 09:09 PM, Han Cheng wrote: > On 03/06/2013 02:24 PM, Osier Yang wrote: >> On 2013年03月04日 14:01, Han Cheng wrote: >>> Adding scsi hostdev, it should 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> >>> @@ -3893,4 +3921,9 @@ >>> </element> >>> <empty/> >>> </define> >>> +<define name="scsiAdapter"> >>> +<data type="string"> >>> +<param name="pattern">scsi_host[0-9]{1,2}</param> >> >> No need to have a duplicate definition. It can reuse what >> storage pool uses. >> > This is possible. > But what make differences is the number. If we don't deal with it and > storage it as string, we'll have to deal with it when build command line. > > Or, we just change the xml: > <source> > <adapter name='scsi_host0'/> > <address bus='0' target='0' unit='0'/> > </source> > --> > <source> > <address host='0' bus='0' target='0' unit='0'/> > </source> > > And actually 'host' can be 'controller'. Then it is drive address. We > may reduce redundant codes. > >>> @@ -12997,6 +13119,15 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, >>> virBufferAdjustIndent(buf, 2); >>> switch (def->source.subsys.type) >>> { >>> + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: >>> + virBufferAsprintf(buf, "<adapter name='scsi_host%d'/>\n", >> >> This is hard code. Assuming that a scsi host device can have different >> name with "scsi_host" on platform other than Linux. So again, IMHO >> we should just storing the adapter name as string. >> > Actually I'm quite uncomfortable when writing this hard code. If we > change xml, this won't be problem. > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list -- -------------------------------------------------- Han Cheng Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No. 6 Wenzhu Road, Nanjing, 210012, China TEL: +86+25-86630566-8540 FUJITSU INTERNAL: 79955-8540 FAX: +86+25-83317685 MAIL: hanc.fnst@xxxxxxxxxxxxxx -------------------------------------------------- -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list