Roy Golan has uploaded a new change for review. Change subject: core: osinfo - add convenience no-version methods ......................................................................
core: osinfo - add convenience no-version methods Change-Id: I24444fc1b9722bd2ca43a58ab251ead2afdfbbc6 Signed-off-by: Roy Golan <rgo...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java 4 files changed, 87 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/15538/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java index f2e06b9..05f8229 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java @@ -28,16 +28,16 @@ setReturnValue(OsRepositoryImpl.INSTANCE.getWindowsOss()); break; case GetMaxOsRam: - setReturnValue(OsRepositoryImpl.INSTANCE.getMaximumRam(getParameters().getOsId(), null)); + setReturnValue(OsRepositoryImpl.INSTANCE.getMaximumRam(getParameters().getOsId())); break; case GetMinimumOsRam: - setReturnValue(OsRepositoryImpl.INSTANCE.getMinimumRam(getParameters().getOsId(), null)); + setReturnValue(OsRepositoryImpl.INSTANCE.getMinimumRam(getParameters().getOsId())); break; case HasSpiceSupport: - setReturnValue(OsRepositoryImpl.INSTANCE.hasSpiceSupport(getParameters().getOsId(), null)); + setReturnValue(OsRepositoryImpl.INSTANCE.hasSpiceSupport(getParameters().getOsId())); break; case GetNetworkDevices: - setReturnValue(OsRepositoryImpl.INSTANCE.getNetworkDevices(getParameters().getOsId(), null)); + setReturnValue(OsRepositoryImpl.INSTANCE.getNetworkDevices(getParameters().getOsId())); break; } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java index 4cf1a28..ac6bdfa 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java @@ -53,9 +53,19 @@ public ArrayList<Integer> getWindowsOss(); /** + * @return minimum RAM in mb, use the default version + */ + public int getMinimumRam(int osId); + + /** * @return minimum RAM in mb */ public int getMinimumRam(int osId, Version version); + + /** + * @return maximum RAM in mb with, use the default version + */ + public int getMaximumRam(int osId); /** * @return maximum RAM in mb @@ -63,9 +73,21 @@ public int getMaximumRam(int osId, Version version); /** + * @return if that OS could be connected with SPICE, use the default version + */ + public boolean hasSpiceSupport(int osId); + + /** * @return if that OS could be connected with SPICE */ public boolean hasSpiceSupport(int osId, Version version); + + /** + * this is Windows OSs specific path to the sysprep file, use the default version + * @param osId + * @return + */ + public String getSysprepPath(int osId); /** * this is Windows OSs specific path to the sysprep file @@ -76,7 +98,15 @@ public String getSysprepPath(int osId, Version version); /** + * this Windows OSs specific product key, use the default version + * @param osId + * @return + */ + public String getProductKey(int osId); + + /** * this Windows OSs specific product key + * * @param osId * @param version * @return @@ -99,6 +129,12 @@ /** * @param osId + * @return list of supported network devices, use the default version + */ + ArrayList<String> getNetworkDevices(int osId); + + /** + * @param osId * @return list of supported network devices */ ArrayList<String> getNetworkDevices(int osId, Version version); @@ -113,6 +149,15 @@ /** * early windows versions require a numeric identifier for sysprep to tell * the timezone. In later versions this was rectified and they use a universal name. + * the default version is used here + * @param osId + * @return + */ + boolean isTimezoneValueInteger(int osId); + + /** + * early windows versions require a numeric identifier for sysprep to tell + * the timezone. In later versions this was rectified and they use a universal name. * @param osId * @param version * @return diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java index 5adedef..53eb617 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java @@ -125,6 +125,11 @@ } @Override + public ArrayList<String> getNetworkDevices(int osId) { + return getNetworkDevices(osId, null); + } + + @Override public ArrayList<String> getNetworkDevices(int osId, Version version) { String devices = getValueByVersion(idToUnameLookup.get(osId), "devices.network", version); @@ -137,8 +142,18 @@ } @Override + public int getMinimumRam(int osId) { + return getMinimumRam(osId, null); + } + + @Override public int getMinimumRam(int osId, Version version) { return getInt(getValueByVersion(idToUnameLookup.get(osId), "resources.minimum.ram", version), -1); + } + + @Override + public int getMaximumRam(int osId) { + return getMinimumRam(osId, null); } @Override @@ -147,13 +162,28 @@ } @Override + public boolean hasSpiceSupport(int osId) { + return hasSpiceSupport(osId, null); + } + + @Override public boolean hasSpiceSupport(int osId, Version version) { return getBoolean(getValueByVersion(idToUnameLookup.get(osId), "spiceSupport", version), false); } @Override + public String getSysprepPath(int osId) { + return getSysprepPath(osId, null); + } + + @Override public String getSysprepPath(int osId, Version version) { return getValueByVersion(idToUnameLookup.get(osId), "sysprepPath", version); + } + + @Override + public String getProductKey(int osId) { + return getProductKey(osId, null); } @Override @@ -167,6 +197,11 @@ } @Override + public boolean isTimezoneValueInteger(int osId) { + return isTimezoneValueInteger(osId, null); + } + + @Override public boolean isTimezoneValueInteger(int osId, Version version) { return getBoolean(getValueByVersion(idToUnameLookup.get(osId), "isTimezoneTypeInteger", version), false); } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java index 31f3ddd..3082a70 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SysprepHandler.java @@ -65,8 +65,8 @@ public static String GetSysPrep(VM vm, String hostName, String domain, SysPrepParams sysPrepParams) { String sysPrepContent = ""; - sysPrepContent = LoadFile(OsRepositoryImpl.INSTANCE.getSysprepPath(vm.getVmOsId(), null)); - sysPrepContent = replace(sysPrepContent, "$ProductKey$", OsRepositoryImpl.INSTANCE.getProductKey(vm.getVmOsId(), null)); + sysPrepContent = LoadFile(OsRepositoryImpl.INSTANCE.getSysprepPath(vm.getVmOsId())); + sysPrepContent = replace(sysPrepContent, "$ProductKey$", OsRepositoryImpl.INSTANCE.getProductKey(vm.getVmOsId())); if (sysPrepContent.length() > 0) { @@ -137,7 +137,7 @@ vm.setTimeZone(Config.<String> GetValue(ConfigValues.DefaultWindowsTimeZone)); } - if (OsRepositoryImpl.INSTANCE.isTimezoneValueInteger(vm.getStaticData().getOs(), null)) { + if (OsRepositoryImpl.INSTANCE.isTimezoneValueInteger(vm.getStaticData().getOs())) { // send correct time zone as sysprep expect to get it (a wierd number) timeZone = getTimezoneIndexByKey(vm.getTimeZone()); } else { -- To view, visit http://gerrit.ovirt.org/15538 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I24444fc1b9722bd2ca43a58ab251ead2afdfbbc6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <rgo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches