mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: tpm: Introduce qemuTPMHasSharedStorage()
New qemuTPMHasSharedStorage() function is introduced which returns whether the swtpm state directory is on a shared filesystem (e.g. NFS). Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1537c73da2
commit
384138d790
@ -38,6 +38,7 @@
|
||||
#include "qemu_security.h"
|
||||
#include "qemu_slirp.h"
|
||||
#include "qemu_block.h"
|
||||
#include "qemu_tpm.h"
|
||||
|
||||
#include "domain_audit.h"
|
||||
#include "virlog.h"
|
||||
|
@ -954,6 +954,26 @@ qemuTPMEmulatorStart(virQEMUDriver *driver,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuTPMHasSharedStorage(virDomainDef *def)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->ntpms; i++) {
|
||||
virDomainTPMDef *tpm = def->tpms[i];
|
||||
|
||||
switch (tpm->type) {
|
||||
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
|
||||
return virFileIsSharedFS(tpm->data.emulator.storagepath) == 1;
|
||||
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
||||
case VIR_DOMAIN_TPM_TYPE_LAST:
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------
|
||||
* Module entry points
|
||||
* ---------------------
|
||||
|
@ -56,3 +56,7 @@ int qemuExtTPMSetupCgroup(virQEMUDriver *driver,
|
||||
virCgroup *cgroup)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
bool qemuTPMHasSharedStorage(virDomainDef *def)
|
||||
ATTRIBUTE_NONNULL(1)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user