Roy Golan has uploaded a new change for review.
Change subject: core: osinfo - fix 2008 sysprep index type
......................................................................
core: osinfo - fix 2008 sysprep index type
1.sypsrep index for 2008 an onward is String now
2.dump the osinfo internals to debug log now
(enable debug on org.ovirt.engine.core.utils)
output example:
os.rhel_6.derivedFrom
value=rhel_5
os.rhel_6.devices.audio
value=ich6
os.rhel_6.devices.diskInterfaces
value.3.3=IDE, VirtIO_SCSI, VirtIO
value.3.4=IDE, VirtIO_SCSI, VirtIO
os.rhel_6.id
value=18
os.rhel_6.name
value=Red Hat Enterprise Linux 6.x
Bug-Url: https://bugzilla.redhat.com/1069096
Change-Id: I28898444de5da404bc8fb20cd2fa134e6ff6d83f
Signed-off-by: Roy Golan <[email protected]>
(cherry picked from commit 078c160067198071f51c9ac097e0dac3a6fb6a25)
---
M
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java
M
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/OsRepositoryImplTest.java
M packaging/conf/osinfo-defaults.properties
3 files changed, 51 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/26007/1
diff --git
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java
index 7e40127..d4ec245 100644
---
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java
+++
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java
@@ -58,6 +58,9 @@
buildIdToUnameLookup();
buildBackCompatMapping();
validateTree();
+ if (log.isDebugEnabled()) {
+ log.debugFormat("Osinfo Repository:\n {0}", toString());
+ }
}
private void validateTree() {
@@ -523,4 +526,37 @@
public Map<ArchitectureType, Integer> getDefaultOSes() {
return defaultOsMap;
}
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ try {
+ walkTree(sb, preferences);
+ } catch (BackingStoreException e) {
+ log.error(e.getStackTrace());
+ }
+ return sb.toString();
+ }
+
+ private void walkTree(StringBuilder sb, Preferences node) throws
BackingStoreException {
+ if (node.childrenNames().length == 0) {
+ sb.append(
+ node.absolutePath()
+ .replaceFirst("/", "")
+ .replace("/", "."));
+ for (String k : node.keys()) {
+ sb.append("\n\t")
+ .append(k)
+ .append("=")
+ .append(node.get(k, ""));
+ }
+ sb.append("\n");
+ } else {
+ for (String nodePath : node.childrenNames()) {
+ walkTree(sb, node.node(nodePath));
+ }
+ }
+
+ }
}
diff --git
a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/OsRepositoryImplTest.java
b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/OsRepositoryImplTest.java
index ef94a3c..dd66445 100644
---
a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/OsRepositoryImplTest.java
+++
b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/OsRepositoryImplTest.java
@@ -5,15 +5,17 @@
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
-import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.ovirt.engine.core.common.osinfo.MapBackedPreferences;
import org.ovirt.engine.core.common.businessentities.DisplayType;
+import org.ovirt.engine.core.common.osinfo.MapBackedPreferences;
import org.ovirt.engine.core.compat.Version;
public class OsRepositoryImplTest {
@@ -59,6 +61,14 @@
}
@Test
+ public void testDumpRepoToString() {
+ String actual = OsRepositoryImpl.INSTANCE.toString();
+ String expected = OsRepositoryImpl.INSTANCE.name();
+ Assert.assertNotSame(expected, actual);
+ System.out.println(actual);
+ }
+
+ @Test
public void testGetOsIds() throws Exception {
assertTrue(OsRepositoryImpl.INSTANCE.getOsIds().contains(777));
}
diff --git a/packaging/conf/osinfo-defaults.properties
b/packaging/conf/osinfo-defaults.properties
index 6a4ce6f..2ac4b67 100644
--- a/packaging/conf/osinfo-defaults.properties
+++ b/packaging/conf/osinfo-defaults.properties
@@ -165,6 +165,7 @@
os.windows_2008.derivedFrom.value = windows_2003
os.windows_2008.sysprepPath.value = ${ENGINE_USR}/conf/sysprep/sysprep.2k8
os.windows_2008.productKey.value =
+os.windows_2008.isTimezoneTypeInteger.value = false
# Windows2003x64(10, OsType.Windows, true),
os.windows_2003x64.id.value = 10
@@ -185,6 +186,7 @@
os.windows_7.devices.audio.value = ich6
os.windows_7.devices.diskInterfaces.value.3.3 = IDE, VirtIO_SCSI, VirtIO
os.windows_7.devices.diskInterfaces.value.3.4 = IDE, VirtIO_SCSI, VirtIO
+os.windows_7.isTimezoneTypeInteger.value = false
# Windows7x64(12, OsType.Windows, true),
os.windows_7x64.id.value = 12
@@ -202,7 +204,7 @@
os.windows_2008x64.sysprepPath.value =
${ENGINE_USR}/conf/sysprep/sysprep.2k8x64
os.windows_2008x64.productKey.value =
os.windows_2008x64.devices.audio.value = ich6
-
+os.windows_2008x64.isTimezoneTypeInteger.value = false
# os.Windows2008R2x64.derivedFrom.value = windows2008
os.windows_2008R2x64.id.value = 17
--
To view, visit http://gerrit.ovirt.org/26007
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I28898444de5da404bc8fb20cd2fa134e6ff6d83f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches