bc3f5f1 conf: consolidate disk def allocation

Authored and Committed by ericb 10 years ago
    conf: consolidate disk def allocation
    
    A future patch wants to create disk definitions with non-zero
    default contents; to avoid crashes, all callers that allocate
    a disk definition should go through a common point.
    
    I found allocation points by looking for any code that increments
    ndisks, as well as any matches for ALLOC.*disk.  Most places that
    modified ndisks were covered by the parse from XML to domain/device
    definition by initial domain creation or device hotplug; I also
    hand-checked all drivers that generate a device struct on the
    fly during getXMLDesc.
    
    * src/conf/domain_conf.h (virDomainDiskDefNew): New prototype.
    * src/conf/domain_conf.c (virDomainDiskDefNew): New function.
    (virDomainDiskDefParseXML): Use it.
    * src/parallels/parallels_driver.c (parallelsAddHddInfo):
    Likewise.
    * src/qemu/qemu_command.c (qemuParseCommandLine): Likewise.
    * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc): Likewise.
    * src/vmx/vmx.c (virVMXParseDisk): Likewise.
    * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr):
    Likewise.
    * src/xenxs/xen_xm.c (xenParseXM): Likewise.
    * src/libvirt_private.syms (domain_conf.h): Export it.
    
    Signed-off-by: Eric Blake <eblake@redhat.com>
    
        
file modified
+11 -1
file modified
+1 -0
file modified
+1 -0
file modified
+2 -2
file modified
+3 -3
file modified
+1 -1
file modified
+4 -4
file modified
+2 -2