Merge branch 'master' of ssh://git.onelab.eu/git/nodemanager
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 16 Feb 2011 19:58:22 +0000 (20:58 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 16 Feb 2011 19:58:22 +0000 (20:58 +0100)
logger.py
nodemanager.py
plugins/omf_resctl.py
plugins/reservation.py
plugins/sliverauth.py
sliver_vs.py

index b44abe2..64fa5ae 100644 (file)
--- a/logger.py
+++ b/logger.py
@@ -1,5 +1,3 @@
-# $Id$
-# $URL$
 
 """A very simple logger that tries to be concurrency-safe."""
 
index 162d1fd..68a8be4 100755 (executable)
@@ -1,8 +1,5 @@
 #!/usr/bin/python
 #
-# $Id$
-# $URL$
-#
 # Useful information can be found at https://svn.planet-lab.org/wiki/NodeManager
 #
 
index 0ee1da0..9b0efa8 100644 (file)
@@ -1,8 +1,6 @@
 #
-# $Id$
-# $URL$
-#
 # NodeManager plugin - first step of handling omf_controlled slices
+#
 
 """
 Overwrites the 'resctl' tag of slivers controlled by OMF so slivermanager.py does the right thing
index 985f45e..63c44b3 100644 (file)
@@ -1,7 +1,7 @@
-# $Id$
-# $URL$
 #
 # NodeManager plugin - first step of handling reservable nodes
+# Thierry Parmentelat <thierry.parmentelat@inria.fr>
+#
 
 """
 Manages running slices when reservation_policy is 'lease_or_idle' or 'lease_or_shared'
index 9e872c5..69de1d9 100644 (file)
@@ -1,14 +1,13 @@
 #!/usr/bin/python -tt
 # vim:set ts=4 sw=4 expandtab:
 #
-# $Id$
-# $URL$
-#
 # NodeManager plugin for creating credentials in slivers
 # (*) empower slivers to make API calls throught hmac
 # (*) also create a ssh key - used by the OMF resource controller 
 #     for authenticating itself with its Experiment Controller
-# xxx todo : a config option for turning these 2 things on or off ?
+# in order to avoid spamming the DB with huge amounts of such tags,
+# (*) slices need to have the 'enable_hmac' tag set
+# (*) or the 'omf_control' tag set, respectively
 
 """
 Sliver authentication support for NodeManager.
index 4c084b9..2554c2a 100644 (file)
@@ -1,5 +1,4 @@
-# $Id$
-# $URL$
+# 
 
 """VServer slivers.
 
@@ -168,6 +167,25 @@ class Sliver_VS(accounts.Account, vserver.VServer):
                 logger.log("vsliver_vs: %s: Installed new initscript in %s"%(self.name,sliver_initscript))
             else:
                 logger.log("vsliver_vs: %s: Removed obsolete initscript %s"%(self.name,sliver_initscript))
+    
+    # bind mount root side dir to sliver side
+    # needs to be done before sliver starts
+    def expose_ssh_dir (self):
+        try:
+            root_ssh="/home/%s/.ssh"
+            sliver_ssh="/vservers/%s/home/%s/.ssh"%(self.name,self.name)
+            # any of both might not exist yet
+            for path in [root_ssh,sliver_ssh]: 
+                if not os.path.exists (path):
+                    os.mkdir(path)
+                if not os.path.isdir (path):
+                    raise Exception
+            mounts=file('/proc/mounts').read()
+            if mounts.find(sliver_ssh)<0:
+                # xxx perform mount
+                subprocess.call("mount --bind -o ro %s %s"%(root_ssh,sliver_ssh),shell=True)
+        except:
+            logger.log("expose_ssh_dir with slice %s failed"%self.name)
 
     def start(self, delay=0):
         if self.rspec['enabled'] <= 0:
@@ -177,6 +195,7 @@ class Sliver_VS(accounts.Account, vserver.VServer):
             time.sleep(delay)
             # the generic /etc/init.d/vinit script is permanently refreshed, and enabled
             self.install_and_enable_vinit()
+            self.expose_ssh_dir()
             # if a change has occured in the slice initscript, reflect this in /etc/init.d/vinit.slice
             self.refresh_slice_vinit()
             child_pid = os.fork()