On 06/06/14 00:52, Eric Blake wrote:
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(a)redhat.com>
---
src/conf/domain_conf.c | 12 +++++++++++-
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/parallels/parallels_driver.c | 2 +-
src/qemu/qemu_command.c | 4 ++--
src/vbox/vbox_tmpl.c | 6 +++---
src/vmx/vmx.c | 2 +-
src/xenxs/xen_sxpr.c | 8 ++++----
src/xenxs/xen_xm.c | 4 ++--
9 files changed, 26 insertions(+), 14 deletions(-)
ACK,
Peter