Alissa Bonas has uploaded a new change for review.

Change subject: core: add clear message for live snapshot fail
......................................................................

core: add clear message for live snapshot fail

Add a new, clear message when live snaphot fails for a host which is
up in a data center with compatibility version 3.0.

Change-Id: I7b6dfc138951baddc991a82a4c9e64f60499428a
Bug-Url: https://bugzilla.redhat.com/873156
Signed-off-by: Alissa Bonas <abo...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.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/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
6 files changed, 27 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/10171/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
index cf6feb8..ba7d3af 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
@@ -255,9 +255,12 @@
                             true,
                             true,
                             true,
-                            checkVmIsDown(),
-                            true, true, disksList);
+                            false,
+                            true, true, disksList)
+                     && canDoSnapshot( getVm());
         }
+
+
         return result;
     }
 
@@ -267,11 +270,24 @@
         addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT);
     }
 
+    private boolean canDoSnapshot(VM vm) {
+        //if version is 3.0 - live snapshot is not available, thus if vm is up 
snapshot is not possible so it needs to be
+        //checked if it's up or not
+        //if version is 3.1,  there is no need to check if vm is up since in 
any case snapshot is possible
+        boolean canSnapshot = true;
+        if(!isLiveSnapshotEnabled() && !ImagesHandler.isVmDown(vm)) {
+            //if there is no live snapshot and the vm is up - snapshot is not 
possible
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT);
+            canSnapshot = false;
+        }
+        return canSnapshot;
+    }
+
     /**
      * @return Check for VM down only if DC level does not support live 
snapshots.
      */
-    private boolean checkVmIsDown() {
-        return !Config.<Boolean> GetValue(
+    private boolean isLiveSnapshotEnabled() {
+        return Config.<Boolean> GetValue(
                 ConfigValues.LiveSnapshotEnabled, 
getStoragePool().getcompatibility_version().getValue());
     }
 
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 08cb356..fb992a9 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
@@ -162,6 +162,7 @@
     ILLEAGAL_USER_PROVIDED,
     ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION,
     ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED,
+    ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT,
     CANNOT_MAINTANANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS,
     ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG,
     ACTION_TYPE_FAILED_NAME_MAY_NOT_BE_EMPTY,
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 f3d94458..94dc3b0 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -480,6 +480,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION=Cannot ${action} 
${type}. Compatibility version is invalid, previous value restored.
 ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. 
Selected Compatibility Version is not supported.
+ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot 
${action} ${type}. Selected data center compatibility version does not support 
live snapshot.
 NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Netwrok address must be specify when using 
static ip
 ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation 
is currently in progress. Please try again later.
 NETWORK_BOND_HAVE_ATTACHED_VLANS=Bond attached to vlan, remove bonds vlan first
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 44fa62b..0807551 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -1271,6 +1271,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Selected Compatibility 
Version is not supported.")
     String ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Selected data center 
compatibility version does not support live snapshot.")
+    String 
ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT();
+
     @DefaultStringValue("Network address must be specified when using static 
ip")
     String NETWORK_ADDR_MANDATORY_IN_STATIC_IP();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 8a616d3..0e369f9 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -476,6 +476,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION=Cannot ${action} 
${type}. Compatibility version is invalid, previous value restored.
 ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. 
Selected Compatibility Version is not supported.
+ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot 
${action} ${type}. Selected data center compatibility version does not support 
live snapshot.
 NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Network address must be specified when 
using static ip
 ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation 
is currently in progress. Please try again later.
 NETWORK_BOND_HAVE_ATTACHED_VLANS=Bond attached to vlan, remove bonds vlan first
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index c52ffdd..74ff3ab 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -474,6 +474,7 @@
 ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal 
Domain name: ${Domain}. Domain name has unsupported special character ${Char}.
 ACTION_TYPE_FAILED_CANNOT_DECREASE_COMPATIBILITY_VERSION=Cannot ${action} 
${type}. Compatibility version is invalid, previous value restored.
 ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. 
Selected Compatibility Version is not supported.
+ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot 
${action} ${type}. Selected data center compatibility version does not support 
live snapshot.
 NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Network address must be specified when 
using static ip
 ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation 
is currently in progress. Please try again later.
 NETWORK_BOND_HAVE_ATTACHED_VLANS=Bond attached to vlan, remove bonds vlan first


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b6dfc138951baddc991a82a4c9e64f60499428a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alissa Bonas <abo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to