You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sh...@apache.org on 2023/12/09 06:13:57 UTC
(cloudstack) branch 4.18 updated: server: fix diskoffering details in vm response (#8135)
This is an automated email from the ASF dual-hosted git repository.
shwstppr pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new a11fc43788e server: fix diskoffering details in vm response (#8135)
a11fc43788e is described below
commit a11fc43788e873f09031d0b03cdbf6477d8305da
Author: Abhishek Kumar <ab...@gmail.com>
AuthorDate: Sat Dec 9 11:43:52 2023 +0530
server: fix diskoffering details in vm response (#8135)
Fixes #8120
---
.../java/org/apache/cloudstack/api/response/UserVmResponse.java | 4 ++--
.../src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java
index 114403da7bc..4c67d24ae83 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java
@@ -159,11 +159,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
private String serviceOfferingName;
@SerializedName(ApiConstants.DISK_OFFERING_ID)
- @Param(description = "the ID of the disk offering of the virtual machine", since = "4.4")
+ @Param(description = "the ID of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
private String diskOfferingId;
@SerializedName("diskofferingname")
- @Param(description = "the name of the disk offering of the virtual machine", since = "4.4")
+ @Param(description = "the name of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
private String diskOfferingName;
@SerializedName(ApiConstants.BACKUP_OFFERING_ID)
diff --git a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
index 49489c2bfeb..7f376b16f02 100644
--- a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
+import com.cloud.storage.Volume;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.annotation.AnnotationService;
import org.apache.cloudstack.annotation.dao.AnnotationDao;
@@ -42,6 +43,7 @@ import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.query.QueryService;
import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -550,6 +552,11 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
userVmData.addAffinityGroup(resp);
}
+ if (StringUtils.isEmpty(userVmData.getDiskOfferingId()) && !Volume.Type.ROOT.equals(uvo.getVolumeType())) {
+ userVmData.setDiskOfferingId(uvo.getDiskOfferingUuid());
+ userVmData.setDiskOfferingName(uvo.getDiskOfferingName());
+ }
+
return userVmData;
}