Re: [PATCH 2/6] conf: Introduce virStoragePoolSaveXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 02, 2015 at 12:10:36 +0200, Erik Skultety wrote:
> Make XML definition saving more generic by moving the common code into
> virStoragePoolSaveXML and leave case specific code to
> PoolSave{Status,Config,...} functions.
> ---
>  src/conf/storage_conf.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
> index a8e9876..73b937e 100644
> --- a/src/conf/storage_conf.c
> +++ b/src/conf/storage_conf.c
> @@ -1913,11 +1913,25 @@ virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
>      return ret;
>  }
>  
> +
> +static int virStoragePoolSaveXML(const char *path,
> +                                 virStoragePoolDefPtr def,
> +                                 const char *xml)
> +{
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> +    int ret = -1;
> +
> +    virUUIDFormat(def->uuid, uuidstr);
> +    ret = virXMLSaveFile(path,
> +                         virXMLPickShellSafeComment(def->name, uuidstr),
> +                         "pool-edit", xml);
> +
> +    return ret;
> +}
>  int

Missing empty lines between functions.

>  virStoragePoolSaveConfig(const char *configFile,
>                           virStoragePoolDefPtr def)
>  {
> -    char uuidstr[VIR_UUID_STRING_BUFLEN];
>      char *xml;
>      int ret = -1;
>  
> @@ -1927,12 +1941,12 @@ virStoragePoolSaveConfig(const char *configFile,
>          return -1;
>      }
>  
> -    virUUIDFormat(def->uuid, uuidstr);
> -    ret = virXMLSaveFile(configFile,
> -                         virXMLPickShellSafeComment(def->name, uuidstr),
> -                         "pool-edit", xml);
> -    VIR_FREE(xml);
> +    if (virStoragePoolSaveXML(configFile, def, xml))
> +        goto cleanup;
>  
> +    ret = 0;
> + cleanup:
> +    VIR_FREE(xml);
>      return ret;
>  }

ACK if you add at least one new line between virStoragePoolSaveConfig
and virStoragePoolSaveXML

Peter

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]