Mark Wu has uploaded a new change for review.

Change subject: [WIP] Allow creating ISO domain on localfs This patch allows 
creating ISO domain on localfs. Even though localfs can't be shared among the 
hosts in cluster, it could help in the case of no nfs available. VM can be 
created on the host which has the ISO dom
......................................................................

[WIP] Allow creating ISO domain on localfs
This patch allows creating ISO domain on localfs. Even though localfs
can't be shared among the hosts in cluster, it could help in the case
of no nfs available. VM can be created on the host which has the ISO
domain attached, and then be migrated to any other host in the cluster.

Change-Id: I2a8d3ea8ab4ac10353ec8574287458e8eb63e882
Signed-off-by: Mark Wu <wu...@linux.vnet.ibm.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddLocalStorageDomainCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DisconnectStorageServerConnectionCommand.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/NewEditStorageModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/StorageListModel.java
8 files changed, 11 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/12687/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddLocalStorageDomainCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddLocalStorageDomainCommand.java
index 65a2821..d258a78 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddLocalStorageDomainCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddLocalStorageDomainCommand.java
@@ -5,6 +5,7 @@
 import org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
+import org.ovirt.engine.core.common.businessentities.StorageDomainType;
 import org.ovirt.engine.core.common.businessentities.StoragePoolStatus;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDSType;
@@ -45,7 +46,8 @@
                 setStoragePool(storagePool);
             }
 
-            if (retVal && storagePool.getstorage_pool_type() != 
StorageType.LOCALFS) {
+            if (retVal && getStorageDomain().getStorageDomainType() != 
StorageDomainType.ISO
+                    && storagePool.getstorage_pool_type() != 
StorageType.LOCALFS) {
                 
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_IS_NOT_LOCAL);
                 retVal = false;
             }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
index 01fe9f3..437177d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
@@ -124,7 +124,8 @@
             returnValue = false;
         }
         if (returnValue && getStorageDomain().getStorageDomainType() == 
StorageDomainType.ISO
-                && getStorageDomain().getStorageType() != StorageType.NFS) {
+                && !(getStorageDomain().getStorageType() == StorageType.NFS
+                        || getStorageDomain().getStorageType() == 
StorageType.LOCALFS)) {
             
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL);
             returnValue = false;
         }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java
index 17641b1..35da3bd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java
@@ -8,7 +8,6 @@
 import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
-import org.ovirt.engine.core.common.businessentities.storage_pool;
 import org.ovirt.engine.core.common.validation.NfsMountPointConstraint;
 import org.ovirt.engine.core.common.validation.group.CreateEntity;
 import org.ovirt.engine.core.compat.Guid;
@@ -71,15 +70,6 @@
             returnValue = false;
         }
 
-        if (returnValue) {
-            if (paramConnection.getstorage_type() == StorageType.LOCALFS) {
-                storage_pool storagePool = 
DbFacade.getInstance().getStoragePoolDao().getForVds(getVds().getId());
-                if (storagePool == null || storagePool.getstorage_pool_type() 
!= StorageType.LOCALFS) {
-                    returnValue = false;
-                    
addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_ADD_LOCAL_STORAGE_TO_NON_LOCAL_HOST);
-                }
-            }
-        }
         return returnValue;
     }
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DisconnectStorageServerConnectionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DisconnectStorageServerConnectionCommand.java
index 887f804..e512aaf 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DisconnectStorageServerConnectionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/DisconnectStorageServerConnectionCommand.java
@@ -3,13 +3,9 @@
 import org.ovirt.engine.core.bll.Backend;
 import org.ovirt.engine.core.bll.InternalCommandAttribute;
 import 
org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase;
-import org.ovirt.engine.core.common.businessentities.StorageType;
-import org.ovirt.engine.core.common.businessentities.storage_pool;
 import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
 import 
org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
-import org.ovirt.engine.core.dal.VdcBllMessages;
-import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 
 @InternalCommandAttribute
 public class DisconnectStorageServerConnectionCommand<T extends 
StorageServerConnectionParametersBase> extends
@@ -25,18 +21,7 @@
 
     @Override
     protected boolean canDoAction() {
-        boolean returnValue = true;
-
-        if (getConnection().getstorage_type() == StorageType.LOCALFS) {
-            storage_pool storagePool = 
DbFacade.getInstance().getStoragePoolDao().getForVds(getVds().getId());
-            if (storagePool == null || storagePool.getstorage_pool_type() != 
StorageType.LOCALFS) {
-                returnValue = false;
-                getReturnValue().getCanDoActionMessages().add(
-                        
VdcBllMessages.VDS_CANNOT_REMOVE_LOCAL_STORAGE_ON_NON_LOCAL_HOST.toString());
-            }
-        }
-
-        return returnValue;
+        return true;
     }
 
     protected boolean disconnectStorage() {
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
index 6f7beba..e492878 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
@@ -554,8 +554,6 @@
 
     VDS_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE,
     VDS_CANNOT_REMOVE_HOST_WITH_LOCAL_STORAGE,
-    VDS_CANNOT_ADD_LOCAL_STORAGE_TO_NON_LOCAL_HOST,
-    VDS_CANNOT_REMOVE_LOCAL_STORAGE_ON_NON_LOCAL_HOST,
 
     VDS_GROUP_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE,
     VDS_GROUP_SELECTION_ALGORITHM_MUST_BE_SET_TO_NONE_ON_LOCAL_STORAGE,
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index aca3b52..70d78db 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -542,8 +542,6 @@
 VDS_CANNOT_REMOVE_HOST_WITH_LOCAL_STORAGE=Cannot remove Host, as it contains a 
local Storage Domain. Please activate the Host and remove the Data Center 
first.\n\
 - If Host cannot be activated, use the Force-Remove option on the Data Center 
object (select the Data Center and right click on it with the mouse).\n\
 - Please note that this action is destructive.
-VDS_CANNOT_ADD_LOCAL_STORAGE_TO_NON_LOCAL_HOST=Can not add local Storage 
Domain to non local storage Host
-VDS_CANNOT_REMOVE_LOCAL_STORAGE_ON_NON_LOCAL_HOST=Can not remove local Storage 
Domain from non local storage Host
 VDS_GROUP_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE=Cannot add more than 
one Cluster to "Local Storage" Data Center
 VDS_GROUP_SELECTION_ALGORITHM_MUST_BE_SET_TO_NONE_ON_LOCAL_STORAGE=Selection 
algorithm must be set to "None" on "Local Storage" Data Center
 VDS_GROUP_CANNOT_DETACH_DATA_DOMAIN_FROM_LOCAL_STORAGE="Local Storage" data 
domain cannot be detached from Data Center
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/NewEditStorageModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/NewEditStorageModelBehavior.java
index 0ceef18..43062fb 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/NewEditStorageModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/NewEditStorageModelBehavior.java
@@ -78,7 +78,7 @@
                                 || (item.getRole() == 
StorageDomainType.ImportExport
                                         && item.getType() == StorageType.NFS
                                         && dataCenter.getstatus() != 
StoragePoolStatus.Uninitialized && isNoStorageAttached) || item.getRole() == 
StorageDomainType.ISO
-                                && item.getType() == StorageType.NFS
+                                && (item.getType() == StorageType.NFS || 
item.getType() == StorageType.LOCALFS)
                                 && dataCenter.getstatus() != 
StoragePoolStatus.Uninitialized && isNoStorageAttached)) || 
(getModel().getStorage() != null && item.getType() == getModel().getStorage()
                         .getStorageType())));
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/StorageListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/StorageListModel.java
index 8e023d2..b08f73e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/StorageListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/StorageListModel.java
@@ -296,6 +296,10 @@
         localDataModel.setRole(StorageDomainType.Data);
         items.add(localDataModel);
 
+        LocalStorageModel localIsoModel = new LocalStorageModel();
+        localIsoModel.setRole(StorageDomainType.ISO);
+        items.add(localIsoModel);
+
         PosixStorageModel posixDataModel = new PosixStorageModel();
         posixDataModel.setRole(StorageDomainType.Data);
         items.add(posixDataModel);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a8d3ea8ab4ac10353ec8574287458e8eb63e882
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wu...@linux.vnet.ibm.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to