mirror of https://github.com/apache/cloudstack.git
Return vm information in listPublicIpAddress api response for the static nat ips
This commit is contained in:
parent
0366aa9543
commit
46e1f6279a
|
|
@ -59,6 +59,15 @@ public class IPAddressResponse extends BaseResponse {
|
|||
@SerializedName("isstaticnat") @Param(description="true if this ip is for static nat, false otherwise")
|
||||
private Boolean staticNat;
|
||||
|
||||
@SerializedName("virtualmachineid") @Param(description="virutal machine id the ip address is assigned to (not null only for static nat Ip)")
|
||||
private Long virtualMachineId;
|
||||
|
||||
@SerializedName("virtualmachinename") @Param(description="virutal machine name the ip address is assigned to (not null only for static nat Ip)")
|
||||
private String virtualMachineName;
|
||||
|
||||
@SerializedName("virtualmachinedisplayname") @Param(description="virutal machine display name the ip address is assigned to (not null only for static nat Ip)")
|
||||
private String virtualMachineDisplayName;
|
||||
|
||||
@SerializedName("associatednetworkid") @Param(description="the ID of the Network associated with the IP address")
|
||||
private Long associatedNetworkId;
|
||||
|
||||
|
|
@ -176,4 +185,28 @@ public class IPAddressResponse extends BaseResponse {
|
|||
public void setNetworkId(Long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineId(Long virtualMachineId) {
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
}
|
||||
|
||||
public String getVirtualMachineName() {
|
||||
return virtualMachineName;
|
||||
}
|
||||
|
||||
public void setVirtualMachineName(String virtualMachineName) {
|
||||
this.virtualMachineName = virtualMachineName;
|
||||
}
|
||||
|
||||
public String getVirtualMachineDisplayName() {
|
||||
return virtualMachineDisplayName;
|
||||
}
|
||||
|
||||
public void setVirtualMachineDisplayName(String virtualMachineDisplayName) {
|
||||
this.virtualMachineDisplayName = virtualMachineDisplayName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ import com.cloud.configuration.ResourceCount.ResourceType;
|
|||
import com.cloud.configuration.ResourceLimit;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.domain.Domain;
|
||||
|
|
@ -631,6 +631,13 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
|
||||
ipResponse.setForVirtualNetwork(forVirtualNetworks);
|
||||
ipResponse.setStaticNat(ipAddress.isOneToOneNat());
|
||||
|
||||
if (ipAddress.getVmId() != null) {
|
||||
UserVm vm = ApiDBUtils.findUserVmById(ipAddress.getVmId());
|
||||
ipResponse.setVirtualMachineId(vm.getId());
|
||||
ipResponse.setVirtualMachineName(vm.getName());
|
||||
ipResponse.setVirtualMachineDisplayName(vm.getDisplayName());
|
||||
}
|
||||
|
||||
ipResponse.setAssociatedNetworkId(ipAddress.getAssociatedWithNetworkId());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue