mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
api: add zone, vm name params in listVmSnapshot response (#4604)
* api: add zone, vm name params in listVmSnaphots response Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
06b5bd2966
commit
f489439a3a
@ -21,11 +21,11 @@ import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponseWithTagInformation;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@ -57,9 +57,17 @@ public class VMSnapshotResponse extends BaseResponseWithTagInformation implement
|
||||
@Param(description = "the Zone ID of the vm snapshot")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME)
|
||||
@Param(description = "the Zone name of the vm snapshot", since = "4.15.1")
|
||||
private String zoneName;
|
||||
|
||||
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID)
|
||||
@Param(description = "the vm ID of the vm snapshot")
|
||||
private String virtualMachineid;
|
||||
private String virtualMachineId;
|
||||
|
||||
@SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME)
|
||||
@Param(description = "the vm name of the vm snapshot", since = "4.15.1")
|
||||
private String virtualMachineName;
|
||||
|
||||
@SerializedName("parent")
|
||||
@Param(description = "the parent ID of the vm snapshot")
|
||||
@ -154,12 +162,28 @@ public class VMSnapshotResponse extends BaseResponseWithTagInformation implement
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getVirtualMachineid() {
|
||||
return virtualMachineid;
|
||||
public String getZoneName() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public void setVirtualMachineid(String virtualMachineid) {
|
||||
this.virtualMachineid = virtualMachineid;
|
||||
public void setZoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
public String getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineId(String virtualMachineId) {
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
}
|
||||
|
||||
public String getVirtualMachineName() {
|
||||
return virtualMachineName;
|
||||
}
|
||||
|
||||
public void setVirtualMachineName(String virtualMachineName) {
|
||||
this.virtualMachineName = virtualMachineName;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
// under the License.
|
||||
package com.cloud.api;
|
||||
|
||||
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@ -349,8 +351,7 @@ import com.cloud.vm.dao.NicSecondaryIpVO;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
import com.cloud.vm.snapshot.VMSnapshotVO;
|
||||
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
|
||||
|
||||
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class ApiResponseHelper implements ResponseGenerator {
|
||||
|
||||
@ -621,11 +622,13 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
vmSnapshotResponse.setDisplayName(vmSnapshot.getDisplayName());
|
||||
UserVm vm = ApiDBUtils.findUserVmById(vmSnapshot.getVmId());
|
||||
if (vm != null) {
|
||||
vmSnapshotResponse.setVirtualMachineid(vm.getUuid());
|
||||
vmSnapshotResponse.setVirtualMachineId(vm.getUuid());
|
||||
vmSnapshotResponse.setVirtualMachineName(Strings.isNullOrEmpty(vm.getDisplayName()) ? vm.getHostName() : vm.getDisplayName());
|
||||
vmSnapshotResponse.setHypervisor(vm.getHypervisorType());
|
||||
DataCenterVO datacenter = ApiDBUtils.findZoneById(vm.getDataCenterId());
|
||||
if (datacenter != null) {
|
||||
vmSnapshotResponse.setZoneId(datacenter.getUuid());
|
||||
vmSnapshotResponse.setZoneName(datacenter.getName());
|
||||
}
|
||||
}
|
||||
if (vmSnapshot.getParent() != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user