[libvirt] [PATCH v4 4/7] storage: Add support to create a luks volume
Peter Krempa
pkrempa at redhat.com
Fri Jul 15 07:17:15 UTC 2016
On Thu, Jul 14, 2016 at 16:55:01 -0400, John Ferlan wrote:
>
>
> [...]
>
> >> +
> >> +void
> >> +virQEMUBuildLuksOpts(virBufferPtr buf,
> >> + virStorageEncryptionInfoDefPtr enc,
> >> + const char *alias)
> >> +{
> >> + virBufferAsprintf(buf, "key-secret=%s,", alias);
> >> +
> >> + /* If there's any cipher, then add that to the command line */
> >
> >> + if (enc->cipher_name) {
> >> + virBufferEscapeString(buf, "cipher-alg=%s-", enc->cipher_name);
> >> + virBufferAsprintf(buf, "%u,", enc->cipher_size);
> >> + if (enc->cipher_mode)
> >> + virBufferEscapeString(buf, "cipher-mode=%s,",
> >> enc->cipher_mode);
> >> + if (enc->cipher_hash)
> >> + virBufferEscapeString(buf, "hash-alg=%s,",
> >> enc->cipher_hash);
> >> + if (enc->ivgen_name)
> >> + virBufferEscapeString(buf, "ivgen-alg=%s,",
> >> enc->ivgen_name);
> >> + if (enc->ivgen_hash)
> >> + virBufferEscapeString(buf, "ivgen-hash-alg=%s,",
> >> enc->ivgen_hash);
> >
> > s/virBufferEscapeString/qemuBufferEscapeComma/
>
> Not sure I understand what this is referencing.... Besides
I'd guess that it doesn't make much sense to escape < to < and > to
> in code that puts stuff on the command line rather to an XML and
that it makes more sense to escape a comma in the strings with two
commas as is usual for qemu command lines.
> qemuBufferEscapeComma is static to qemu_command
Extracting it to src/util/virbuffer.c could help.
More information about the libvir-list
mailing list