util: add EncryptionKMS.Destroy()

Add a new method to the EncryptionKMS interface so that resources can be
freed when EncryptionKMS instances get freed.

With the move to using the libopenstorage API, a temporary file needs to
store the optional CA certificate. The Destroy() method of the
vaultConnection type now removes this file.

The rbdVolume uses the EncryptionKMS type now, so call the new Destroy()
method from withing rbdVolume.Destroy().

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2020-12-03 09:25:52 +01:00
committed by mergify[bot]
parent eb1ef69cfb
commit 8f91c672d4
3 changed files with 21 additions and 1 deletions

View File

@ -169,6 +169,9 @@ func (rv *rbdVolume) Destroy() {
if rv.conn != nil {
rv.conn.Destroy()
}
if rv.KMS != nil {
rv.KMS.Destroy()
}
}
// String returns the image-spec (pool/{namespace/}image) format of the image.