[libvirt] [PATCH 04/14] qemu: Factor out body of qemuDomainSetMetadata for universal use

Eric Blake eblake at redhat.com
Mon Sep 16 21:26:51 UTC 2013


On 09/10/2013 04:15 AM, Peter Krempa wrote:
> The function impelemnted common behavior that can be reused for other

s/impelemnted/implemented/

> hypervisor drivers that use the virDomainObj data structures. Factor out
> the core into a separate helper func.
> ---
>  src/conf/domain_conf.c   | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_conf.h   | 10 ++++++
>  src/libvirt_private.syms |  1 +
>  src/qemu/qemu_driver.c   | 73 ++++-------------------------------------
>  4 files changed, 103 insertions(+), 66 deletions(-)
> 

> +
> +    if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> +        switch ((virDomainMetadataType) type) {
> +        case VIR_DOMAIN_METADATA_DESCRIPTION:
> +            VIR_FREE(vm->def->description);
> +            if (VIR_STRDUP(vm->def->description, metadata) < 0)
> +                goto cleanup;

Pre-existing - but should we do the VIR_STRDUP into a temporary before
freeing the original, and only replace on success, so that at least on
an OOM situation we still leave the older string in vm->def rather than
losing both strings?  On the other hand, OOM recovery is best effort,
and someone should already be prepared for weird things to have happened
to their guest.  Certainly not something to change in this patch.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130916/6f37de5e/attachment-0001.sig>


More information about the libvir-list mailing list