sureshanaparti commented on code in PR #12711:
URL: https://github.com/apache/cloudstack/pull/12711#discussion_r3026645414
##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:
##########
@@ -1898,10 +1927,65 @@ private Pair<VolumeVO, DataStore>
recreateVolume(VolumeVO vol, VirtualMachinePro
return new Pair<>(newVol, destPool);
}
+ /**
+ * Helper method to retrieve KMS key from volume's kmsKeyId
+ */
+ private KMSKeyVO getKmsKeyFromVolume(VolumeVO volume) {
+ if (volume.getKmsKeyId() == null) {
+ return null;
+ }
+ return kmsKeyDao.findById(volume.getKmsKeyId());
+ }
+
private VolumeVO setPassphraseForVolumeEncryption(VolumeVO volume) {
- if (volume.getPassphraseId() != null) {
+ return setPassphraseForVolumeEncryption(volume, null, null);
+ }
+
+ private VolumeVO setPassphraseForVolumeEncryption(VolumeVO volume,
KMSKeyVO kmsKey, Long callerAccountId) {
+ // If volume already has encryption set up, return it
+ if (volume.getKmsWrappedKeyId() != null || volume.getPassphraseId() !=
null) {
return volume;
}
+
+ if (kmsKey != null) {
Review Comment:
refactor the kms key to a method
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]