[Devel] [PATCH RHEL7 COMMIT] ve: add config options for vzlist and vznetstat modules
Konstantin Khorenko
khorenko at odin.com
Thu Apr 30 09:07:06 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.4.9
------>
commit ec888edb0dcfbfb717a685797a62273a5d3281d9
Author: Kirill Tkhai <ktkhai at odin.com>
Date: Thu Apr 30 20:06:11 2015 +0400
ve: add config options for vzlist and vznetstat modules
Port diff-vz-hookin-generic-3
+ CONFIG_VZ_LIST
+ CONFIG_VE_NETDEV_ACCOUNTING
https://jira.sw.ru/browse/PSBM-19217
Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
config.OpenVZ | 2 ++
include/linux/vznetstat.h | 40 ++++++++++++++++++++++++++++++++++------
kernel/Kconfig.openvz | 17 +++++++++++++++++
kernel/ve/Makefile | 8 +++-----
4 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/config.OpenVZ b/config.OpenVZ
index 250b85d..35f2609 100644
--- a/config.OpenVZ
+++ b/config.OpenVZ
@@ -5269,8 +5269,10 @@ CONFIG_CHECKPOINT_RESTORE=y
#
CONFIG_VE=y
CONFIG_VE_CALLS=m
+CONFIG_VZ_LIST=m
CONFIG_VZ_GENCALLS=y
CONFIG_VE_NETDEV=m
+CONFIG_VE_NETDEV_ACCOUNTING=m
CONFIG_VE_ETHDEV=m
CONFIG_VZ_DEV=m
CONFIG_VE_IPTABLES=y
diff --git a/include/linux/vznetstat.h b/include/linux/vznetstat.h
index 2a6d1ae..b6627cc 100644
--- a/include/linux/vznetstat.h
+++ b/include/linux/vznetstat.h
@@ -47,18 +47,17 @@ static inline int venet_acct_skb_size(struct sk_buff *skb)
return skb->data_len + (skb->tail - skb->network_header);
}
+struct ve_addr_struct;
+
+#if IS_ENABLED(CONFIG_VE_NETDEV_ACCOUNTING)
+struct venet_stat *venet_acct_find_stat(envid_t veid);
+struct venet_stat *venet_acct_find_create_stat(envid_t veid);
static inline void venet_acct_get_stat(struct venet_stat *stat)
{
atomic_inc(&stat->users);
}
void venet_acct_put_stat(struct venet_stat *);
-struct venet_stat *venet_acct_find_create_stat(envid_t veid);
-struct venet_stat *venet_acct_find_stat(envid_t veid);
-int init_venet_acct_ip_stat(struct ve_struct *env, struct venet_stat *stat);
-void fini_venet_acct_ip_stat(struct ve_struct *env);
-
-struct ve_addr_struct;
void venet_acct_classify_add_incoming(struct venet_stat *, struct sk_buff *skb);
void venet_acct_classify_add_outgoing(struct venet_stat *, struct sk_buff *skb);
void venet_acct_classify_sub_outgoing(struct venet_stat *, struct sk_buff *skb);
@@ -69,4 +68,33 @@ void venet_acct_classify_add_outgoing_plain(struct venet_stat *stat,
struct ve_addr_struct *dst_addr, int data_size);
void ip_vznetstat_touch(void);
+int init_venet_acct_ip_stat(struct ve_struct *env, struct venet_stat *stat);
+void fini_venet_acct_ip_stat(struct ve_struct *env);
+#else /* !CONFIG_VE_NETDEV_ACCOUNTING */
+static inline void venet_acct_get_stat(struct venet_stat *stat) { }
+static inline void venet_acct_put_stat(struct venet_stat *stat) { }
+
+static inline void venet_acct_classify_add_incoming(struct venet_stat *stat,
+ struct sk_buff *skb) {}
+static inline void venet_acct_classify_add_outgoing(struct venet_stat *stat,
+ struct sk_buff *skb) {}
+static inline void venet_acct_classify_sub_outgoing(struct venet_stat *stat,
+ struct sk_buff *skb) {}
+
+static inline void venet_acct_classify_add_incoming_plain(struct venet_stat *stat,
+ struct ve_addr_struct *src_addr, int data_size) {}
+static inline void venet_acct_classify_add_outgoing_plain(struct venet_stat *stat,
+ struct ve_addr_struct *dst_addr, int data_size) {}
+static inline void ip_vznetstat_touch(void) {}
+
+static inline int init_venet_acct_ip_stat(struct ve_struct *env, struct venet_stat *stat)
+{
+ return 0;
+}
+static void fini_venet_acct_ip_stat(struct ve_struct *env)
+{
+}
+
+#endif /* CONFIG_VE_NETDEV_ACCOUNTING */
+
#endif
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 3cd83e3..3eb2fd2 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -66,6 +66,23 @@ config VE_IPTABLES
help
This option controls whether to build VE netfiltering code.
+config VZ_LIST
+ tristate "VE listing/statistics user ioctl interface"
+ depends on VE
+ default m
+ help
+ This options controls building of vzlist module.
+ This module provides ioctl interfaces for fetching VE ids, ip addresses
+ and pids of running processes.
+
+config VE_NETDEV_ACCOUNTING
+ tristate "VE networking accounting"
+ depends on VE_NETDEV
+ default m
+ help
+ This option allows traffic accounting on Virtual Networking device and
+ on real devices moved to a Virtual Environment
+
config VZ_WDOG
tristate "VE watchdog module"
depends on VE_CALLS
diff --git a/kernel/ve/Makefile b/kernel/ve/Makefile
index 044a337..1037943 100644
--- a/kernel/ve/Makefile
+++ b/kernel/ve/Makefile
@@ -13,12 +13,10 @@ vzmon-objs = vecalls.o
obj-$(CONFIG_VZ_DEV) += vzdev.o
obj-$(CONFIG_VZ_EVENT) += vzevent.o
-obj-m += vznetstat/vznetstat.o
-obj-m += vznetstat/ip_vznetstat.o
-obj-m += vznetstat/ip6_vznetstat.o
+obj-$(CONFIG_VE_NETDEV_ACCOUNTING) += vznetstat/vznetstat.o vznetstat/ip_vznetstat.o vznetstat/ip6_vznetstat.o
-obj-m += vzlist.o
-obj-m += vzstat.o
+obj-$(CONFIG_VZ_LIST) += vzlist.o
+obj-$(CONFIG_VE_CALLS) += vzstat.o
obj-m += dummy/ip6_vzprivnet.o
obj-m += dummy/ip_vzprivnet.o
More information about the Devel
mailing list