The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6487

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 3c5f3b9f248258a5998ba7cf3e7d7ec745ec042f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 21 Nov 2019 09:17:31 -0500
Subject: [PATCH] lxd/vm: Reverse interface counters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/vm_qemu.go | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/lxd/vm_qemu.go b/lxd/vm_qemu.go
index 19781a3d2f..e4d2524525 100644
--- a/lxd/vm_qemu.go
+++ b/lxd/vm_qemu.go
@@ -2413,14 +2413,21 @@ func (vm *vmQemu) RenderState() (*api.InstanceState, 
error) {
                                        m["host_name"] = 
vm.localConfig[fmt.Sprintf("volatile.%s.host_name", k)]
                                }
 
+                               hostCounters := 
shared.NetworkGetCounters(m["host_name"])
+
                                networks[k] = api.InstanceStateNetwork{
                                        Addresses: addresses,
-                                       Counters:  
api.InstanceStateNetworkCounters(shared.NetworkGetCounters(m["host_name"])),
-                                       Hwaddr:    m["hwaddr"],
-                                       HostName:  m["host_name"],
-                                       Mtu:       iface.MTU,
-                                       State:     "up",
-                                       Type:      "broadcast",
+                                       Counters: 
api.InstanceStateNetworkCounters{
+                                               BytesReceived:   
hostCounters.BytesSent,
+                                               BytesSent:       
hostCounters.BytesReceived,
+                                               PacketsReceived: 
hostCounters.PacketsSent,
+                                               PacketsSent:     
hostCounters.PacketsReceived,
+                                       },
+                                       Hwaddr:   m["hwaddr"],
+                                       HostName: m["host_name"],
+                                       Mtu:      iface.MTU,
+                                       State:    "up",
+                                       Type:     "broadcast",
                                }
                        }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to