Merge branch 'dev' of ssh://sceneapi@island.sciencesim.com/home/sceneapi/sceneapi into dev

dsg
Huaiyu (Kitty) Liu 2011-02-14 11:36:25 -08:00
commit b31fa7d8fe
11 changed files with 342 additions and 6 deletions

View File

@ -902,7 +902,7 @@ namespace OpenSim.Framework
string quarkLocation = config.GetString("SyncQuarkLocation", "1000,1000"); string quarkLocation = config.GetString("SyncQuarkLocation", "1000,1000");
string[] quarkLocElements = location.Split(new char[] { ',' }); string[] quarkLocElements = quarkLocation.Split(new char[] { ',' });
m_quarkLocX = Convert.ToUInt32(quarkLocElements[0]); m_quarkLocX = Convert.ToUInt32(quarkLocElements[0]);
m_quarkLocY = Convert.ToUInt32(quarkLocElements[1]); m_quarkLocY = Convert.ToUInt32(quarkLocElements[1]);

View File

@ -36,6 +36,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Services.Interfaces;
using log4net; using log4net;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -105,11 +106,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Debug(LogHeader + " Init PEToSceneConnectorModule, for local scene " + scene.RegionInfo.RegionName); m_log.Debug(LogHeader + " Init PEToSceneConnectorModule, for local scene " + scene.RegionInfo.RegionName);
// string configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerIP";
// m_serveraddr = syncConfig.GetString(configString, "127.0.0.1");
// configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerPort";
// m_serverport = syncConfig.GetInt(configString, 13000);
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IPhysEngineToSceneConnectorModule>(this); m_scene.RegisterModuleInterface<IPhysEngineToSceneConnectorModule>(this);
m_syncConfig = syncConfig; m_syncConfig = syncConfig;

View File

@ -77,6 +77,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is. //register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is.
m_scene.RegisterModuleInterface<IDSGActorSyncModule>(this); m_scene.RegisterModuleInterface<IDSGActorSyncModule>(this);
// register actor
if (!scene.GridService.RegisterActor(scene.RegionInfo.RegionID.ToString(),
"physics_engine", scene.RegionInfo.RegionID.ToString()))
{
m_log.ErrorFormat("{0}: Failure registering actor", LogHeader);
}
// Setup the command line interface // Setup the command line interface
//m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; //m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
//InstallInterfaces(); //InstallInterfaces();

View File

@ -13,6 +13,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using log4net; using log4net;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
@ -876,6 +877,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!addr.Equals(IPAddrUnknown) && port != PortUnknown) if (!addr.Equals(IPAddrUnknown) && port != PortUnknown)
{ {
RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port);
// remove any cruft from previous runs
m_scene.GridService.CleanUpEndpoint(m_scene.RegionInfo.RegionID.ToString());
// Register the endpoint and quark and persistence actor for this simulator instance
GridEndpointInfo gei = new GridEndpointInfo();
gei.syncServerID = m_scene.RegionInfo.RegionID.ToString();
gei.address = m_scene.RegionInfo.SyncServerAddress;
gei.port = (uint)m_scene.RegionInfo.SyncServerPort;
if (!m_scene.GridService.RegisterEndpoint(gei))
{
m_log.ErrorFormat("{0}: Failure registering endpoint", LogHeader);
}
if (!m_scene.GridService.RegisterQuark(m_scene.RegionInfo.RegionID.ToString(),
m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY))
{
m_log.ErrorFormat("{0}: Failure registering quark", LogHeader);
}
return info; return info;
} }
@ -897,6 +916,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
string addr = m_scene.RegionInfo.SyncServerAddress; string addr = m_scene.RegionInfo.SyncServerAddress;
int port = m_scene.RegionInfo.SyncServerPort; int port = m_scene.RegionInfo.SyncServerPort;
// if the address is not specified in the region configuration file, get it from the grid service
if (addr.Equals(IPAddrUnknown))
{
List<GridEndpointInfo> lgei = m_scene.GridService.LookupQuark(
m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY, "scene_persistence");
if (lgei == null || lgei.Count != 1)
{
m_log.ErrorFormat("{0}: Failed to find quark persistence actor", LogHeader);
addr = IPAddrUnknown;
port = PortUnknown;
}
else
{
GridEndpointInfo gei = lgei[0];
addr = gei.address;
port = (int)gei.port;
m_log.WarnFormat("{0}: Found quark ({1}/{2}) persistence actor at {3}:{4}", LogHeader,
m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY,
addr, port.ToString());
}
}
if (!addr.Equals(IPAddrUnknown) && port != PortUnknown) if (!addr.Equals(IPAddrUnknown) && port != PortUnknown)
{ {
RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port);

View File

@ -74,6 +74,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is. //register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is.
m_scene.RegisterModuleInterface<IDSGActorSyncModule>(this); m_scene.RegisterModuleInterface<IDSGActorSyncModule>(this);
// register actor
if (!scene.GridService.RegisterActor(scene.RegionInfo.RegionID.ToString(),
"scene_persistence", scene.RegionInfo.RegionID.ToString()))
{
m_log.ErrorFormat("{0}: Failure registering actor", LogHeader);
}
// Setup the command line interface // Setup the command line interface
//m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; //m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
//InstallInterfaces(); //InstallInterfaces();

View File

@ -256,5 +256,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
} }
} }
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public bool RegisterEndpoint(GridEndpointInfo gei)
{
return m_GridService.RegisterEndpoint(gei);
}
public bool RegisterActor(string actorID, string actorType, string syncServerID)
{
return m_GridService.RegisterActor(actorID, actorType, syncServerID);
}
public bool RegisterQuark(string syncServerID, uint locX, uint locY)
{
return m_GridService.RegisterQuark(syncServerID, locX, locY);
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY)
{
return m_GridService.LookupQuark(locX, locY);
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType)
{
return m_GridService.LookupQuark(locX, locY, actorType);
}
public bool CleanUpEndpoint(string syncServerID)
{
return m_GridService.CleanUpEndpoint(syncServerID);
}
#endregion SYNC SERVER
} }
} }

View File

@ -288,5 +288,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return flags; return flags;
} }
#endregion #endregion
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public bool RegisterEndpoint(GridEndpointInfo gei)
{
return m_RemoteGridService.RegisterEndpoint(gei);
}
public bool RegisterActor(string actorID, string actorType, string syncServerID)
{
return m_RemoteGridService.RegisterActor(actorID, actorType, syncServerID);
}
public bool RegisterQuark(string syncServerID, uint locX, uint locY)
{
return m_RemoteGridService.RegisterQuark(syncServerID, locX, locY);
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY)
{
return m_RemoteGridService.LookupQuark(locX, locY);
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType)
{
return m_RemoteGridService.LookupQuark(locX, locY, actorType);
}
public bool CleanUpEndpoint(string syncServerID)
{
return m_RemoteGridService.CleanUpEndpoint(syncServerID);
}
#endregion SYNC SERVER
} }
} }

View File

@ -653,5 +653,33 @@ namespace OpenSim.Services.Connectors
#endregion #endregion
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public bool RegisterEndpoint(GridEndpointInfo gei)
{
return false;
}
public bool RegisterActor(string actorID, string actorType, string syncServerID)
{
return false;
}
public bool RegisterQuark(string syncServerID, uint locX, uint locY)
{
return false;
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY)
{
return null;
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType)
{
return null;
}
public bool CleanUpEndpoint(string syncServerID)
{
return false;
}
#endregion SYNC SERVER
} }
} }

View File

@ -432,5 +432,157 @@ namespace OpenSim.Services.Connectors.SimianGrid
return region; return region;
} }
#region SYNC SERVER
public virtual bool RegisterEndpoint(GridEndpointInfo gei)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "AddEndpoint" },
{ "SyncServerID", gei.syncServerID },
{ "Address", gei.address },
{ "Port", gei.port.ToString() },
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
m_log.WarnFormat("{0}: Registration of endpoint {1} at addr={2}:{3} successful",
"[SIMIAN GRID CONNECTOR]", gei.syncServerID, gei.address, gei.port.ToString());
return true;
}
m_log.ErrorFormat("{0}: Registration of endpoint {1} at addr={2}:{3} failed: {4}",
"[SIMIAN GRID CONNECTOR]", gei.syncServerID, gei.address, gei.port.ToString(), response["Message"]);
return false;
}
public virtual bool RegisterActor(string actorID, string actorType, string syncServerID)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "AddActor" },
{ "ActorID", actorID },
{ "ActorType", actorType },
{ "SyncServerID", syncServerID },
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
m_log.WarnFormat("{0}: Registration of actor {1} of type {2} successful",
"[SIMIAN GRID CONNECTOR]", actorID, actorType);
return true;
}
m_log.ErrorFormat("{0}: Registration of actor {1} of type {2} failed: {3}",
"[SIMIAN GRID CONNECTOR]", actorID, actorType, response["Message"]);
return false;
return false;
}
public virtual bool RegisterQuark(string syncServerID, uint locX, uint locY)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "AddQuark" },
{ "SyncServerID", syncServerID },
{ "LocX", locX.ToString() },
{ "LocY", locY.ToString() },
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
m_log.WarnFormat("{0}: Registration of quark at {1}/{2} successful",
"[SIMIAN GRID CONNECTOR]", locX.ToString(), locY.ToString());
return true;
}
m_log.ErrorFormat("{0}: Registration of quark at {1}/{2} failed: {3}",
"[SIMIAN GRID CONNECTOR]", locX.ToString(), locY.ToString(), response["Message"]);
return false;
}
public virtual List<GridEndpointInfo> LookupQuark(uint locX, uint locY)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetQuark" },
{ "LocX", locX.ToString() },
{ "LocY", locY.ToString() }
};
return LookupQuark(requestArgs);
}
public virtual List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetQuark" },
{ "LocX", locX.ToString() },
{ "LocY", locY.ToString() },
{ "ActorType", actorType }
};
return LookupQuark(requestArgs);
}
private List<GridEndpointInfo> LookupQuark(NameValueCollection requestArgs)
{
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
List<GridEndpointInfo> lgai = new List<GridEndpointInfo>();
OSDArray gridEndpoints = (OSDArray)response["Endpoints"];
m_log.WarnFormat("{0}: Lookup of quark successful. {1} addresses",
"[SIMIAN GRID CONNECTOR]", gridEndpoints.Count);
for (int ii = 0; ii < gridEndpoints.Count; ii++)
{
OSDMap thisEndpoint = (OSDMap)gridEndpoints[ii];
GridEndpointInfo gai = new GridEndpointInfo();
gai.syncServerID = thisEndpoint["SyncServerID"].AsString();
gai.actorType = thisEndpoint["ActorType"].AsString();
gai.address = thisEndpoint["Address"].AsString();
gai.port = (uint)thisEndpoint["Port"].AsInteger();
lgai.Add(gai);
}
return lgai;
}
m_log.ErrorFormat("{0}: Lookup of quark failed: {1}",
"[SIMIAN GRID CONNECTOR]", response["Message"]);
return null;
}
// Clean up the information for this endpoint. Removes both the endpoint
// information from the Endpoint table but also removes ALL the quarks associated
// with the endpoint.
public virtual bool CleanUpEndpoint(string syncServerID)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "RemoveEndpoint" },
{ "SyncServerID", syncServerID },
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
requestArgs = new NameValueCollection
{
{ "RequestMethod", "RemoveQuark" },
{ "SyncServerID", syncServerID },
};
response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
return true;
}
m_log.ErrorFormat("{0}: removal of quarks for Endpoint failed: {1}",
"[SIMIAN GRID CONNECTOR]", response["Message"]);
return false;
}
m_log.ErrorFormat("{0}: removal of Endpoint failed: {1}",
"[SIMIAN GRID CONNECTOR]", response["Message"]);
return false;
}
#endregion SYNC SERVER
} }
} }

View File

@ -548,5 +548,33 @@ namespace OpenSim.Services.GridService
m_Database.Store(r); m_Database.Store(r);
} }
} }
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public bool RegisterEndpoint(GridEndpointInfo gei)
{
return false;
}
public bool RegisterActor(string actorID, string actorType, string syncServerID)
{
return false;
}
public bool RegisterQuark(string syncServerID, uint locX, uint locY)
{
return false;
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY)
{
return null;
}
public List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType)
{
return null;
}
public bool CleanUpEndpoint(string syncServerID)
{
return false;
}
#endregion SYNC SERVER
} }
} }

View File

@ -95,8 +95,29 @@ namespace OpenSim.Services.Interfaces
List<GridRegion> GetHyperlinks(UUID scopeID); List<GridRegion> GetHyperlinks(UUID scopeID);
int GetRegionFlags(UUID scopeID, UUID regionID); int GetRegionFlags(UUID scopeID, UUID regionID);
// SYNC SERVER
bool RegisterEndpoint(GridEndpointInfo gei);
bool RegisterActor(string actorID, string actorType, string syncServerID);
bool RegisterQuark(string syncServerID, uint locX, uint locY);
List<GridEndpointInfo> LookupQuark(uint locX, uint locY);
List<GridEndpointInfo> LookupQuark(uint locX, uint locY, string actorType);
bool CleanUpEndpoint(string syncServerID);
// END SYNC SERVER
} }
// SYNC SERVER
public class GridEndpointInfo
{
public string syncServerID;
public string address;
public uint port;
public string internalAddress;
public uint internalPort;
public string actorType;
}
// END SYNC SERVER
public class GridRegion : Object public class GridRegion : Object
{ {