From 5145356467244d6a4d66cd36eef22a23d6fc73a1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 13 Jun 2012 03:49:22 +0100 Subject: [PATCH] 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(+) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 8a60ca5467..11897f8809 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -84,6 +84,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 ", @@ -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)