Re: [libvirt] [PATCH 15/34] Auto-add disk controllers based on defined disks

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

 



On Fri, Jan 15, 2010 at 04:24:16PM +0100, Daniel Veillard wrote:
> On Fri, Jan 08, 2010 at 05:23:11PM +0000, Daniel P. Berrange wrote:
> > Existing applications using libvirt are not aware of the disk
> > controller concept. Thus, after parsing the <disk> definitions
> > in the XML, it is neccessary to create <controller> elements
> > to satisfy all requested disks, as per their defined drive
> > addresses
> > 
> > * src/conf/domain_conf.c, src/conf/domain_conf.h,
> >   src/libvirt_private.syms: Add virDomainDefAddDiskControllers()
> >   method for populating disk controllers, and call it after
> >   parsing disk definitions.
> > * src/qemu/qemu_conf.c: Call virDomainDefAddDiskControllers()
> >   when doing ARGV -> XML conversion
> > * tests/qemuxml2argvdata/qemuxml2argv*.xml: Add disk controller
> >   data to all data files which don't have it already
> 
> > +/*
> > + * Based on the declared <address type=drive> info for any disks,
> > + * add neccessary drive controllers which are not already present
> > + * in the XML. This is for compat with existing apps which will
> > + * not know/care about <controller> info in the XML
> > + */
> > +int virDomainDefAddDiskControllers(virDomainDefPtr def)
> > +{
> > +    if (virDomainDefAddDiskControllersForType(def,
> > +                                              VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
> > +                                              VIR_DOMAIN_DISK_BUS_SCSI) < 0)
> > +        return -1;
> > +
> > +    if (virDomainDefAddDiskControllersForType(def,
> > +                                              VIR_DOMAIN_CONTROLLER_TYPE_FDC,
> > +                                              VIR_DOMAIN_DISK_BUS_FDC) < 0)
> > +        return -1;
> > +
> > +    if (virDomainDefAddDiskControllersForType(def,
> > +                                              VIR_DOMAIN_CONTROLLER_TYPE_IDE,
> > +                                              VIR_DOMAIN_DISK_BUS_IDE) < 0)
> > +        return -1;
> > +
> > +    return 0;
> > +}
> 
> IIRC a previous patch in the serie disk controler are not sorted,
> so the order here is just arbitrary, right ?

The code is not sorting controller types, merely controller indexes
within a given type. So SCSI / FDC / IDE can appear in any order,
but if you add an extra controller of type 'SCSI', it will be inserted
in correct position wrt existing SCSI controllers.

> 
> 
> > --- a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
> > @@ -21,5 +21,7 @@
> >        <readonly/>
> >        <address type='drive' controller='0' bus='0' unit='0'/>
> >      </disk>
> > +    <controller type='ide' index='0'/>
> > +    <controller type='fdc' index='0'/>
> >    </devices>
> >  </domain>
> 
>   strange here in the output we get ide before fdc, I would have assume
> the reverse based on the new function. I hope the order in generated
> output won't change randomly.
> 
>   Except that remark looks fine, ACK,


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]