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

Re: [libvirt] [PATCH v3 2/4] conf: Parse virtio-crypto in the domain XML



Hi Marc,

On 2017/7/6 21:19, Marc Hartmayer wrote:

> On Wed, Jul 05, 2017 at 01:17 PM +0200, "Longpeng(Mike)" <longpeng2 huawei com> wrote:
>> This patch parse the domain XML with virtio-crypto
>> support, the virtio-crypto XML looks like this:
>>
[...]


>> +        queues = virXMLPropString(backends[0], "queues");
>> +        if (queues && virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) {
>> +            virReportError(VIR_ERR_XML_ERROR,
>> +                            _("Malformed 'queues' value '%s'"), queues);
>                               ^^
>                               Indentation

OK. :)

> 
>> +        break;
>> +
>> +    case VIR_DOMAIN_CRYPTO_BACKEND_LAST:
>> +        break;
>> +    }
>> +
>> +    if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
>> +        goto error;
>> +
>> + cleanup:
>> +    VIR_FREE(model);
>> +    VIR_FREE(backend);
>> +    VIR_FREE(queues);
>> +    VIR_FREE(backends);
>> +    ctxt->node = save;
>> +    return def;
>> +
>> + error:
>> +    virDomainCryptoDefFree(def);
>> +    def = NULL;
>> +    goto cleanup;
>> +}
>> +
>> +

[...]

>>
>>  static int
>> +virDomainCryptoDefFormat(virBufferPtr buf,
>> +                         virDomainCryptoDefPtr def,
>> +                         unsigned int flags)
>> +{
>> +    const char *model = virDomainCryptoModelTypeToString(def->model);
>> +    const char *backend = virDomainCryptoBackendTypeToString(def->backend);
>> +
>> +    virBufferAsprintf(buf, "<crypto model='%s'>\n", model);
>> +    virBufferAdjustIndent(buf, 2);
>> +    virBufferAsprintf(buf, "<backend type='%s'", backend);
>> +
>> +    switch ((virDomainCryptoBackend) def->backend) {
>> +    case VIR_DOMAIN_CRYPTO_BACKEND_BUILTIN:
>> +        if (def->queues)
>> +            virBufferAsprintf(buf, " queues='%u'", def->queues);
>> +
>> +        virBufferAddLit(buf, "/>\n");
>> +        break;
>> +
>> +    case VIR_DOMAIN_CRYPTO_BACKEND_LAST:
>> +        break;
>> +    }
>> +
>> +    if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
>> +        return -1;
>> +
>> +    virBufferAdjustIndent(buf, -2);
>> +    virBufferAddLit(buf, "</crypto>\n");
>> +    return 0;
>> +}
>> +
>> +void
>> +virDomainCryptoDefFree(virDomainCryptoDefPtr def)
>> +{
>> +    if (!def)
>> +        return;
>> +
>> +    virDomainDeviceInfoClear(&def->info);
>> +    VIR_FREE(def);
>> +}
> 
> You should add 'virDomainCryptoDefFree' to libvirt_private.syms.


Thanks, I'll fix it.

> 
>> +
>> +
>> +static int
>>  virDomainMemorySourceDefFormat(virBufferPtr buf,
>>                                 virDomainMemoryDefPtr def)
>>  {
>> @@ -25418,6 +25621,11 @@ virDomainDefFormatInternal(virDomainDefPtr def,
>>              goto error;
> 
> 
> 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
> 
> 
> .
> 


-- 
Regards,
Longpeng(Mike)


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