Vered Volansky has uploaded a new change for review.

Change subject: core: Changed illegal error msg to locked(#840304)
......................................................................

core: Changed illegal error msg to locked(#840304)

Replaced VM in illegal state error message to locked VM in
ImagesHandler.PerformImagesChecks() when the VM is indeed locked.

The specific flow of actions to introduce the wrong message was
Trying to export a VM while committing a preview.
This yielded a statement that the VM's state is illegal while it should
only say that it's locked.
This should correct other flow of events as well.

Also fixed regression from patch b322dbbc:
ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED message was changed to inform of
locked disks. Existing uses of this message did not check for locked
disks, let alone inform of them. This message is now reverted to what it
used to be and a new message -
ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED is added and used only in the
appropriate place - ImagesHandler.PerformImagesChecks() - if the VM is
not locked and disks are.

Change-Id: Iddd6a53bfc8936b0030c07c1d58530c5a0798847
Bug-Url: https://bugzilla.redhat.coma/840304
Signed-off-by: Vered Volansky <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.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, 18 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/8226/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
index a374961..07a851b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
@@ -460,10 +460,7 @@
 
         if (returnValue && checkImagesLocked) {
             List<String> lockedDisksAliases = new ArrayList<String>();
-            if (vm.getstatus() == VMStatus.ImageLocked) {
-                ListUtils.nullSafeAdd(messages, 
VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL.toString());
-                returnValue = false;
-            } else if (diskImageList != null) {
+            if (diskImageList != null) {
                 for (Object object : diskImageList) {
                     Disk disk = (Disk) object;
                     if (DiskStorageType.IMAGE == disk.getDiskStorageType()
@@ -473,10 +470,16 @@
                     }
                 }
                 if (lockedDisksAliases.size() > 0) {
-                    ListUtils.nullSafeAdd(messages, 
VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED.toString());
+                    ListUtils.nullSafeAdd(messages,
+                            
VdcBllMessages.ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED.toString());
                     messages.add(String.format("$%1$s %2$s", "diskAliases", 
StringUtils.join(lockedDisksAliases, ", ")));
                 }
             }
+
+            if (returnValue && vm.getstatus() == VMStatus.ImageLocked) {
+                ListUtils.nullSafeAdd(messages, 
VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED.toString());
+                returnValue = false;
+            }
         }
         if (returnValue && checkVmIsDown && vm.getstatus() != VMStatus.Down) {
             returnValue = false;
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 92fe26c..9dca4f6 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
@@ -69,6 +69,7 @@
     ACTION_LIST_CANNOT_BE_EMPTY,
     ACTION_TYPE_FAILED_VM_MAX_RESOURCE_EXEEDED,
     ACTION_TYPE_FAILED_VM_IN_PREVIEW,
+    ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED,
     ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED,
     ACTION_TYPE_FAILED_VM_DURING_EXPORT,
     ACTION_TYPE_FAILED_VM_IMAGE_IS_ILLEGAL,
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 f7508e0..178e3cd 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -125,7 +125,8 @@
 ACTION_TYPE_FAILED_MISSED_STORAGES_FOR_SOME_DISKS=Cannot ${action} ${type}. 
Provided destination storage domains don't match for provided disks.
 ACTION_TYPE_FAILED_STOARGE_DOMAIN_IS_WRONG=Cannot ${action} ${type}. Provided 
wrong storage domain, which is not related to disk.
 ACTION_TYPE_FAILED_VM_IN_PREVIEW=Cannot ${action} ${type}. VM is previewing a 
Snapshot.
-ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: VM's image is 
locked. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_DURING_EXPORT=Cannot ${action} ${type}: VM is being 
exported now. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_IMAGE_IS_ILLEGAL=Cannot ${action} ${type}. VM's Image 
might be corrupted.
 ACTION_TYPE_FAILED_VM_HAS_NO_DISKS=Cannot ${action} ${type}. VM has no disks.
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 0be0f7f..1a2920c 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
@@ -311,6 +311,9 @@
     String ACTION_TYPE_FAILED_VM_IN_PREVIEW();
 
     @DefaultStringValue("Cannot ${action} ${type}: The disks ${diskAliases} 
are locked. Please try again in a few minutes.")
+    String ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED();
+
+    @DefaultStringValue("Cannot ${action} ${type}: VM's image is locked. 
Please try again in a few minutes.")
     String ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED();
 
     @DefaultStringValue("Cannot ${action} ${type}: VM is being exported now. 
Please try again in a few minutes.")
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 dfc92f1..06a73d7 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
@@ -123,7 +123,8 @@
 DIRECTORY_COMPUTER_WITH_THE_SAME_NAME_ALREADY_EXITS=A Computer with the same 
name already exists.
 VM_NOT_FOUND=VM not found
 ACTION_TYPE_FAILED_VM_IN_PREVIEW=Cannot ${action} ${type}. VM is previewing a 
Snapshot.
-ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: VM's image is 
locked. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_DURING_EXPORT=Cannot ${action} ${type}: VM is being 
exported now. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_IMAGE_IS_ILLEGAL=Cannot ${action} ${type}. VM's Image 
might be corrupted.
 ACTION_TYPE_FAILED_VM_HAS_NO_DISKS=Cannot ${action} ${type}. VM has no disks.
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 de888b7..633c61b 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
@@ -122,7 +122,8 @@
 DIRECTORY_COMPUTER_WITH_THE_SAME_NAME_ALREADY_EXITS=A Computer with the same 
name already exists.
 VM_NOT_FOUND=VM not found
 ACTION_TYPE_FAILED_VM_IN_PREVIEW=Cannot ${action} ${type}. VM is previewing a 
Snapshot.
-ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_DISKS_IMAGES_ARE_LOCKED=Cannot ${action} ${type}: The disks 
${diskAliases} are locked. Please try again in a few minutes.
+ACTION_TYPE_FAILED_VM_IMAGE_IS_LOCKED=Cannot ${action} ${type}: VM's image is 
locked. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_DURING_EXPORT=Cannot ${action} ${type}: VM is being 
exported now. Please try again in a few minutes.
 ACTION_TYPE_FAILED_VM_IMAGE_IS_ILLEGAL=Cannot ${action} ${type}. VM's Image 
might be corrupted.
 ACTION_TYPE_FAILED_VM_HAS_NO_DISKS=Cannot ${action} ${type}. VM has no disks.


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

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

Reply via email to