On 8/28/24 11:26 AM, Daniel P. Berrangé wrote:
On Wed, Aug 28, 2024 at 11:02:28AM +0400, marcandre.lureau(a)redhat.com
wrote:
> From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
>
> Learn to parse a file path for the TPM state.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
When we have two different backend options - in this case
'dir' and
'file', then we would normally have an "type" attribute on the parent
element, that dictates what child elements are permitted.
Picking a chunk from earlier in the patch:
> +typedef enum {
> + VIR_DOMAIN_TPM_STORAGE_DEFAULT,
> + VIR_DOMAIN_TPM_STORAGE_FILE,
> +} virDomainTPMStorage;
I would have expected to see
typedef enum {
VIR_DOMAIN_TPM_STORAGE_DIR,
VIR_DOMAIN_TPM_STORAGE_FILE,
} virDomainTPMStorage;
and have this enum be exposed as the 'type' attribute on <backend>.
Also, if we're going to expose the raw file path as a user configurable
optin for "file" type, then IMHO, we should also expose the dir path
for our existing backend. It doesn't make sense to allow one to be
configured, but not both.
I am not sure whether it is good to give users control over directories
or file paths. Do we want to allow them to get access to the state of a
a TPM of another VM?
>
> With regards,
> Daniel