Gustavo Frederico Temple Pedrosa has uploaded a new change for review.

Change subject: core, webadmin: Show only supported watchdogs
......................................................................

core, webadmin: Show only supported watchdogs

This change displays only supported watchdogs compatible with the
selected operating system.

Change-Id: Ib23f7357751025ff71c0deceda02aa51c2d8542c
Signed-off-by: Gustavo Pedrosa <[email protected]>
---
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/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java
M 
backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImplTest.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
M packaging/conf/osinfo-defaults.properties
8 files changed, 57 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/18221/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 424ba0f..856666d 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
@@ -42,6 +42,9 @@
             case GetNetworkDevices:
                 
setReturnValue(osRepository.getNetworkDevices(getParameters().getOsId(), 
getParameters().getVersion()));
                 break;
+            case GetWatchDogModels:
+                
setReturnValue(osRepository.getWatchDogModels(getParameters().getOsId(), 
getParameters().getVersion()));
+                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 d18c98c..29923e0 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
@@ -107,6 +107,12 @@
 
     /**
      * @param osId
+     * @return list of supported watch dog models
+     */
+    ArrayList<String> getWatchDogModels(int osId, Version version);
+
+    /**
+     * @param osId
      * @param version
      * @return a specific sound device for the given os.
      */
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 3a2542f..986e772 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
@@ -129,6 +129,13 @@
     }
 
     @Override
+    public ArrayList<String> getWatchDogModels(int osId, Version version) {
+        String models =
+                getValueByVersion(idToUnameLookup.get(osId), "watchDogModels", 
version);
+        return trimElements(models.split(","));
+    }
+
+    @Override
     public boolean isLinux(int osId) {
         return getOsFamily(osId).equalsIgnoreCase("linux");
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java
index 733f10f..9c1f14e 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java
@@ -44,6 +44,7 @@
         GetMinimumOsRam,
         GetMaxOsRam,
         GetNetworkDevices,
+        GetWatchDogModels,
         GetWindowsOss,
         GetUniqueOsNames,
         GetOsNames
diff --git 
a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImplTest.java
 
b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImplTest.java
index 2daee06..e26918e 100644
--- 
a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImplTest.java
+++ 
b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImplTest.java
@@ -15,6 +15,7 @@
     private static MapBackedPreferences preferences;
 
     public static final String NETWORK_DEVICES = "e100,pv";
+    public static final String WATCH_DOG_MODELS = "i6300esb,ib700";
     public static final String PATH_TO_SYSPREP = "/path/to/sysprep";
     public static final String SOME_PRODUCT_KEY = "some-product-key";
     public static final String SOUND_DEVICE = "ac97";
@@ -27,6 +28,7 @@
         preferences.node("/os/rhel7/family").put("value", "linux");
         preferences.node("/os/rhel7/bus").put("value", "64");
         preferences.node("/os/rhel7/devices/network").put("value", 
NETWORK_DEVICES);
+        preferences.node("/os/rhel7/watchDogModel").put("value", 
WATCH_DOG_MODELS);
         preferences.node("/os/rhel7/resources/minimum/ram").put("value", 
"1024");
         preferences.node("/os/rhel7/resources/minimum/ram").put("value.3.1", 
"512");
         preferences.node("/os/rhel7/resources/maximum/ram").put("value", 
"2048");
@@ -97,6 +99,15 @@
     }
 
     @Test
+    public void testGetWatchDogModels() throws Exception {
+        ArrayList<String> watchDogModels = 
OsRepositoryImpl.INSTANCE.getWatchDogModels(777, null);
+        assertTrue(watchDogModels.size() == 2);
+        for (String model : WATCH_DOG_MODELS.split(",")) {
+            assertTrue(watchDogModels.contains(model));
+        }
+    }
+
+    @Test
     public void testIsLinux() throws Exception {
         assertTrue(OsRepositoryImpl.INSTANCE.isLinux(777));
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index d1b2769..c2c097c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -3089,6 +3089,12 @@
                 asyncQuery);
     }
 
+    public static void getWatchDogModels(int osId, Version version,
+            AsyncQuery asyncQuery) {
+        Frontend.RunQuery(VdcQueryType.OsRepository, new OsQueryParameters(
+                OsRepositoryVerb.GetWatchDogModels, osId, version), 
asyncQuery);
+    }
+
     public static ArrayList<Map.Entry<String, EntityModel>> 
getBondingOptionList(RefObject<Map.Entry<String, EntityModel>> defaultItem)
     {
         ArrayList<Map.Entry<String, EntityModel>> list =
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
index 328acb2..816d19e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
@@ -1732,6 +1732,27 @@
         getDomain().setIsChangable(getIsWindowsOS());
 
         getBehavior().updateDefaultTimeZone();
+
+        updateWatchdogModels(osType);
+    }
+
+    private void updateWatchdogModels(Integer osType) {
+        VDSGroup cluster = getSelectedCluster();
+        if (osType != null && cluster != null) {
+            AsyncQuery asyncQuery = new AsyncQuery();
+            asyncQuery.asyncCallback = new INewAsyncCallback() {
+                @Override
+                public void onSuccess(Object model, Object returnValue) {
+                    ArrayList<String> watchDogModels = (ArrayList<String>) 
((VdcQueryReturnValue) returnValue)
+                            .getReturnValue();
+                    watchDogModels.add(0, null);
+                    getWatchdogModel().setItems(
+                            (ArrayList<String>) watchDogModels);
+                }
+            };
+            AsyncDataProvider.getWatchDogModels(osType,
+                    cluster.getcompatibility_version(), asyncQuery);
+        }
     }
 
     private void firstBootDevice_SelectedItemChanged(Object sender, EventArgs 
args)
diff --git a/packaging/conf/osinfo-defaults.properties 
b/packaging/conf/osinfo-defaults.properties
index ad1f898..977706d 100644
--- a/packaging/conf/osinfo-defaults.properties
+++ b/packaging/conf/osinfo-defaults.properties
@@ -46,6 +46,7 @@
 os.other.resources.minimum.disksize.value = 1
 os.other.resources.minimum.numberOsCpus.value = 1
 os.other.spiceSupport.value = true
+os.other.watchDogModels.value = i6300esb,ib700
 
 os.other.devices.audio.value = ich6
 # See VmInterfaceType.java
@@ -65,6 +66,7 @@
 os.other_ppc64.resources.minimum.disksize.value = 1
 os.other_ppc64.resources.minimum.numberOsCpus.value = 1
 os.other_ppc64.spiceSupport.value = false
+os.other_ppc64.watchDogModels.value = i6300esb
 os.other_ppc64.devices.audio.value = ich6
 os.other_ppc64.devices.network.value = rtl8139, pv
 os.other_ppc64.devices.diskInterfaces.value = VirtIO, VirtIO_SCSI


-- 
To view, visit http://gerrit.ovirt.org/18221
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib23f7357751025ff71c0deceda02aa51c2d8542c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Gustavo Frederico Temple Pedrosa <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to