bug 10489: adding object name to response so that the front end displays it properly

This commit is contained in:
Abhinandan Prateek 2011-06-30 13:14:56 +05:30
parent 8bdbfc78ea
commit 978d811333
2 changed files with 23 additions and 19 deletions

View File

@ -1066,6 +1066,7 @@ public class ApiResponseHelper implements ResponseGenerator {
Double networkKbWrite = Double.valueOf(vmStats.getNetworkWriteKBs()); Double networkKbWrite = Double.valueOf(vmStats.getNetworkWriteKBs());
userVmResponse.setNetworkKbsWrite(networkKbWrite.longValue()); userVmResponse.setNetworkKbsWrite(networkKbWrite.longValue());
} }
userVmResponse.setObjectName(objectName);
vmResponses.add(userVmResponse); vmResponses.add(userVmResponse);
} }
return vmResponses; return vmResponses;

View File

@ -423,26 +423,29 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
//nics.id, nics.ip4_address, nics.gateway, nics.network_id, nics.netmask, nics. mac_address, nics.broadcast_uri, nics.isolation_uri, " + //nics.id, nics.ip4_address, nics.gateway, nics.network_id, nics.netmask, nics. mac_address, nics.broadcast_uri, nics.isolation_uri, " +
//"networks.traffic_type, networks.guest_type, networks.is_default from vm_instance, " //"networks.traffic_type, networks.guest_type, networks.is_default from vm_instance, "
NicResponse nicResponse = new NicResponse(); long nic_id = rs.getLong("nics.id");
nicResponse.setId(rs.getLong("nics.id")); if (nic_id > 0){
nicResponse.setIpaddress(rs.getString("nics.ip4_address")); NicResponse nicResponse = new NicResponse();
nicResponse.setGateway(rs.getString("nics.gateway")); nicResponse.setId(nic_id);
nicResponse.setNetmask(rs.getString("nics.netmask")); nicResponse.setIpaddress(rs.getString("nics.ip4_address"));
nicResponse.setNetworkid(rs.getLong("nics.network_id")); nicResponse.setGateway(rs.getString("nics.gateway"));
nicResponse.setMacAddress(rs.getString("nics.mac_address")); nicResponse.setNetmask(rs.getString("nics.netmask"));
nicResponse.setNetworkid(rs.getLong("nics.network_id"));
int account_type = rs.getInt("account.type"); nicResponse.setMacAddress(rs.getString("nics.mac_address"));
if (account_type == Account.ACCOUNT_TYPE_ADMIN) {
nicResponse.setBroadcastUri(rs.getString("nics.broadcast_uri")); int account_type = rs.getInt("account.type");
nicResponse.setIsolationUri(rs.getString("nics.isolation_uri")); if (account_type == Account.ACCOUNT_TYPE_ADMIN) {
nicResponse.setBroadcastUri(rs.getString("nics.broadcast_uri"));
nicResponse.setIsolationUri(rs.getString("nics.isolation_uri"));
}
nicResponse.setTrafficType(rs.getString("networks.traffic_type"));
nicResponse.setType(rs.getString("networks.guest_type"));
nicResponse.setIsDefault(rs.getBoolean("networks.is_default"));
nicResponse.setObjectName("nic");
nicResponses.add(nicResponse);
} }
nicResponse.setTrafficType(rs.getString("networks.traffic_type"));
nicResponse.setType(rs.getString("networks.guest_type"));
nicResponse.setIsDefault(rs.getBoolean("networks.is_default"));
nicResponse.setObjectName("nic");
nicResponses.add(nicResponse);
} }
userVmResponse.setSecurityGroupList(new ArrayList(securityGroupResponse)); userVmResponse.setSecurityGroupList(new ArrayList(securityGroupResponse));