[libvirt] [PATCH 7/9] domain_conf: Read and Write quorum config

Michal Privoznik mprivozn at redhat.com
Tue Jan 13 14:46:08 UTC 2015


On 08.12.2014 19:31, Matthias Gatto wrote:
> Add the capabiltty to libvirt to parse and format the quorum syntax
> as described here:
> http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
>
> Signed-off-by: Matthias Gatto <matthias.gatto at outscale.com>
> ---
>   src/conf/domain_conf.c | 165 +++++++++++++++++++++++++++++++++++--------------
>   1 file changed, 120 insertions(+), 45 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 1add21f..9164cf3 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5469,20 +5469,58 @@ virDomainDiskSourceParse(xmlNodePtr node,
>   }
>
>
> +static bool
> +virDomainDiskThresholdParse(virStorageSourcePtr src,
> +                            xmlNodePtr node)
> +{
> +    char *threshold = virXMLPropString(node, "threshold");

Yet again, new attribute, documentation and schema adjustment required.

> +    int ret;
> +
> +    if (!threshold) {
> +        virReportError(VIR_ERR_XML_ERROR,
> +                       "%s", _("missing threshold in quorum"));
> +        return false;
> +    }
> +    ret = virStrToLong_ul(threshold, NULL, 10, &src->threshold);
> +    if (ret < 0 || src->threshold < 2) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("unexpected threshold %s"),
> +                       "threshold must be a decimal number superior to 2 "
> +                         "and inferior to the number of children");
> +        VIR_FREE(threshold);
> +        return false;
> +    }
> +    VIR_FREE(threshold);
> +    return true;
> +}


Michal




More information about the libvir-list mailing list