]> xenbits.xensource.com Git - libvirt.git/commit
conf: consolidate disk def allocation
authorEric Blake <eblake@redhat.com>
Wed, 21 May 2014 22:50:41 +0000 (16:50 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 6 Jun 2014 15:56:27 +0000 (09:56 -0600)
commitbc3f5f190e2d8cb77db855a60b7f6639969d42ca
tree78ed351bff33c6f9f8b8072653f4b8ec65521b68
parent00c6327a12b1ef63889984074a18de1a3b273615
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>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/parallels/parallels_driver.c
src/qemu/qemu_command.c
src/vbox/vbox_tmpl.c
src/vmx/vmx.c
src/xenxs/xen_sxpr.c
src/xenxs/xen_xm.c