sfa settings : sfa_plc category split into sfa_plc and sfa_db
Thierry Parmentelat [Tue, 22 Nov 2011 15:12:42 +0000 (16:12 +0100)]
INSTALL.txt
config/default_config.xml
config/sfa-config-tty
sfa/util/PostgreSQL.py
sfa/util/config.py

index cc59ceb..b93abae 100644 (file)
@@ -30,8 +30,8 @@ These four configuration parameters are required for SFA server configuration
 
  set SFA_PLC_USER              to     PLC_ROOT_USER 
  set SFA_PLC_PASSWORD          to     PLC_ROOT_PASSWORD
- set SFA_PLC_DB_USER                   to     PLC_DB_USER
- set SFA_PLC_DB_PASSWORD       to     PLC_DB_PASSWORD
+ set SFA_DB_USER               to     PLC_DB_USER
+ set SFA_DB_PASSWORD   to     PLC_DB_PASSWORD
 write and quit
 
 *NOTE* at this point you get a warning b/c the authorities hierarchy has not been created yet; ignore
index 670d6f2..e633a60 100644 (file)
@@ -18,15 +18,6 @@ Thierry Parmentelat
       <description>Basic system variables.</description>
 
       <variablelist>
-       <variable id="generic_flavour" type="string">
-         <name>Generic Flavour</name>
-         <value>pl</value>
-         <description>This string refers to a class located in sfa.generic that describes 
-         which specific implementation needs to be used for api, manager and driver objects.
-         PlanetLab users do not need to change this setting.
-         </description>
-       </variable>
-
         <variable id="interface_hrn" type="string">
           <name>Human readable name</name>
           <value>plc</value>
@@ -62,6 +53,15 @@ Thierry Parmentelat
             </description> 
         </variable>
 
+       <variable id="generic_flavour" type="string">
+         <name>Generic Flavour</name>
+         <value>pl</value>
+         <description>This string refers to a class located in sfa.generic that describes 
+         which specific implementation needs to be used for api, manager and driver objects.
+         PlanetLab users do not need to change this setting.
+         </description>
+       </variable>
+
       </variablelist>
     </category>
 
@@ -110,6 +110,42 @@ Thierry Parmentelat
     </category>
 
     <!-- ======================================== -->
+    <category id="sfa_sm">
+      <name>Slice Manager</name>
+      <description>The settings that affect the slice manager that will run
+      as part of this SFA instance.</description>
+
+      <variablelist>
+       <variable id="enabled" type="boolean">
+         <name>Enable Slice Manager</name>
+         <value>true</value>
+         <description>Allows this local SFA instance to run as a
+         slice manager.</description>
+       </variable>
+
+       <variable id="type" type="string">
+         <name>Slice Manager type</name>
+         <value>pl</value>
+         <description>The type of backend server for this
+         slice manager. Not all slice managers are myplc.</description>
+       </variable>
+
+       <variable id="host" type="hostname">
+         <name>Hostname</name>
+         <value>localhost</value>
+         <description>The hostname where the slice manager is expected to
+         be found.</description>
+       </variable>
+
+       <variable id="port" type="int">
+         <name>Port number</name>
+         <value>12347</value>
+         <description>The port where the slice manager is to be found.</description>
+       </variable>
+      </variablelist>
+    </category>
+
+    <!-- ======================================== -->
     <category id="sfa_aggregate">
       <name>Aggregate</name>
       <description>The settings that affect the aggregate manager that will run
@@ -153,38 +189,42 @@ Thierry Parmentelat
     </category>
 
     <!-- ======================================== -->
-    <category id="sfa_sm">
-      <name>Slice Manager</name>
-      <description>The settings that affect the slice manager that will run
-      as part of this SFA instance.</description>
+    <category id="sfa_db">
+      <name></name>
+      <description>The settings that tell this SFA instance where to find its database. You can essentially leave this as-is unless you plan on hosting your data on some other box.</description>
 
       <variablelist>
-       <variable id="enabled" type="boolean">
-         <name>Enable Slice Manager</name>
-         <value>true</value>
-         <description>Allows this local SFA instance to run as a
-         slice manager.</description>
+       <variable id="host" type="hostname">
+         <name>Database host</name>
+         <value>localhost</value>
+         <description>The host where the SFA database can be reached.</description>
        </variable>
 
-       <variable id="type" type="string">
-         <name>Slice Manager type</name>
-         <value>pl</value>
-         <description>The type of backend server for this
-         slice manager. Not all slice managers are myplc.</description>
+       <variable id="port" type="int">
+         <name>Database port</name>
+         <value>5432</value>
+         <description>The port where the SFA database can be reached.</description>
        </variable>
 
-       <variable id="host" type="hostname">
-         <name>Hostname</name>
-         <value>localhost</value>
-         <description>The hostname where the slice manager is expected to
-         be found.</description>
+       <variable id="user" type="string">
+         <name>Database user</name>
+         <value>pgsqluser</value>
+         <description>When SFA gets co-hosted with a myplc, this should match the PLC config.</description>
        </variable>
 
-       <variable id="port" type="int">
-         <name>Port number</name>
-         <value>12347</value>
-         <description>The port where the slice manager is to be found.</description>
+       <variable id="password" type="string">
+         <name>Database password</name>
+         <value></value>
+         <description>When SFA gets co-hosted with a myplc, this should match the PLC config.</description>
        </variable>
+
+       <variable id="name" type="string">
+         <name>Database name</name>
+         <value>sfa</value>
+         <description>SFA database name.</description>
+       </variable>
+
+
       </variablelist>
     </category>
 
@@ -212,39 +252,11 @@ Thierry Parmentelat
          <description>Full URL of PLC interface.</description>
        </variable>
 
-       <variable id="db_name" type="string">
-         <name>Database name</name>
-         <value>planetlab5</value>
-         <description>Planetlab database name.</description>
-       </variable>
-
-       <variable id="db_host" type="hostname">
-         <name>Datbase host</name>
-         <value>localhost</value>
-         <description>The host where the PLC database can be reached.</description>
-       </variable>
-
-       <variable id="db_port" type="int">
-         <name>Database port</name>
-         <value>5432</value>
-         <description>The port where the PLC database can be reached.</description>
-       </variable>
-
-       <variable id="db_user" type="string">
-         <name>Database user</name>
-         <value>pgsqluser</value>
-         <description></description>
-       </variable>
-
-       <variable id="db_password" type="string">
-         <name>Database password</name>
-         <value></value>
-         <description>The password for PLC_DB_USER.</description>
-       </variable>
-
       </variablelist>
     </category>
 
+
+    <!-- ======================================== -->
     <category id="sfa_flashpolicy">
       <name>SFA Flash Policy</name>
       <description>The settings that affect the flash policy server that will run
index 9b2c439..1e99163 100755 (executable)
@@ -18,12 +18,12 @@ usual_variables = [
     "SFA_REGISTRY_HOST", 
     "SFA_AGGREGATE_HOST",
     "SFA_SM_HOST",
+    "SFA_PLC_URL",
     "SFA_PLC_USER",
     "SFA_PLC_PASSWORD",
-    "SFA_PLC_DB_HOST",
-    "SFA_PLC_DB_USER",
-    "SFA_PLC_DB_PASSWORD",
-    "SFA_PLC_URL",
+    "SFA_DB_HOST",
+    "SFA_DB_USER",
+    "SFA_DB_PASSWORD",
     ]
 
 configuration={ \
index f16f48d..de6f9fa 100644 (file)
@@ -69,22 +69,22 @@ class PostgreSQL:
             if psycopg2:
                 try:
                     # Try UNIX socket first
-                    self.connection = psycopg2.connect(user = self.config.SFA_PLC_DB_USER,
-                                                       password = self.config.SFA_PLC_DB_PASSWORD,
-                                                       database = self.config.SFA_PLC_DB_NAME)
+                    self.connection = psycopg2.connect(user = self.config.SFA_DB_USER,
+                                                       password = self.config.SFA_DB_PASSWORD,
+                                                       database = self.config.SFA_DB_NAME)
                 except psycopg2.OperationalError:
                     # Fall back on TCP
-                    self.connection = psycopg2.connect(user = self.config.SFA_PLC_DB_USER,
-                                                       password = self.config.SFA_PLC_DB_PASSWORD,
-                                                       database = self.config.SFA_PLC_DB_NAME,
-                                                       host = self.config.SFA_PLC_DB_HOST,
-                                                       port = self.config.SFA_PLC_DB_PORT)
+                    self.connection = psycopg2.connect(user = self.config.SFA_DB_USER,
+                                                       password = self.config.SFA_DB_PASSWORD,
+                                                       database = self.config.SFA_DB_NAME,
+                                                       host = self.config.SFA_DB_HOST,
+                                                       port = self.config.SFA_DB_PORT)
                 self.connection.set_client_encoding("UNICODE")
             else:
-                self.connection = pgdb.connect(user = self.config.SFA_PLC_DB_USER,
-                                               password = self.config.SFA_PLC_DB_PASSWORD,
-                                               host = "%s:%d" % (self.config.SFA_PLC_DB_HOST, self.config.SFA_PLC_DB_PORT),
-                                               database = self.config.SFA_PLC_DB_NAME)
+                self.connection = pgdb.connect(user = self.config.SFA_DB_USER,
+                                               password = self.config.SFA_DB_PASSWORD,
+                                               host = "%s:%d" % (self.config.SFA_DB_HOST, self.config.SFA_DB_PORT),
+                                               database = self.config.SFA_DB_NAME)
 
         (self.rowcount, self.description, self.lastrowid) = \
                         (None, None, None)
index 1466916..2ad7f7b 100644 (file)
@@ -106,11 +106,11 @@ class Config:
 
     def get_plc_dbinfo(self):
         return {
-            'dbname' : self.SFA_PLC_DB_NAME,
-            'address' : self.SFA_PLC_DB_HOST,
-            'port' : self.SFA_PLC_DB_PORT,
-            'user' : self.SFA_PLC_DB_USER,
-            'password' : self.SFA_PLC_DB_PASSWORD
+            'dbname' : self.SFA_DB_NAME,
+            'address' : self.SFA_DB_HOST,
+            'port' : self.SFA_DB_PORT,
+            'user' : self.SFA_DB_USER,
+            'password' : self.SFA_DB_PASSWORD
             }
 
     # TODO: find a better place to put this method