[libvirt] [PATCH 06/10] conf: Add VM Generation ID parse/format support

John Ferlan jferlan at redhat.com
Thu Apr 12 11:03:04 UTC 2018


[...]

>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 385ba4ce8c..0fa9386270 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -18791,6 +18791,34 @@ virDomainDefParseXML(xmlDocPtr xml,
>>          VIR_FREE(tmp);
>>      }
>>
>> +    /* Extract domain genid - a genid can either be provided or generated */
>> +    if ((n = virXPathNodeSet("./genid", ctxt, &nodes)) < 0)
>> +        goto error;
>> +
>> +    if (n > 0) {
>> +        if (n != 1) {
>> +            virReportError(VIR_ERR_XML_ERROR, "%s",
>> +                          _("element 'genid' can only appear once"));
>> +            goto error;
>> +        }
>> +        def->genidRequested = true;
>> +        if (!(tmp = virXPathString("string(./genid[1])", ctxt))) {
>> +            if (virUUIDGenerate(def->genid) < 0) {
>> +                virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                               "%s", _("Failed to generate genid"));
>> +                goto error;
>> +            }
>> +            def->genidGenerated = true;
>> +        } else {
>> +            if (virUUIDParse(tmp, def->genid) < 0) {
> 
> You haven’t added these struct members to _virDomainDef (genid and
> genidRequested) anywhere.
> 

Patch 4 does that; however, there's been some list send/receive issues
over the last 24 hours, so if that hasn't shown up in your inbox maybe
it will today at some point...

I split things up that way to reduce the amount of lines to review in
one patch - in reality patches 4-6 could be one patch...

John

>> +                virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                               "%s", _("malformed genid element"));
>> +                goto error;
>> +            }
>> +        }
>> +    }
> 
> […snip]
> 




More information about the libvir-list mailing list