aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs59
-rw-r--r--OpenSim/Grid/GridServer/Main.cs30
2 files changed, 44 insertions, 45 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index c956a01..49b9aa2 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -38,11 +38,12 @@ using OpenSim.Framework.Console;
38using OpenSim.Framework.Data; 38using OpenSim.Framework.Data;
39using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
40 40
41
42namespace OpenSim.Grid.GridServer 41namespace OpenSim.Grid.GridServer
43{ 42{
44 internal class GridManager 43 internal class GridManager
45 { 44 {
45 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46
46 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 47 private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
47 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); 48 private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
48 49
@@ -57,10 +58,10 @@ namespace OpenSim.Grid.GridServer
57 /// <param name="FileName">The filename to the grid server plugin DLL</param> 58 /// <param name="FileName">The filename to the grid server plugin DLL</param>
58 public void AddPlugin(string FileName) 59 public void AddPlugin(string FileName)
59 { 60 {
60 MainLog.Instance.Verbose("DATA", "Attempting to load " + FileName); 61 m_log.Info("[DATA]: Attempting to load " + FileName);
61 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 62 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
62 63
63 MainLog.Instance.Verbose("DATA", "Found " + pluginAssembly.GetTypes().Length + " interfaces."); 64 m_log.Info("[DATA]: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
64 foreach (Type pluginType in pluginAssembly.GetTypes()) 65 foreach (Type pluginType in pluginAssembly.GetTypes())
65 { 66 {
66 if (!pluginType.IsAbstract) 67 if (!pluginType.IsAbstract)
@@ -74,7 +75,7 @@ namespace OpenSim.Grid.GridServer
74 (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 75 (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
75 plug.Initialise(); 76 plug.Initialise();
76 _plugins.Add(plug.getName(), plug); 77 _plugins.Add(plug.getName(), plug);
77 MainLog.Instance.Verbose("DATA", "Added IGridData Interface"); 78 m_log.Info("[DATA]: Added IGridData Interface");
78 } 79 }
79 80
80 typeInterface = null; 81 typeInterface = null;
@@ -88,7 +89,7 @@ namespace OpenSim.Grid.GridServer
88 (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 89 (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
89 plug.Initialise(); 90 plug.Initialise();
90 _logplugins.Add(plug.getName(), plug); 91 _logplugins.Add(plug.getName(), plug);
91 MainLog.Instance.Verbose("DATA", "Added ILogData Interface"); 92 m_log.Info("[DATA]: Added ILogData Interface");
92 } 93 }
93 94
94 typeInterface = null; 95 typeInterface = null;
@@ -116,7 +117,7 @@ namespace OpenSim.Grid.GridServer
116 } 117 }
117 catch (Exception) 118 catch (Exception)
118 { 119 {
119 MainLog.Instance.Warn("storage", "Unable to write log via " + kvp.Key); 120 m_log.Warn("[storage]: Unable to write log via " + kvp.Key);
120 } 121 }
121 } 122 }
122 } 123 }
@@ -136,7 +137,7 @@ namespace OpenSim.Grid.GridServer
136 } 137 }
137 catch (Exception e) 138 catch (Exception e)
138 { 139 {
139 MainLog.Instance.Warn("storage", "getRegion - " + e.Message); 140 m_log.Warn("[storage]: getRegion - " + e.Message);
140 } 141 }
141 } 142 }
142 return null; 143 return null;
@@ -157,7 +158,7 @@ namespace OpenSim.Grid.GridServer
157 } 158 }
158 catch 159 catch
159 { 160 {
160 MainLog.Instance.Warn("storage", "Unable to find region " + handle.ToString() + " via " + kvp.Key); 161 m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key);
161 } 162 }
162 } 163 }
163 return null; 164 return null;
@@ -179,7 +180,7 @@ namespace OpenSim.Grid.GridServer
179 } 180 }
180 catch 181 catch
181 { 182 {
182 MainLog.Instance.Warn("storage", "Unable to query regionblock via " + kvp.Key); 183 m_log.Warn("[storage]: Unable to query regionblock via " + kvp.Key);
183 } 184 }
184 } 185 }
185 186
@@ -245,14 +246,14 @@ namespace OpenSim.Grid.GridServer
245 } 246 }
246 else 247 else
247 { 248 {
248 MainLog.Instance.Verbose("GRID", "Region connected without a UUID, ignoring."); 249 m_log.Info("[GRID]: Region connected without a UUID, ignoring.");
249 responseData["error"] = "No UUID passed to grid server - unable to connect you"; 250 responseData["error"] = "No UUID passed to grid server - unable to connect you";
250 return response; 251 return response;
251 } 252 }
252 253
253 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? 254 if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
254 { 255 {
255 MainLog.Instance.Verbose("GRID", "New region connecting"); 256 m_log.Info("[GRID]: New region connecting");
256 myword = "creation"; 257 myword = "creation";
257 } 258 }
258 else 259 else
@@ -320,7 +321,7 @@ namespace OpenSim.Grid.GridServer
320 (OldSim.regionRecvKey == TheSim.regionRecvKey && 321 (OldSim.regionRecvKey == TheSim.regionRecvKey &&
321 OldSim.regionSendKey == TheSim.regionSendKey)) 322 OldSim.regionSendKey == TheSim.regionSendKey))
322 { 323 {
323 MainLog.Instance.Verbose("GRID", "Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + 324 m_log.Info("[GRID]: Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
324 TheSim.serverURI); 325 TheSim.serverURI);
325 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 326 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
326 { 327 {
@@ -330,17 +331,17 @@ namespace OpenSim.Grid.GridServer
330 switch (insertResponse) 331 switch (insertResponse)
331 { 332 {
332 case DataResponse.RESPONSE_OK: 333 case DataResponse.RESPONSE_OK:
333 MainLog.Instance.Verbose("grid", "New sim " + myword + " successful: " + TheSim.regionName); 334 m_log.Info("[grid]: New sim " + myword + " successful: " + TheSim.regionName);
334 break; 335 break;
335 case DataResponse.RESPONSE_ERROR: 336 case DataResponse.RESPONSE_ERROR:
336 MainLog.Instance.Warn("storage", "New sim creation failed (Error): " + TheSim.regionName); 337 m_log.Warn("[storage]: New sim creation failed (Error): " + TheSim.regionName);
337 break; 338 break;
338 case DataResponse.RESPONSE_INVALIDCREDENTIALS: 339 case DataResponse.RESPONSE_INVALIDCREDENTIALS:
339 MainLog.Instance.Warn("storage", 340 m_log.Warn("[storage]: " +
340 "New sim creation failed (Invalid Credentials): " + TheSim.regionName); 341 "New sim creation failed (Invalid Credentials): " + TheSim.regionName);
341 break; 342 break;
342 case DataResponse.RESPONSE_AUTHREQUIRED: 343 case DataResponse.RESPONSE_AUTHREQUIRED:
343 MainLog.Instance.Warn("storage", 344 m_log.Warn("[storage]: " +
344 "New sim creation failed (Authentication Required): " + 345 "New sim creation failed (Authentication Required): " +
345 TheSim.regionName); 346 TheSim.regionName);
346 break; 347 break;
@@ -348,9 +349,9 @@ namespace OpenSim.Grid.GridServer
348 } 349 }
349 catch (Exception e) 350 catch (Exception e)
350 { 351 {
351 MainLog.Instance.Warn("storage", 352 m_log.Warn("[storage]: " +
352 "Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key); 353 "Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key);
353 MainLog.Instance.Warn("storage", e.ToString()); 354 m_log.Warn("[storage]: " + e.ToString());
354 } 355 }
355 356
356 357
@@ -458,14 +459,14 @@ namespace OpenSim.Grid.GridServer
458 } 459 }
459 else 460 else
460 { 461 {
461 MainLog.Instance.Warn("grid", "Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); 462 m_log.Warn("[grid]: Authentication failed when trying to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
462 responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys."; 463 responseData["error"] = "The key required to connect to your region did not match. Please check your send and recieve keys.";
463 return response; 464 return response;
464 } 465 }
465 } 466 }
466 else 467 else
467 { 468 {
468 MainLog.Instance.Warn("grid", "Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName); 469 m_log.Warn("[grid]: Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
469 responseData["error"] = "Another region already exists at that location. Try another"; 470 responseData["error"] = "Another region already exists at that location. Try another";
470 return response; 471 return response;
471 } 472 }
@@ -496,7 +497,7 @@ namespace OpenSim.Grid.GridServer
496 } 497 }
497 else 498 else
498 { 499 {
499 MainLog.Instance.Verbose("DATA", "found " + (string) simData.regionName + " regionHandle = " + 500 m_log.Info("[DATA]: found " + (string) simData.regionName + " regionHandle = " +
500 (string) requestData["region_handle"]); 501 (string) requestData["region_handle"]);
501 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); 502 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
502 responseData["sim_port"] = simData.serverPort.ToString(); 503 responseData["sim_port"] = simData.serverPort.ToString();
@@ -535,8 +536,8 @@ namespace OpenSim.Grid.GridServer
535 { 536 {
536 ymax = (Int32) requestData["ymax"]; 537 ymax = (Int32) requestData["ymax"];
537 } 538 }
538 //CFK: The second MainLog is more meaningful and either standard or fast generally occurs. 539 //CFK: The second log is more meaningful and either standard or fast generally occurs.
539 //CFK: MainLog.Instance.Verbose("MAP", "World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 540 //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
540 541
541 XmlRpcResponse response = new XmlRpcResponse(); 542 XmlRpcResponse response = new XmlRpcResponse();
542 Hashtable responseData = new Hashtable(); 543 Hashtable responseData = new Hashtable();
@@ -575,7 +576,7 @@ namespace OpenSim.Grid.GridServer
575 576
576 simProfileList.Add(simProfileBlock); 577 simProfileList.Add(simProfileBlock);
577 } 578 }
578 MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() + 579 m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
579 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 580 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
580 } 581 }
581 else 582 else
@@ -610,7 +611,7 @@ namespace OpenSim.Grid.GridServer
610 } 611 }
611 } 612 }
612 } 613 }
613 MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() + 614 m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
614 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 615 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
615 } 616 }
616 617
@@ -776,7 +777,7 @@ namespace OpenSim.Grid.GridServer
776 777
777 try 778 try
778 { 779 {
779 MainLog.Instance.Verbose("DATA", 780 m_log.Info("[DATA]: " +
780 "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 781 "Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
781 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 782 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
782 { 783 {
@@ -789,13 +790,13 @@ namespace OpenSim.Grid.GridServer
789 (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) 790 (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey))
790 { 791 {
791 kvp.Value.AddProfile(TheSim); 792 kvp.Value.AddProfile(TheSim);
792 MainLog.Instance.Verbose("grid", "New sim added to grid (" + TheSim.regionName + ")"); 793 m_log.Info("[grid]: New sim added to grid (" + TheSim.regionName + ")");
793 logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5, 794 logToDB(TheSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5,
794 "Region successfully updated and connected to grid."); 795 "Region successfully updated and connected to grid.");
795 } 796 }
796 else 797 else
797 { 798 {
798 MainLog.Instance.Warn("grid", 799 m_log.Warn("[grid]: " +
799 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); 800 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
800 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 801 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
801 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 802 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
@@ -803,7 +804,7 @@ namespace OpenSim.Grid.GridServer
803 } 804 }
804 catch (Exception e) 805 catch (Exception e)
805 { 806 {
806 MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + 807 m_log.Warn("[GRID]: getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
807 e.ToString()); 808 e.ToString());
808 } 809 }
809 } 810 }
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index 8a522c2..ff4a888 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -39,6 +39,8 @@ namespace OpenSim.Grid.GridServer
39 /// </summary> 39 /// </summary>
40 public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback 40 public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback
41 { 41 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43
42 public GridConfig Cfg; 44 public GridConfig Cfg;
43 45
44 public static OpenGrid_Main thegrid; 46 public static OpenGrid_Main thegrid;
@@ -54,11 +56,13 @@ namespace OpenSim.Grid.GridServer
54 [STAThread] 56 [STAThread]
55 public static void Main(string[] args) 57 public static void Main(string[] args)
56 { 58 {
59 log4net.Config.XmlConfigurator.Configure();
60
57 if (args.Length > 0) 61 if (args.Length > 0)
58 { 62 {
59 if (args[0] == "-setuponly") setuponly = true; 63 if (args[0] == "-setuponly") setuponly = true;
60 } 64 }
61 Console.WriteLine("Starting...\n"); 65 m_log.Info("Starting...\n");
62 66
63 thegrid = new OpenGrid_Main(); 67 thegrid = new OpenGrid_Main();
64 thegrid.Startup(); 68 thegrid.Startup();
@@ -68,23 +72,18 @@ namespace OpenSim.Grid.GridServer
68 72
69 private void Work() 73 private void Work()
70 { 74 {
71 m_log.Notice("Enter help for a list of commands\n"); 75 m_console.Notice("Enter help for a list of commands\n");
72 76
73 while (true) 77 while (true)
74 { 78 {
75 m_log.MainLogPrompt(); 79 m_console.Prompt();
76 } 80 }
77 } 81 }
78 82
79 private OpenGrid_Main() 83 private OpenGrid_Main()
80 { 84 {
81 if (!Directory.Exists(Util.logDir())) 85 m_console = new ConsoleBase("OpenGrid", this);
82 { 86 MainConsole.Instance = m_console;
83 Directory.CreateDirectory(Util.logDir());
84 }
85 m_log =
86 new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true);
87 MainLog.Instance = m_log;
88 } 87 }
89 88
90 public void managercallback(string cmd) 89 public void managercallback(string cmd)
@@ -97,19 +96,18 @@ namespace OpenSim.Grid.GridServer
97 } 96 }
98 } 97 }
99 98
100
101 public void Startup() 99 public void Startup()
102 { 100 {
103 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 101 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
104 //Yeah srsly, that's it. 102 //Yeah srsly, that's it.
105 if (setuponly) Environment.Exit(0); 103 if (setuponly) Environment.Exit(0);
106 104
107 m_log.Verbose("GRID", "Connecting to Storage Server"); 105 m_log.Info("[GRID]: Connecting to Storage Server");
108 m_gridManager = new GridManager(); 106 m_gridManager = new GridManager();
109 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win 107 m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win
110 m_gridManager.config = Cfg; 108 m_gridManager.config = Cfg;
111 109
112 m_log.Verbose("GRID", "Starting HTTP process"); 110 m_log.Info("[GRID]: Starting HTTP process");
113 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); 111 BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
114 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 112 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
115 113
@@ -135,7 +133,7 @@ namespace OpenSim.Grid.GridServer
135 133
136 httpServer.Start(); 134 httpServer.Start();
137 135
138 m_log.Verbose("GRID", "Starting sim status checker"); 136 m_log.Info("[GRID]: Starting sim status checker");
139 137
140 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. 138 Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates.
141 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 139 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
@@ -186,11 +184,11 @@ namespace OpenSim.Grid.GridServer
186 switch (cmd) 184 switch (cmd)
187 { 185 {
188 case "help": 186 case "help":
189 m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 187 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
190 break; 188 break;
191 189
192 case "shutdown": 190 case "shutdown":
193 m_log.Close(); 191 m_console.Close();
194 Environment.Exit(0); 192 Environment.Exit(0);
195 break; 193 break;
196 } 194 }