Merge branch 'master' of ssh://git.planet-lab.org/git/sfa
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 22 Jul 2011 18:59:23 +0000 (14:59 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 22 Jul 2011 18:59:23 +0000 (14:59 -0400)
sfa/plc/api.py
sfa/rspecs/resources/__init__.py [new file with mode: 0644]
sfa/rspecs/resources/ext/__init__.py [new file with mode: 0644]
sfa/rspecs/resources/ext/planetlab.rnc [new file with mode: 0644]
sfa/rspecs/resources/ext/planetlab.xsd [new file with mode: 0644]

index 28e2748..8d0e806 100644 (file)
@@ -111,16 +111,20 @@ class SfaAPI(BaseAPI):
         self.plauth = {'Username': self.config.SFA_PLC_USER,
                        'AuthMethod': 'password',
                        'AuthString': self.config.SFA_PLC_PASSWORD}
-        try:
-            sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh")))
-            self.plshell_type = 'direct'
-            import PLC.Shell
-            shell = PLC.Shell.Shell(globals = globals())
-        except:
-            self.plshell_type = 'xmlrpc' 
-            url = self.config.SFA_PLC_URL
-            shell = xmlrpclib.Server(url, verbose = 0, allow_none = True)
+
+        # The native shell (PLC.Shell.Shell) is more efficient than xmlrpc,
+        # but it leaves idle db connections open. use xmlrpc until we can figure
+        # out why PLC.Shell.Shell doesn't close db connection properly     
+        #try:
+        #    sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh")))
+        #    self.plshell_type = 'direct'
+        #    import PLC.Shell
+        #    shell = PLC.Shell.Shell(globals = globals())
+        #except:
         
+        self.plshell_type = 'xmlrpc' 
+        url = self.config.SFA_PLC_URL
+        shell = xmlrpclib.Server(url, verbose = 0, allow_none = True)
         return shell
 
     def getCredential(self):
diff --git a/sfa/rspecs/resources/__init__.py b/sfa/rspecs/resources/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/sfa/rspecs/resources/ext/__init__.py b/sfa/rspecs/resources/ext/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/sfa/rspecs/resources/ext/planetlab.rnc b/sfa/rspecs/resources/ext/planetlab.rnc
new file mode 100644 (file)
index 0000000..f1ff971
--- /dev/null
@@ -0,0 +1,13 @@
+#
+## Extension for the "initscript" type for RSpecV2 on PlanetLab
+## Version 1
+##
+
+default namespace = "http://www.planet-lab.org/resources/ext/initscript/1"
+
+Node = element initscript {
+   attribute name { text }
+}
+
+start = Node
+
diff --git a/sfa/rspecs/resources/ext/planetlab.xsd b/sfa/rspecs/resources/ext/planetlab.xsd
new file mode 100644 (file)
index 0000000..cbbaf5b
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+   Extension for the "initscript" type for RSpecV2 on PlanetLab
+   Version 1
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+elementFormDefault="qualified" 
+targetNamespace="http://www.planet-lab.org/resources/ext/planetlab/1" 
+xmlns:planetlab="http://www.planet-lab.org/resources/ext/planetlab/1">
+   <xs:element name="initscript">
+     <xs:complexType>
+       <xs:attribute name="name" use="required"/>
+     </xs:complexType>
+   </xs:element>
+</xs:schema>