Re: [PATCH 01/18] secret: Add support for usage type vTPM

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

 



Hi

On Tue, Jul 9, 2019 at 9:24 PM Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx> wrote:
>
> Add support for usage type vTPM to secret.
>
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
> ---
>  include/libvirt/libvirt-secret.h |  1 +
>  src/conf/secret_conf.c           | 13 +++++++++++++
>  src/util/virsecret.c             |  2 +-
>  3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/include/libvirt/libvirt-secret.h b/include/libvirt/libvirt-secret.h
> index 9a1065f0f3..e5aaac9450 100644
> --- a/include/libvirt/libvirt-secret.h
> +++ b/include/libvirt/libvirt-secret.h
> @@ -43,6 +43,7 @@ typedef enum {
>      VIR_SECRET_USAGE_TYPE_CEPH = 2,
>      VIR_SECRET_USAGE_TYPE_ISCSI = 3,
>      VIR_SECRET_USAGE_TYPE_TLS = 4,
> +    VIR_SECRET_USAGE_TYPE_VTPM = 5,
>
>  # ifdef VIR_ENUM_SENTINELS
>      VIR_SECRET_USAGE_TYPE_LAST
> diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
> index 5b85a7c0be..b291339e77 100644
> --- a/src/conf/secret_conf.c
> +++ b/src/conf/secret_conf.c
> @@ -110,6 +110,15 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
>          }
>          break;
>
> +    case VIR_SECRET_USAGE_TYPE_VTPM:
> +        def->usage_id = virXPathString("string(./usage/name)", ctxt);
> +        if (!def->usage_id) {
> +            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                           _("vTPM usage specified, but name is missing"));
> +            return -1;
> +        }
> +        break;
> +
>      default:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("unexpected secret usage type %d"),
> @@ -257,6 +266,10 @@ virSecretDefFormatUsage(virBufferPtr buf,
>          virBufferEscapeString(buf, "<name>%s</name>\n", def->usage_id);
>          break;
>
> +    case VIR_SECRET_USAGE_TYPE_VTPM:
> +        virBufferEscapeString(buf, "<name>%s</name>\n", def->usage_id);
> +        break;
> +
>      default:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("unexpected secret usage type %d"),
> diff --git a/src/util/virsecret.c b/src/util/virsecret.c
> index 854dc72b06..7844a76a56 100644
> --- a/src/util/virsecret.c
> +++ b/src/util/virsecret.c
> @@ -34,7 +34,7 @@ VIR_LOG_INIT("util.secret");
>
>  VIR_ENUM_IMPL(virSecretUsage,
>                VIR_SECRET_USAGE_TYPE_LAST,
> -              "none", "volume", "ceph", "iscsi", "tls",
> +              "none", "volume", "ceph", "iscsi", "tls", "vtpm",
>  );
>
>  void
> --
> 2.20.1
>

Looks good, but docs/schemas/secret.rng change should probably be part
of this patch.

other than that,
Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux