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
Fix up tag levels after merge
[nodemanager.git]
/
sliver_lxc.py
diff --git
a/sliver_lxc.py
b/sliver_lxc.py
index
441b2e6
..
f2521a3
100644
(file)
--- a/
sliver_lxc.py
+++ b/
sliver_lxc.py
@@
-11,14
+11,14
@@
from string import Template
import libvirt
import logger
import libvirt
import logger
-import
bwlimitlxc
as bwlimit
+import
plnode.bwlimit
as bwlimit
from initscript import Initscript
from sliver_libvirt import Sliver_Libvirt
class Sliver_LXC(Sliver_Libvirt, Initscript):
"""This class wraps LXC commands"""
from initscript import Initscript
from sliver_libvirt import Sliver_Libvirt
class Sliver_LXC(Sliver_Libvirt, Initscript):
"""This class wraps LXC commands"""
- SHELL = '/
bin/ssh
sh'
+ SHELL = '/
usr/sbin/v
sh'
TYPE = 'sliver.LXC'
# Need to add a tag at myplc to actually use this account
# type = 'sliver.LXC'
TYPE = 'sliver.LXC'
# Need to add a tag at myplc to actually use this account
# type = 'sliver.LXC'
@@
-90,10
+90,15
@@
class Sliver_LXC(Sliver_Libvirt, Initscript):
command = ['chmod', '755', containerDir]
logger.log_call(command, timeout=15*60)
command = ['chmod', '755', containerDir]
logger.log_call(command, timeout=15*60)
- # customize prompt for slice owner
+ # customize prompt for slice owner
, + LD_PRELOAD for transparently wrap bind
dot_profile=os.path.join(containerDir,"root/.profile")
dot_profile=os.path.join(containerDir,"root/.profile")
+ ld_preload_msg="""# by default, we define this setting so that calls to bind(2),
+# when invoked on 0.0.0.0, get transparently redirected to the public interface of this node
+# see https://svn.planet-lab.org/wiki/LxcPortForwarding"""
with open(dot_profile,'w') as f:
f.write("export PS1='%s@\H \$ '\n"%(name))
with open(dot_profile,'w') as f:
f.write("export PS1='%s@\H \$ '\n"%(name))
+ f.write("%s\n"%ld_preload_msg)
+ f.write("export LD_PRELOAD=/etc/planetlab/lib/bind_public.so\n")
# TODO: set quotas...
# TODO: set quotas...
@@
-141,10
+146,13
@@
class Sliver_LXC(Sliver_Libvirt, Initscript):
else:
logger.log("Cannot find XML template %s"%template_filename_sliceimage)
return
else:
logger.log("Cannot find XML template %s"%template_filename_sliceimage)
return
+
+ interfaces = Sliver_Libvirt.get_interfaces_xml(rec)
+
try:
with open(template_filename) as f:
template = Template(f.read())
try:
with open(template_filename) as f:
template = Template(f.read())
- xml = template.substitute(name=name,
xid=xid
)
+ xml = template.substitute(name=name,
interfaces=interfaces
)
except IOError:
logger.log('Failed to parse or use XML template file %s'%template_filename)
return
except IOError:
logger.log('Failed to parse or use XML template file %s'%template_filename)
return