Просмотр исходного кода

Add `Stats` to the `Destination`

This patch modifies the `Destination` struct so that the stats for
that destination are also reported.

Signed-off-by: Akshay <akshay.moghe@gmail.com>
Akshay 6 лет назад
Родитель
Сommit
e427c4ee2e
2 измененных файлов с 7 добавлено и 0 удалено
  1. 1 0
      libnetwork/ipvs/ipvs.go
  2. 6 0
      libnetwork/ipvs/netlink.go

+ 1 - 0
libnetwork/ipvs/ipvs.go

@@ -62,6 +62,7 @@ type Destination struct {
 	LowerThreshold      uint32
 	ActiveConnections   int
 	InactiveConnections int
+	Stats               SvcStats
 }
 
 // Handle provides a namespace specific ipvs handle to program ipvs

+ 6 - 0
libnetwork/ipvs/netlink.go

@@ -443,6 +443,12 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
 			d.ActiveConnections = int(native.Uint16(attr.Value))
 		case ipvsDestAttrInactiveConnections:
 			d.InactiveConnections = int(native.Uint16(attr.Value))
+		case ipvsSvcAttrStats:
+			stats, err := assembleStats(attr.Value)
+			if err != nil {
+				return nil, err
+			}
+			d.Stats = stats
 		}
 	}
 	return &d, nil