• E
    conf: consolidate disk def allocation · bc3f5f19
    Eric Blake 提交于
    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: NEric Blake <eblake@redhat.com>
    bc3f5f19
domain_conf.c 625.9 KB