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

Marc Hartmayer mhartmay at linux.vnet.ibm.com
Thu Apr 12 11:15:57 UTC 2018


On Thu, Apr 12, 2018 at 01:03 PM +0200, John Ferlan <jferlan at redhat.com> wrote:
> [...]
>
>>> 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...

Yay :D

>
> 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]
>>
>
--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294





More information about the libvir-list mailing list