Now does allow GridService from other instance
This commit is contained in:
@@ -36,12 +36,16 @@ using Nini.Config;
|
|||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Services.Base;
|
using OpenSim.Services.Base;
|
||||||
|
using OpenSim.Server.Base;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
|
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Server.Handlers.Grid
|
namespace OpenSim.Server.Handlers.Grid
|
||||||
{
|
{
|
||||||
public class GridInfoHandlers
|
public class GridInfoHandlers
|
||||||
@@ -55,7 +59,7 @@ namespace OpenSim.Server.Handlers.Grid
|
|||||||
private byte[] cachedStatAnswer = null;
|
private byte[] cachedStatAnswer = null;
|
||||||
private bool stats_available = false;
|
private bool stats_available = false;
|
||||||
private int _lastrun;
|
private int _lastrun;
|
||||||
protected IRegionData m_Database_regions = null;
|
protected IGridService m_GridService = null;
|
||||||
protected IGridUserData m_Database_griduser = null;
|
protected IGridUserData m_Database_griduser = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,30 +89,35 @@ namespace OpenSim.Server.Handlers.Grid
|
|||||||
if (stats_available)
|
if (stats_available)
|
||||||
{
|
{
|
||||||
stats_available = false;
|
stats_available = false;
|
||||||
IConfig dbConfig = configSource.Configs["DatabaseService"];
|
string gridService = gridCfg.GetString("GridService", string.Empty);
|
||||||
if (dbConfig is not null)
|
if (!string.IsNullOrWhiteSpace(gridService))
|
||||||
{
|
{
|
||||||
ServiceBase serviceBase = new(configSource);
|
object[] args = new object[] { configSource };
|
||||||
string dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||||
string connString = dbConfig.GetString("ConnectionString", String.Empty);
|
if (m_GridService != null)
|
||||||
|
|
||||||
if (dllName.Length != 0 && connString.Length != 0)
|
|
||||||
{
|
{
|
||||||
m_Database_regions = serviceBase.LoadPlugin<IRegionData>(dllName, [connString, "regions"]);
|
IConfig dbConfig = configSource.Configs["DatabaseService"];
|
||||||
if(m_Database_regions != null)
|
if (dbConfig is not null)
|
||||||
{
|
{
|
||||||
m_Database_griduser = serviceBase.LoadPlugin<IGridUserData>(dllName, [connString, "GridUser"]);
|
ServiceBase serviceBase = new(configSource);
|
||||||
if (m_Database_griduser != null)
|
string dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||||
|
string connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||||
|
|
||||||
|
if (dllName.Length != 0 && connString.Length != 0)
|
||||||
{
|
{
|
||||||
stats_available = true;
|
m_Database_griduser = serviceBase.LoadPlugin<IGridUserData>(dllName, [connString, "GridUser"]);
|
||||||
_log.Debug("[GRID INFO SERVICE]: Grid Stats enabled");
|
if (m_Database_griduser != null)
|
||||||
|
{
|
||||||
|
stats_available = true;
|
||||||
|
_log.Debug("[GRID INFO SERVICE]: Grid Stats enabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stats_available)
|
if (!stats_available)
|
||||||
{
|
{
|
||||||
_log.Warn("[GRID INFO SERVICE]: Could not find or initialize Database Service config. Grid stats will be unavailable!");
|
_log.Warn("[GRID INFO SERVICE]: Could not initialize. Grid stats will be unavailable!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,13 +283,16 @@ namespace OpenSim.Server.Handlers.Grid
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Fetch region data
|
// Fetch region data
|
||||||
List<RegionData> regions = m_Database_regions.GetOnlineRegions(UUID.Zero);
|
if (m_GridService is not null)
|
||||||
foreach (RegionData region in regions)
|
|
||||||
{
|
{
|
||||||
// Count individual region equivalent
|
List<GridRegion> regions = m_GridService.GetOnlineRegions(UUID.Zero, 0, 0, int.MaxValue);
|
||||||
region_count += (region.sizeX * region.sizeY) >> 16;
|
foreach (GridRegion region in regions)
|
||||||
|
{
|
||||||
|
// Count individual region equivalent
|
||||||
|
region_count += (region.RegionSizeX * region.RegionSizeY) >> 16;
|
||||||
|
}
|
||||||
|
regions = null;
|
||||||
}
|
}
|
||||||
regions = null;
|
|
||||||
|
|
||||||
// Fetch all grid users, can't do a simple query unfortunately
|
// Fetch all grid users, can't do a simple query unfortunately
|
||||||
GridUserData[] gridusers = m_Database_griduser.GetAll(string.Empty);
|
GridUserData[] gridusers = m_Database_griduser.GetAll(string.Empty);
|
||||||
|
|||||||
@@ -640,6 +640,8 @@
|
|||||||
|
|
||||||
|
|
||||||
[GridInfoService]
|
[GridInfoService]
|
||||||
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
|
|
||||||
; These settings are used to return information on a get_grid_info call.
|
; These settings are used to return information on a get_grid_info call.
|
||||||
; Client launcher scripts and third-party clients make use of this to
|
; Client launcher scripts and third-party clients make use of this to
|
||||||
; autoconfigure the client and to provide a nice user experience. If you
|
; autoconfigure the client and to provide a nice user experience. If you
|
||||||
|
|||||||
@@ -561,6 +561,8 @@
|
|||||||
|
|
||||||
|
|
||||||
[GridInfoService]
|
[GridInfoService]
|
||||||
|
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||||
|
|
||||||
; These settings are used to return information on a get_grid_info call.
|
; These settings are used to return information on a get_grid_info call.
|
||||||
; Client launcher scripts and third-party clients make use of this to
|
; Client launcher scripts and third-party clients make use of this to
|
||||||
; autoconfigure the client and to provide a nice user experience. If you
|
; autoconfigure the client and to provide a nice user experience. If you
|
||||||
|
|||||||
Reference in New Issue
Block a user