from vserverimpl import DLIMIT_INF
from vserverimpl import VC_LIM_KEEP
+from vserverimpl import VC_LIM_INFINITY
from vserverimpl import VLIMIT_NSOCK
from vserverimpl import VLIMIT_OPENFD
from vserverimpl import VLIMIT_ANON
def set_ipaddresses(self, addresses):
vserverimpl.netremove(self.ctx, "all")
- for a in addresses.split(","):
- vserverimpl.netadd(self.ctx, a)
+ for ip in addresses:
+ vserverimpl.netadd(self.ctx, ip)
def set_ipaddresses_config(self, addresses):
- return # acb
+ ip_addresses = addresses.split(",")
+
+ # add looopback interface
+ if not ip_addresses.__contains__("127.0.0.1"):
+ ip_addresses.append("127.0.0.1")
+
i = 0
- for a in addresses.split(","):
- self.config.update("interfaces/%d/ip" % i, a)
+ for ip in ip_addresses:
+ self.config.update("interfaces/%d/ip" % i, ip)
i += 1
while self.config.unset("interfaces/%d/ip" % i):
i += 1
- self.set_ipaddresses(addresses)
+ self.set_ipaddresses(ip_addresses)
def get_ipaddresses_config(self):
i = 0
os._exit(0) # Exit parent (the first child) of the second child.
# the grandson is the working one
os.chdir('/')
- os.umask(0)
+ os.umask(0022)
try:
# start the vserver
subprocess.call(["/usr/sbin/vserver",self.name,"start"])