mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: use ListChildrenAttributes() instead of ListChildren()
This commit modifies listSnapAndChildren() to make use of ListChildrenAttributes() instead of ListChildren() which allows us to filter out images in trash. This commit also order the alive images so that temp clone images are followed by images backing volume snapshots so that temp clone images are flattened first. Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
38
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
38
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
@ -61,30 +61,44 @@ type EncryptionOptions interface {
|
||||
}
|
||||
|
||||
func (opts EncryptionOptionsLUKS1) allocateEncryptionOptions() cEncryptionData {
|
||||
var cOpts C.rbd_encryption_luks1_format_options_t
|
||||
var retData cEncryptionData
|
||||
cOpts.alg = C.rbd_encryption_algorithm_t(opts.Alg)
|
||||
|
||||
// CBytes allocates memory. it will be freed when cEncryptionData.free is called
|
||||
cOpts.passphrase = (*C.char)(C.CBytes(opts.Passphrase))
|
||||
cPassphrase := (*C.char)(C.CBytes(opts.Passphrase))
|
||||
cOptsSize := C.size_t(C.sizeof_rbd_encryption_luks1_format_options_t)
|
||||
cOpts := (*C.rbd_encryption_luks1_format_options_t)(C.malloc(cOptsSize))
|
||||
cOpts.alg = C.rbd_encryption_algorithm_t(opts.Alg)
|
||||
cOpts.passphrase = cPassphrase
|
||||
cOpts.passphrase_size = C.size_t(len(opts.Passphrase))
|
||||
retData.opts = C.rbd_encryption_options_t(&cOpts)
|
||||
retData.optsSize = C.size_t(C.sizeof_rbd_encryption_luks1_format_options_t)
|
||||
retData.free = func() { C.free(unsafe.Pointer(cOpts.passphrase)) }
|
||||
|
||||
retData.format = C.RBD_ENCRYPTION_FORMAT_LUKS1
|
||||
retData.opts = C.rbd_encryption_options_t(cOpts)
|
||||
retData.optsSize = cOptsSize
|
||||
retData.free = func() {
|
||||
C.free(unsafe.Pointer(cOpts.passphrase))
|
||||
C.free(unsafe.Pointer(cOpts))
|
||||
}
|
||||
return retData
|
||||
}
|
||||
|
||||
func (opts EncryptionOptionsLUKS2) allocateEncryptionOptions() cEncryptionData {
|
||||
var cOpts C.rbd_encryption_luks2_format_options_t
|
||||
var retData cEncryptionData
|
||||
cOpts.alg = C.rbd_encryption_algorithm_t(opts.Alg)
|
||||
|
||||
// CBytes allocates memory. it will be freed when cEncryptionData.free is called
|
||||
cOpts.passphrase = (*C.char)(C.CBytes(opts.Passphrase))
|
||||
cPassphrase := (*C.char)(C.CBytes(opts.Passphrase))
|
||||
cOptsSize := C.size_t(C.sizeof_rbd_encryption_luks2_format_options_t)
|
||||
cOpts := (*C.rbd_encryption_luks2_format_options_t)(C.malloc(cOptsSize))
|
||||
cOpts.alg = C.rbd_encryption_algorithm_t(opts.Alg)
|
||||
cOpts.passphrase = cPassphrase
|
||||
cOpts.passphrase_size = C.size_t(len(opts.Passphrase))
|
||||
retData.opts = C.rbd_encryption_options_t(&cOpts)
|
||||
retData.optsSize = C.size_t(C.sizeof_rbd_encryption_luks2_format_options_t)
|
||||
retData.free = func() { C.free(unsafe.Pointer(cOpts.passphrase)) }
|
||||
|
||||
retData.format = C.RBD_ENCRYPTION_FORMAT_LUKS2
|
||||
retData.opts = C.rbd_encryption_options_t(cOpts)
|
||||
retData.optsSize = cOptsSize
|
||||
retData.free = func() {
|
||||
C.free(unsafe.Pointer(cOpts.passphrase))
|
||||
C.free(unsafe.Pointer(cOpts))
|
||||
}
|
||||
return retData
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user