+"""
+Write /etc/vservers/<slicename>/spaces/net
+"""
+def writeConf(slicename, value):
+ SLICEDIR="/etc/vservers/%s/" % slicename
+ SPACESDIR="%s/spaces/" % SLICEDIR
+ if os.path.exists(SLICEDIR):
+ if not os.path.exists(SPACESDIR):
+ try:
+ os.mkdir(SPACESDIR)
+ except os.error:
+ logger.log("netns: could not create %s\n" % SPACESDIR)
+ return
+ f = open("%s/net" % SPACESDIR, "w")
+ f.write("%s\n" % value)
+ f.close()
+ STATUS="OFF"
+ if int(value) >= 1:
+ STATUS="ON"
+ logger.log("%s: network namespace %s\n" % (slicename, STATUS))