mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): The eip displays the internal ip address of the virtual machine (#23067)
This commit is contained in:
@@ -94,6 +94,9 @@ type ElasticipDetails struct {
|
||||
|
||||
// 绑定资源名称
|
||||
AssociateName string `json:"associate_name"`
|
||||
|
||||
// 虚拟机内网IP
|
||||
ServerPrivateIp string `json:"server_private_ip"`
|
||||
}
|
||||
|
||||
func (self ElasticipDetails) GetMetricTags() map[string]string {
|
||||
|
||||
@@ -1500,12 +1500,24 @@ func (manager *SElasticipManager) FetchCustomizeColumns(
|
||||
log.Errorf("FetchIdNameMap2 group")
|
||||
return rows
|
||||
}
|
||||
gns := []SGuestnetwork{}
|
||||
err = GuestnetworkManager.Query().In("guest_id", guestIds).All(&gns)
|
||||
if err != nil {
|
||||
log.Errorf("FetchModelObjects GuestnetworkManager")
|
||||
return rows
|
||||
}
|
||||
gnMap := map[string]string{}
|
||||
for i := range gns {
|
||||
gnMap[gns[i].GuestId] = gns[i].IpAddr
|
||||
}
|
||||
|
||||
for i := range rows {
|
||||
eip := objs[i].(*SElasticip)
|
||||
if len(eip.AssociateId) > 0 {
|
||||
switch eip.AssociateType {
|
||||
case api.EIP_ASSOCIATE_TYPE_SERVER:
|
||||
rows[i].AssociateName, _ = guests[eip.AssociateId]
|
||||
rows[i].ServerPrivateIp = gnMap[eip.AssociateId]
|
||||
case api.EIP_ASSOCIATE_TYPE_LOADBALANCER:
|
||||
rows[i].AssociateName, _ = lbs[eip.AssociateId]
|
||||
case api.EIP_ASSOCIATE_TYPE_NAT_GATEWAY:
|
||||
|
||||
Reference in New Issue
Block a user