diff options
author | Justin Clark-Casey (justincc) | 2010-10-16 05:38:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-10-16 05:38:44 +0100 |
commit | e41b23a1a4bef55d31f75e1227834da84cbd971a (patch) | |
tree | cf0a44403f242cd1aab6beee900e71e73fe0eff0 | |
parent | Have OpenSim throw a strop if it tries to load an OAR with a major version th... (diff) | |
download | opensim-SC-e41b23a1a4bef55d31f75e1227834da84cbd971a.zip opensim-SC-e41b23a1a4bef55d31f75e1227834da84cbd971a.tar.gz opensim-SC-e41b23a1a4bef55d31f75e1227834da84cbd971a.tar.bz2 opensim-SC-e41b23a1a4bef55d31f75e1227834da84cbd971a.tar.xz |
change --old-guids switch on the save oar command line to --version=<x>
if x is 0, then an old version 0.3 archive is saved. If it is anything else or missing, then a version 1.0 archive is saved
version 1.0 archives cannot be loaded on OpenSim 0.7.0.2 and earlier
also add various informational notices about what version we've saving/loading
6 files changed, 33 insertions, 11 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 0c6f476..66ffd76 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -264,11 +264,11 @@ namespace OpenSim | |||
264 | LoadOar); | 264 | LoadOar); |
265 | 265 | ||
266 | m_console.Commands.AddCommand("region", false, "save oar", | 266 | m_console.Commands.AddCommand("region", false, "save oar", |
267 | "save oar [--old-guids] [<OAR path>]", | 267 | "save oar [--version=<version>] [<OAR path>]", |
268 | "Save a region's data to an OAR archive.", | 268 | "Save a region's data to an OAR archive.", |
269 | "The OAR path must be a filesystem path." | 269 | "The OAR path must be a filesystem path." |
270 | + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine | 270 | + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine |
271 | + "--old-guids produces OARs compatible with older (pre 0.7.1) OpenSim versions.", | 271 | + "--version=0 produces old version 0.3 OARs that are compatible with OpenSim 0.7.0.2 and earlier. Current OAR version is 1.0. This version of OpenSim can load any OAR later than version 0.3", |
272 | SaveOar); | 272 | SaveOar); |
273 | 273 | ||
274 | m_console.Commands.AddCommand("region", false, "edit scale", | 274 | m_console.Commands.AddCommand("region", false, "edit scale", |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f1f5258..ae6e596 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
56 | /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version | 56 | /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version |
57 | /// bumps here should be compatible. | 57 | /// bumps here should be compatible. |
58 | /// </summary> | 58 | /// </summary> |
59 | public static int MAX_MAJOR_VERSION = 0; | 59 | public static int MAX_MAJOR_VERSION = 1; |
60 | 60 | ||
61 | protected Scene m_scene; | 61 | protected Scene m_scene; |
62 | protected Stream m_loadStream; | 62 | protected Stream m_loadStream; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index d1fe1f5..79bec56 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -137,12 +137,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
137 | 137 | ||
138 | m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); | 138 | m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); |
139 | 139 | ||
140 | Dictionary<string, object> serializationOptions = new Dictionary<string, object>(); | ||
141 | if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") | ||
142 | serializationOptions["old-guids"] = true; | ||
143 | |||
140 | // Write out scene object metadata | 144 | // Write out scene object metadata |
141 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) | 145 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) |
142 | { | 146 | { |
143 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); | 147 | //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); |
144 | 148 | ||
145 | string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); | 149 | string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); |
146 | m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); | 150 | m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); |
147 | } | 151 | } |
148 | 152 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index bae1bdd..d21efed 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
172 | m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); | 172 | m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); |
173 | 173 | ||
174 | // Write out control file | 174 | // Write out control file |
175 | archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); | 175 | archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); |
176 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | 176 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); |
177 | 177 | ||
178 | new AssetsRequest( | 178 | new AssetsRequest( |
@@ -184,15 +184,33 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
184 | /// Create the control file for the most up to date archive | 184 | /// Create the control file for the most up to date archive |
185 | /// </summary> | 185 | /// </summary> |
186 | /// <returns></returns> | 186 | /// <returns></returns> |
187 | public static string Create0p2ControlFile() | 187 | public static string Create0p2ControlFile(Dictionary<string, object> options) |
188 | { | 188 | { |
189 | int majorVersion, minorVersion; | ||
190 | if (options.ContainsKey("version") && (string)options["version"] == "0") | ||
191 | { | ||
192 | majorVersion = 0; | ||
193 | minorVersion = 3; | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | majorVersion = 1; | ||
198 | minorVersion = 0; | ||
199 | } | ||
200 | |||
201 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); | ||
202 | if (majorVersion == 1) | ||
203 | { | ||
204 | m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); | ||
205 | } | ||
206 | |||
189 | StringWriter sw = new StringWriter(); | 207 | StringWriter sw = new StringWriter(); |
190 | XmlTextWriter xtw = new XmlTextWriter(sw); | 208 | XmlTextWriter xtw = new XmlTextWriter(sw); |
191 | xtw.Formatting = Formatting.Indented; | 209 | xtw.Formatting = Formatting.Indented; |
192 | xtw.WriteStartDocument(); | 210 | xtw.WriteStartDocument(); |
193 | xtw.WriteStartElement("archive"); | 211 | xtw.WriteStartElement("archive"); |
194 | xtw.WriteAttributeString("major_version", "0"); | 212 | xtw.WriteAttributeString("major_version", majorVersion.ToString()); |
195 | xtw.WriteAttributeString("minor_version", "3"); | 213 | xtw.WriteAttributeString("minor_version", minorVersion.ToString()); |
196 | 214 | ||
197 | xtw.WriteStartElement("creation_info"); | 215 | xtw.WriteStartElement("creation_info"); |
198 | DateTime now = DateTime.UtcNow; | 216 | DateTime now = DateTime.UtcNow; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 98bdcd0..e0ad71e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
125 | Dictionary<string, object> options = new Dictionary<string, object>(); | 125 | Dictionary<string, object> options = new Dictionary<string, object>(); |
126 | 126 | ||
127 | OptionSet ops = new OptionSet(); | 127 | OptionSet ops = new OptionSet(); |
128 | ops.Add("old|old-guids", delegate(string v) { options["old-guids"] = (v != null); }); | 128 | ops.Add("v|version=", delegate(string v) { options["version"] = v; }); |
129 | 129 | ||
130 | List<string> mainParams = ops.Parse(cmdparams); | 130 | List<string> mainParams = ops.Parse(cmdparams); |
131 | 131 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index b72cd02..04bdc4f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
230 | // upset load | 230 | // upset load |
231 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 231 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
232 | 232 | ||
233 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); | 233 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary<string, Object>())); |
234 | 234 | ||
235 | SceneObjectPart part1 = CreateSceneObjectPart1(); | 235 | SceneObjectPart part1 = CreateSceneObjectPart1(); |
236 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | 236 | SceneObjectGroup object1 = new SceneObjectGroup(part1); |
@@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
329 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 329 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
330 | 330 | ||
331 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 331 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
332 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); | 332 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary<string, Object>())); |
333 | 333 | ||
334 | RegionSettings rs = new RegionSettings(); | 334 | RegionSettings rs = new RegionSettings(); |
335 | rs.AgentLimit = 17; | 335 | rs.AgentLimit = 17; |