[libvirt] [PATCH 3/6] Fix data structure handling when controllers are attached.
Daniel P. Berrange
berrange at redhat.com
Mon Mar 1 13:13:03 UTC 2010
On Fri, Feb 26, 2010 at 02:09:16PM +0100, Wolfgang Mauerer wrote:
> We must not delete the data part when the operation succeeds
> because it is required later on. The correct pattern to handle
> the parsed representation of the device information on success
> is dev->data.controller = NULL; virDomainDeviceDefFree(dev);,
> which leaves the structure pointed at by data in memory.
>
> Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer at siemens.com>
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> ---
> src/qemu/qemu_driver.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 1586e35..5394ff5 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6111,6 +6111,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
> if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
> ret = qemudDomainAttachPciControllerDevice(driver, vm,
> dev->data.controller, qemuCmdFlags);
> + if (ret == 0)
> + dev->data.controller = NULL;
> } else {
> qemuReportError(VIR_ERR_NO_SUPPORT,
> _("disk controller bus '%s' cannot be hotplugged."),
> --
ACK
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list