From 23fb4f22216c85adb9ca4b308c73bfb821440bd3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 21:12:25 +0000 Subject: Add "region get" command as a synononym for "show region" console command. This matches existing similar commands and a soon to be added "region set" command. --- OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index 95eca39..c2be5c5 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -87,6 +87,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "Regions", false, "show region", "show region", "Show control information for the currently selected region (host name, max physical prim size, etc).", + "A synonym for \"region get\"", + HandleShowRegion); + + m_console.Commands.AddCommand( + "Regions", false, "region get", + "region get", + "Show control information for the currently selected region (host name, max physical prim size, etc).", + "Some parameters can be set with the \"region set\" command.\n" + + "Others must be changed via a viewer (usually via the region/estate dialog box).", HandleShowRegion); } -- cgit v1.1 From a05be7bd651fb48b522af1ee94e0aa602ceb480a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 21:44:31 +0000 Subject: Add "region set" console command. This current allows one to set two region parameters agent-limit will set the current root agent limit for the region, as also settable through the viewer, though some impose a max setting (e.g. 100). max-agent-limit will set the maximum allowed root agent limit. This can also be set via the MaxAgent parameter in region config. --- OpenSim/Framework/RegionInfo.cs | 12 ++-- .../World/Region/RegionCommandsModule.cs | 74 +++++++++++++++++++++- 2 files changed, 77 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 5911ade..cae5e51 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -127,7 +127,6 @@ namespace OpenSim.Framework private int m_objectCapacity = 0; private int m_maxPrimsPerUser = -1; private int m_linksetCapacity = 0; - private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); protected uint m_httpPort; @@ -351,10 +350,7 @@ namespace OpenSim.Framework get { return m_linksetCapacity; } } - public int AgentCapacity - { - get { return m_agentCapacity; } - } + public int AgentCapacity { get; set; } public byte AccessLevel { @@ -748,7 +744,7 @@ namespace OpenSim.Framework #endregion - m_agentCapacity = config.GetInt("MaxAgents", 100); + AgentCapacity = config.GetInt("MaxAgents", 100); allKeys.Remove("MaxAgents"); // Multi-tenancy @@ -864,8 +860,8 @@ namespace OpenSim.Framework if (m_linksetCapacity > 0) config.Set("LinksetPrims", m_linksetCapacity); - if (m_agentCapacity > 0) - config.Set("MaxAgents", m_agentCapacity); + if (AgentCapacity > 0) + config.Set("MaxAgents", AgentCapacity); if (ScopeID != UUID.Zero) config.Set("ScopeID", ScopeID.ToString()); diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index c2be5c5..b0caaf9 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -97,6 +97,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "Some parameters can be set with the \"region set\" command.\n" + "Others must be changed via a viewer (usually via the region/estate dialog box).", HandleShowRegion); + + m_console.Commands.AddCommand( + "Regions", false, "region set", + "region get", + "Set control information for the currently selected region.", + "Currently, the following parameters can be set:\n" + + "agent-limit - Current root agent limit.\n" + + "max-agent-limit - Maximum root agent limit. agent-limit cannot exceed this.", + HandleRegionSet); } public void RemoveRegion(Scene scene) @@ -132,8 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands dispList.AddRow("External endpoint", ri.ExternalEndPoint); dispList.AddRow("Internal endpoint", ri.InternalEndPoint); dispList.AddRow("Access level", ri.AccessLevel); + dispList.AddRow("Agent limit", rs.AgentLimit); dispList.AddRow("Max agent limit", ri.AgentCapacity); - dispList.AddRow("Current agent limit", rs.AgentLimit); dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString()); dispList.AddRow("Prim capacity", ri.ObjectCapacity); dispList.AddRow("Prim bonus", rs.ObjectBonus); @@ -175,6 +184,69 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands MainConsole.Instance.Output(sb.ToString()); } + private void HandleRegionSet(string module, string[] args) + { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + if (args.Length != 4) + { + MainConsole.Instance.OutputFormat("Usage: region set "); + return; + } + + string param = args[2]; + string rawValue = args[3]; + + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + RegionInfo ri = m_scene.RegionInfo; + RegionSettings rs = ri.RegionSettings; + + if (param == "agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + if (newValue > ri.AgentCapacity) + { + MainConsole.Instance.OutputFormat( + "Cannot set {0} to {1} in {2} as max-agent-limit is {3}", "agent-limit", + newValue, m_scene.Name, ri.AgentCapacity); + } + else + { + rs.AgentLimit = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name); + } + } + else if (param == "max-agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + ri.AgentCapacity = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "max-agent-limit", newValue, m_scene.Name); + + if (ri.AgentCapacity < rs.AgentLimit) + { + rs.AgentLimit = ri.AgentCapacity; + + MainConsole.Instance.OutputFormat( + "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name); + } + } + } + private void HandleShowScene(string module, string[] cmd) { if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) -- cgit v1.1 From f0843209762127c25a16feb51f5494f560171b35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 22:32:35 +0000 Subject: Actually persist a changed console set agent-limit via "region set". Unfortunately, it's not currently easy to do this with "max-agent-limit" - this must be separately set as MaxAgents in region config if it's to persist over restarts. --- OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index b0caaf9..710c8da 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -103,8 +103,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "region get", "Set control information for the currently selected region.", "Currently, the following parameters can be set:\n" - + "agent-limit - Current root agent limit.\n" - + "max-agent-limit - Maximum root agent limit. agent-limit cannot exceed this.", + + "agent-limit - Current root agent limit. This is persisted over restart.\n" + + "max-agent-limit - Maximum root agent limit. agent-limit cannot exceed this." + + " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.", HandleRegionSet); } @@ -224,6 +225,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands MainConsole.Instance.OutputFormat( "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name); } + + rs.Save(); } else if (param == "max-agent-limit") { @@ -244,6 +247,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands MainConsole.Instance.OutputFormat( "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name); } + + rs.Save(); } } -- cgit v1.1