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
0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-13 03:49:22 +01:00
parent 4859bc8c49
commit cb518ad68c
1 changed files with 45 additions and 0 deletions

View File

@ -84,6 +84,13 @@ namespace OpenSim.Services.GridService
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region",
"deregister region <Region UUID>",
"Deregister a region manually.",
String.Empty,
HandleDeregisterRegion);
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show region",
"show region <Region name>",
@ -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 <Region UUID>");
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)