updated link config to work distributed, added crude locking for fabric
This commit is contained in:
parent
859f473ba9
commit
a4b6b8be51
5 changed files with 79 additions and 12 deletions
|
@ -961,7 +961,7 @@ class CoreNode(CoreNodeBase):
|
|||
self.client.check_cmd(["sync"])
|
||||
else:
|
||||
self.net_cmd(["mkdir", "-p", directory])
|
||||
self.server.put(srcname, filename)
|
||||
distributed.remote_put(self.server, srcname, filename)
|
||||
|
||||
def hostfilename(self, filename):
|
||||
"""
|
||||
|
@ -1001,7 +1001,7 @@ class CoreNode(CoreNodeBase):
|
|||
temp.write(contents.encode("utf-8"))
|
||||
temp.close()
|
||||
self.net_cmd(["mkdir", "-m", "%o" % 0o755, "-p", dirname])
|
||||
self.server.put(temp.name, hostfilename)
|
||||
distributed.remote_put(self.server, temp.name, hostfilename)
|
||||
self.net_cmd(["chmod", "%o" % mode, hostfilename])
|
||||
logging.debug(
|
||||
"node(%s) added file: %s; mode: 0%o", self.name, hostfilename, mode
|
||||
|
@ -1023,7 +1023,7 @@ class CoreNode(CoreNodeBase):
|
|||
if mode is not None:
|
||||
os.chmod(hostfilename, mode)
|
||||
else:
|
||||
self.server.put(srcfilename, hostfilename)
|
||||
distributed.remote_put(self.server, srcfilename, hostfilename)
|
||||
if mode is not None:
|
||||
self.net_cmd(["chmod", "%o" % mode, hostfilename])
|
||||
logging.info(
|
||||
|
|
|
@ -525,14 +525,14 @@ class CoreNetwork(CoreNetworkBase):
|
|||
logging.debug(
|
||||
"linkconfig: %s" % ([tc + parent + ["handle", "1:"] + tbf],)
|
||||
)
|
||||
utils.check_cmd(tc + parent + ["handle", "1:"] + tbf)
|
||||
netif.net_cmd(tc + parent + ["handle", "1:"] + tbf)
|
||||
netif.setparam("has_tbf", True)
|
||||
changed = True
|
||||
elif netif.getparam("has_tbf") and bw <= 0:
|
||||
tcd = [] + tc
|
||||
tcd[2] = "delete"
|
||||
if self.up:
|
||||
utils.check_cmd(tcd + parent)
|
||||
netif.net_cmd(tcd + parent)
|
||||
netif.setparam("has_tbf", False)
|
||||
# removing the parent removes the child
|
||||
netif.setparam("has_netem", False)
|
||||
|
@ -575,14 +575,14 @@ class CoreNetwork(CoreNetworkBase):
|
|||
tc[2] = "delete"
|
||||
if self.up:
|
||||
logging.debug("linkconfig: %s" % ([tc + parent + ["handle", "10:"]],))
|
||||
utils.check_cmd(tc + parent + ["handle", "10:"])
|
||||
netif.net_cmd(tc + parent + ["handle", "10:"])
|
||||
netif.setparam("has_netem", False)
|
||||
elif len(netem) > 1:
|
||||
if self.up:
|
||||
logging.debug(
|
||||
"linkconfig: %s" % ([tc + parent + ["handle", "10:"] + netem],)
|
||||
)
|
||||
utils.check_cmd(tc + parent + ["handle", "10:"] + netem)
|
||||
netif.net_cmd(tc + parent + ["handle", "10:"] + netem)
|
||||
netif.setparam("has_netem", True)
|
||||
|
||||
def linknet(self, net):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue