git://git.onelab.eu
/
nodemanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Setting tag nodemanager-1.8-33
[nodemanager.git]
/
bwmon.py
diff --git
a/bwmon.py
b/bwmon.py
index
53eb3bc
..
91a79f3
100644
(file)
--- a/
bwmon.py
+++ b/
bwmon.py
@@
-52,8
+52,9
@@
except:
seconds_per_day = 24 * 60 * 60
bits_per_byte = 8
seconds_per_day = 24 * 60 * 60
bits_per_byte = 8
+dev_default = tools.get_default_if()
# Burst to line rate (or node cap). Set by NM. in KBit/s
# Burst to line rate (or node cap). Set by NM. in KBit/s
-default_MaxRate = int(bwlimit.get_bwcap() / 1000)
+default_MaxRate = int(bwlimit.get_bwcap(
dev_default
) / 1000)
default_Maxi2Rate = int(bwlimit.bwmax / 1000)
# 5.4 Gbyte per day. 5.4 * 1024 k * 1024M * 1024G
# 5.4 Gbyte per day max allowed transfered per recording period
default_Maxi2Rate = int(bwlimit.bwmax / 1000)
# 5.4 Gbyte per day. 5.4 * 1024 k * 1024M * 1024G
# 5.4 Gbyte per day max allowed transfered per recording period
@@
-323,7
+324,7
@@
class Slice:
(self.name,
bwlimit.format_tc_rate(maxrate),
bwlimit.format_tc_rate(maxi2rate)), 1)
(self.name,
bwlimit.format_tc_rate(maxrate),
bwlimit.format_tc_rate(maxi2rate)), 1)
- bwlimit.set(xid = self.xid,
+ bwlimit.set(xid = self.xid,
dev = dev_default,
minrate = self.MinRate * 1000,
maxrate = self.MaxRate * 1000,
maxexemptrate = self.Maxi2Rate * 1000,
minrate = self.MinRate * 1000,
maxrate = self.MaxRate * 1000,
maxexemptrate = self.Maxi2Rate * 1000,
@@
-661,7
+662,8
@@
def sync(nmdbcopy):
pickle.dump((version, slices, deaddb), f)
f.close()
pickle.dump((version, slices, deaddb), f)
f.close()
-
+# doesnt use generic default interface because this runs as its own thread.
+# changing the config variable will not have an effect since GetSlivers: pass
def getDefaults(nmdbcopy):
'''
Get defaults from default slice's slice attributes.
def getDefaults(nmdbcopy):
'''
Get defaults from default slice's slice attributes.
@@
-703,7
+705,7
@@
def run():
nmdbcopy = copy.deepcopy(database.db)
database.db_lock.release()
try:
nmdbcopy = copy.deepcopy(database.db)
database.db_lock.release()
try:
- if getDefaults(nmdbcopy) and len(bwlimit.tc("class show dev
eth0"
)) > 0:
+ if getDefaults(nmdbcopy) and len(bwlimit.tc("class show dev
%s" % dev_default
)) > 0:
# class show to check if net:InitNodeLimit:bwlimit.init has run.
sync(nmdbcopy)
else: logger.log("bwmon: BW limits DISABLED.")
# class show to check if net:InitNodeLimit:bwlimit.init has run.
sync(nmdbcopy)
else: logger.log("bwmon: BW limits DISABLED.")