From c4c8a28bb86dadc66352e83f582526c6400ffd00 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 22 May 2024 16:59:55 +0530 Subject: [PATCH 1/5] api,server: encryptformat in volume response Fixes #9014 Signed-off-by: Abhishek Kumar --- .../cloudstack/api/response/VolumeResponse.java | 12 ++++++++++-- .../META-INF/db/views/cloud.volume_view.sql | 2 ++ .../com/cloud/api/query/dao/VolumeJoinDaoImpl.java | 1 + .../java/com/cloud/api/query/vo/VolumeJoinVO.java | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java index 0d502a6d7a73..2ddc5fd097e6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java @@ -290,13 +290,17 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String externalUuid; @SerializedName(ApiConstants.VOLUME_CHECK_RESULT) - @Param(description = "details for the volume check result, they may vary for different hypervisors, since = 4.19.1") + @Param(description = "details for the volume check result, they may vary for different hypervisors", since = "4.19.1") private Map volumeCheckResult; @SerializedName(ApiConstants.VOLUME_REPAIR_RESULT) - @Param(description = "details for the volume repair result, they may vary for different hypervisors, since = 4.19.1") + @Param(description = "details for the volume repair result, they may vary for different hypervisors", since = "4.19.1") private Map volumeRepairResult; + @SerializedName(ApiConstants.ENCRYPT_FORMAT) + @Param(description = "the encrypt format of the volume", since = "4.19.1") + private String encryptFormat; + public String getPath() { return path; } @@ -842,4 +846,8 @@ public Map getVolumeRepairResult() { public void setVolumeRepairResult(Map volumeRepairResult) { this.volumeRepairResult = volumeRepairResult; } + + public void setEncryptFormat(String encryptFormat) { + this.encryptFormat = encryptFormat; + } } diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql index fd21fff14944..830b35bfdaf0 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql @@ -39,6 +39,8 @@ SELECT `volumes`.`path` AS `path`, `volumes`.`chain_info` AS `chain_info`, `volumes`.`external_uuid` AS `external_uuid`, + `volumes`.`passphrase_id` AS `passphrase_id` + `volumes`.`encrypt_format` AS `encrypt_format` `account`.`id` AS `account_id`, `account`.`uuid` AS `account_uuid`, `account`.`account_name` AS `account_name`, diff --git a/server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java index 8fcad6ed45ab..c4e4ba223d81 100644 --- a/server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/VolumeJoinDaoImpl.java @@ -180,6 +180,7 @@ public VolumeResponse newVolumeResponse(ResponseView view, VolumeJoinVO volume) if (view == ResponseView.Full) { volResponse.setPath(volume.getPath()); + volResponse.setEncryptFormat(volume.getEncryptFormat()); } // populate owner. diff --git a/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java index a8d568ff245d..cd62500701f0 100644 --- a/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java @@ -275,6 +275,12 @@ public class VolumeJoinVO extends BaseViewWithTagInformationVO implements Contro @Column(name = "external_uuid") private String externalUuid = null; + @Column(name = "passphrase_id") + private Long passphraseId; + + @Column(name = "encrypt_format") + private String encryptFormat; + public VolumeJoinVO() { } @@ -610,6 +616,14 @@ public void setExternalUuid(String externalUuid) { this.externalUuid = externalUuid; } + public Long getPassphraseId() { + return passphraseId; + } + + public String getEncryptFormat() { + return encryptFormat; + } + @Override public Class getEntityType() { return Volume.class; From c0b95b3bf247c9c6cc537faa1a6e031af4500f72 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 22 May 2024 17:17:01 +0530 Subject: [PATCH 2/5] fix Signed-off-by: Abhishek Kumar --- .../src/main/resources/META-INF/db/views/cloud.volume_view.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql index 830b35bfdaf0..4f66ebec04b9 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql @@ -40,7 +40,7 @@ SELECT `volumes`.`chain_info` AS `chain_info`, `volumes`.`external_uuid` AS `external_uuid`, `volumes`.`passphrase_id` AS `passphrase_id` - `volumes`.`encrypt_format` AS `encrypt_format` + `volumes`.`encrypt_format` AS `encrypt_format`, `account`.`id` AS `account_id`, `account`.`uuid` AS `account_uuid`, `account`.`account_name` AS `account_name`, From c6f1d4d3748b6434f46f290b15fdd7bf78cad652 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 22 May 2024 17:17:35 +0530 Subject: [PATCH 3/5] fix --- .../src/main/resources/META-INF/db/views/cloud.volume_view.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql index 4f66ebec04b9..e863ccc058f3 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql @@ -39,7 +39,7 @@ SELECT `volumes`.`path` AS `path`, `volumes`.`chain_info` AS `chain_info`, `volumes`.`external_uuid` AS `external_uuid`, - `volumes`.`passphrase_id` AS `passphrase_id` + `volumes`.`passphrase_id` AS `passphrase_id`, `volumes`.`encrypt_format` AS `encrypt_format`, `account`.`id` AS `account_id`, `account`.`uuid` AS `account_uuid`, From f9cf92c5ea1ef86afb4524d0ee9f2c62470ecaaf Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 May 2024 01:35:44 +0530 Subject: [PATCH 4/5] Apply suggestions from code review --- .../src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java index cd62500701f0..a8fcbfe824e0 100644 --- a/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/main/java/com/cloud/api/query/vo/VolumeJoinVO.java @@ -275,9 +275,6 @@ public class VolumeJoinVO extends BaseViewWithTagInformationVO implements Contro @Column(name = "external_uuid") private String externalUuid = null; - @Column(name = "passphrase_id") - private Long passphraseId; - @Column(name = "encrypt_format") private String encryptFormat; @@ -616,10 +613,6 @@ public void setExternalUuid(String externalUuid) { this.externalUuid = externalUuid; } - public Long getPassphraseId() { - return passphraseId; - } - public String getEncryptFormat() { return encryptFormat; } From 96d8e6b96c4f0241bc7516113594860f4faa0f03 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 11 Jun 2024 11:02:50 +0530 Subject: [PATCH 5/5] remove passphrase db change --- .../src/main/resources/META-INF/db/views/cloud.volume_view.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql index e863ccc058f3..950dcddf4c71 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql @@ -39,7 +39,6 @@ SELECT `volumes`.`path` AS `path`, `volumes`.`chain_info` AS `chain_info`, `volumes`.`external_uuid` AS `external_uuid`, - `volumes`.`passphrase_id` AS `passphrase_id`, `volumes`.`encrypt_format` AS `encrypt_format`, `account`.`id` AS `account_id`, `account`.`uuid` AS `account_uuid`,