From 050007b44da97bf155fca95cadc32cb27924e263 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 02:30:16 +0100 Subject: Lay out "show region" information in an easier to read line by line format --- OpenSim/Services/GridService/GridService.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 3dc87bc..b17fca7 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -509,19 +509,21 @@ namespace OpenSim.Services.GridService return; } - MainConsole.Instance.Output("Region Name Region UUID"); - MainConsole.Instance.Output("Location URI"); - MainConsole.Instance.Output("Owner ID Flags"); - MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + ICommandConsole con = MainConsole.Instance; + foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", - r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), - r.Data["serverURI"], - r.Data["owner_uuid"], flags)); + + con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); + con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); + con.OutputFormat("{0,-11}: {1}", "Location", r.coordX, r.coordY); + con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); + con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); + con.OutputFormat("{0,-11}: {1}", "Flags", flags); + con.Output("\n"); } + return; } -- cgit v1.1 From c6ce41bfbab310eae2366ad494a0dbb42cebc070 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 02:31:53 +0100 Subject: Add missing Y co-ord in "show region" console command information --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b17fca7..9d81eb5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -517,7 +517,7 @@ namespace OpenSim.Services.GridService con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); - con.OutputFormat("{0,-11}: {1}", "Location", r.coordX, r.coordY); + con.OutputFormat("{0,-11}: {1},{2}", "Location", r.coordX, r.coordY); con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); con.OutputFormat("{0,-11}: {1}", "Flags", flags); -- cgit v1.1 From 059a1e90b92c3c1ca027c0ec59f3628d87a954a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 03:19:25 +0100 Subject: Add ConsoleDisplayList for more consistent formatting of console output in list form. Convert "show region" to use this structure rather than hand-constructing --- OpenSim/Services/GridService/GridService.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 9d81eb5..8a60ca5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -509,19 +509,19 @@ namespace OpenSim.Services.GridService return; } - ICommandConsole con = MainConsole.Instance; - foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); - con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); - con.OutputFormat("{0,-11}: {1},{2}", "Location", r.coordX, r.coordY); - con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); - con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); - con.OutputFormat("{0,-11}: {1}", "Flags", flags); - con.Output("\n"); + ConsoleDisplayList dispList = new ConsoleDisplayList(); + dispList.AddRow("Region Name", r.RegionName); + dispList.AddRow("Region ID", r.RegionID); + dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("URI", r.Data["serverURI"]); + dispList.AddRow("Owner ID", r.Data["owner_uuid"]); + dispList.AddRow("Flags", flags); + + MainConsole.Instance.Output(dispList.ToString()); } return; -- cgit v1.1 From 5145356467244d6a4d66cd36eef22a23d6fc73a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jun 2012 03:49:22 +0100 Subject: Add "deregister region" by uuid command to grid service to allow manual deregistration of simulators. Useful if a simulator has crashed without removing its regions and those regions have been reconfigured differently --- OpenSim/Services/GridService/GridService.cs | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 8a60ca5..11897f8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -85,6 +85,13 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("Regions", true, + "deregister region", + "deregister region ", + "Deregister a region manually.", + String.Empty, + HandleDeregisterRegion); + + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region", "show region ", "Show details on a region", @@ -495,6 +502,44 @@ namespace OpenSim.Services.GridService return -1; } + private void HandleDeregisterRegion(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.Output("Syntax: degregister region "); + return; + } + + string rawRegionUuid = cmd[2]; + UUID regionUuid; + + if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + { + MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); + return; + } + + GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); + + if (region == null) + { + MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); + return; + } + + if (DeregisterRegion(regionUuid)) + { + MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); + } + else + { + // I don't think this can ever occur if we know that the region exists. + MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + } + + return; + } + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 3) -- cgit v1.1 From 854f2a913cdedfa252b69d5c3118d35604ab6b4a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 25 Jun 2012 23:55:14 +0100 Subject: Add "show region at" command to grid service to get the details of a region at a specific location. "show region" command becomes "show region name" to disambiguate This is the same format as used by "show object name", etc. "deregister region" also becomes "deregister region id" --- OpenSim/Services/GridService/GridService.cs | 91 ++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 22 deletions(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 11897f8..7d2dadb 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -85,20 +85,27 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("Regions", true, - "deregister region", - "deregister region ", + "deregister region id", + "deregister region id ", "Deregister a region manually.", String.Empty, HandleDeregisterRegion); MainConsole.Instance.Commands.AddCommand("Regions", true, - "show region", - "show region ", + "show region name", + "show region name ", "Show details on a region", String.Empty, HandleShowRegion); MainConsole.Instance.Commands.AddCommand("Regions", true, + "show region at", + "show region at ", + "Show details on a region at the given co-ordinate.", + "For example, show region at 1000 1000", + HandleShowRegionAt); + + MainConsole.Instance.Commands.AddCommand("Regions", true, "set region flags", "set region flags ", "Set database flags for region", @@ -504,13 +511,13 @@ namespace OpenSim.Services.GridService private void HandleDeregisterRegion(string module, string[] cmd) { - if (cmd.Length != 3) + if (cmd.Length != 4) { - MainConsole.Instance.Output("Syntax: degregister region "); + MainConsole.Instance.Output("Syntax: degregister region id "); return; } - string rawRegionUuid = cmd[2]; + string rawRegionUuid = cmd[3]; UUID regionUuid; if (!UUID.TryParse(rawRegionUuid, out regionUuid)) @@ -542,34 +549,74 @@ namespace OpenSim.Services.GridService private void HandleShowRegion(string module, string[] cmd) { - if (cmd.Length != 3) + if (cmd.Length != 4) { - MainConsole.Instance.Output("Syntax: show region "); + MainConsole.Instance.Output("Syntax: show region name "); return; } - List regions = m_Database.Get(cmd[2], UUID.Zero); + + string regionName = cmd[3]; + + List regions = m_Database.Get(regionName, UUID.Zero); if (regions == null || regions.Count < 1) { - MainConsole.Instance.Output("Region not found"); + MainConsole.Instance.Output("No region with name {0} found", regionName); return; } - foreach (RegionData r in regions) + OutputRegionsToConsole(regions); + } + + private void HandleShowRegionAt(string module, string[] cmd) + { + if (cmd.Length != 5) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + MainConsole.Instance.Output("Syntax: show region at "); + return; + } - ConsoleDisplayList dispList = new ConsoleDisplayList(); - dispList.AddRow("Region Name", r.RegionName); - dispList.AddRow("Region ID", r.RegionID); - dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); - dispList.AddRow("URI", r.Data["serverURI"]); - dispList.AddRow("Owner ID", r.Data["owner_uuid"]); - dispList.AddRow("Flags", flags); + int x, y; + if (!int.TryParse(cmd[3], out x)) + { + MainConsole.Instance.Output("x-coord must be an integer"); + return; + } - MainConsole.Instance.Output(dispList.ToString()); + if (!int.TryParse(cmd[4], out y)) + { + MainConsole.Instance.Output("y-coord must be an integer"); + return; } - return; + RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero); + if (region == null) + { + MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); + return; + } + + OutputRegionToConsole(region); + } + + private void OutputRegionToConsole(RegionData r) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + + ConsoleDisplayList dispList = new ConsoleDisplayList(); + dispList.AddRow("Region Name", r.RegionName); + dispList.AddRow("Region ID", r.RegionID); + dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("URI", r.Data["serverURI"]); + dispList.AddRow("Owner ID", r.Data["owner_uuid"]); + dispList.AddRow("Flags", flags); + + MainConsole.Instance.Output(dispList.ToString()); + } + + private void OutputRegionsToConsole(List regions) + { + foreach (RegionData r in regions) + OutputRegionToConsole(r); } private int ParseFlags(int prev, string flags) -- cgit v1.1 From 5292b8b8be85696604f4f8086376da568b8342b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 00:34:37 +0100 Subject: Add "show regions" console command to ROBUST to show all regions currently registered. Command is not added in standalone, which has its own version of "show regions" that can also show estate name --- OpenSim/Services/GridService/GridService.cs | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7d2dadb..e4c3246 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -91,6 +91,18 @@ namespace OpenSim.Services.GridService String.Empty, HandleDeregisterRegion); + // A messy way of stopping this command being added if we are in standalone (since the simulator + // has an identically named command + // + // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. + if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) + MainConsole.Instance.Commands.AddCommand("Regions", true, + "show regions", + "show all regions", + "Show details on all regions", + String.Empty, + HandleShowRegions); + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region name", "show region name ", @@ -547,6 +559,20 @@ namespace OpenSim.Services.GridService return; } + private void HandleShowRegions(string module, string[] cmd) + { + if (cmd.Length != 2) + { + MainConsole.Instance.Output("Syntax: show regions"); + return; + } + + List regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); + + OutputRegionsToConsoleSummary(regions); + } + + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 4) @@ -619,6 +645,24 @@ namespace OpenSim.Services.GridService OutputRegionToConsole(r); } + private void OutputRegionsToConsoleSummary(List regions) + { + ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); + + foreach (RegionData r in regions) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + dispTable.Rows.Add( + new ConsoleDisplayTableRow(new List { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); + } + + MainConsole.Instance.Output(dispTable.ToString()); + } + private int ParseFlags(int prev, string flags) { OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; -- cgit v1.1 From 1f22b29ca3d172624087185a4e9056a931f19703 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 00:40:46 +0100 Subject: Add much easier ConsoleDisplayTable AddColumn() and AddRow() methods. Use these for new "show regions" command rather than old cumbersome stuff. --- OpenSim/Services/GridService/GridService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e4c3246..842a697 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -648,16 +648,15 @@ namespace OpenSim.Services.GridService private void OutputRegionsToConsoleSummary(List regions) { ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); + dispTable.AddColumn("Name", 16); + dispTable.AddColumn("ID", 36); + dispTable.AddColumn("Owner ID", 36); + dispTable.AddColumn("Flags", 60); foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - dispTable.Rows.Add( - new ConsoleDisplayTableRow(new List { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); + dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString()); } MainConsole.Instance.Output(dispTable.ToString()); -- cgit v1.1 From 25245179868990b07d4431e2dc2e800a4de372e5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 22:54:41 +0100 Subject: minor: correct GridService "show regions" cibsike cinnabd usage statement --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 842a697..36cd573 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -98,7 +98,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) MainConsole.Instance.Commands.AddCommand("Regions", true, "show regions", - "show all regions", + "show regions", "Show details on all regions", String.Empty, HandleShowRegions); -- cgit v1.1 From 97437feb06060fa58f8209e32c362bfe91c279f5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 23:05:10 +0100 Subject: Show region positions in "show regions" robust console command --- OpenSim/Services/GridService/GridService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService/GridService.cs') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 36cd573..aab403a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -650,13 +650,19 @@ namespace OpenSim.Services.GridService ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); dispTable.AddColumn("Name", 16); dispTable.AddColumn("ID", 36); + dispTable.AddColumn("Position", 11); dispTable.AddColumn("Owner ID", 36); dispTable.AddColumn("Flags", 60); foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString()); + dispTable.AddRow( + r.RegionName, + r.RegionID.ToString(), + string.Format("{0},{1}", r.coordX, r.coordY), + r.Data["owner_uuid"].ToString(), + flags.ToString()); } MainConsole.Instance.Output(dispTable.ToString()); -- cgit v1.1