forked from rook/rook
We can now encrypted OSD device that were provisioned via a storage class using the PV interface. The encryption works at the storageClassDeviceSets level, which means we can have encrypted and non-encrypted sets. Using the new key `encrypted` we can turn it on. Signed-off-by: Sébastien Han <seb@redhat.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
/*
|
|
Copyright 2020 The Rook Authors. All rights reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package osd
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
"github.com/rook/rook/pkg/clusterd"
|
|
)
|
|
|
|
const (
|
|
cryptsetupBinary = "cryptsetup"
|
|
)
|
|
|
|
func closeEncryptedDevice(context *clusterd.Context, dmName string) error {
|
|
args := []string{"--verbose", "luksClose", dmName}
|
|
cryptsetupOut, err := context.Executor.ExecuteCommandWithCombinedOutput(cryptsetupBinary, args...)
|
|
if err != nil {
|
|
return errors.Wrapf(err, "failed to close encrypted device. %s", cryptsetupOut)
|
|
}
|
|
|
|
logger.Info(cryptsetupOut)
|
|
return nil
|
|
}
|