Greg Padgett has uploaded a new change for review.

Change subject: db, core, webadmin: Add is_live_merge_supported flag
......................................................................

db, core, webadmin: Add is_live_merge_supported flag

Some hosts may not have updated software capable of live merging
snapshots, which vdsm will report in its capabilities using the
'liveMerge' flag.

Capture this flag, and use it to limit live merge operations on hosts
not supporting the feature.

Change-Id: I932a74f4010b8b256f8c0cd27a2279b9d83efbb9
Bug-Url: https://bugzilla.redhat.com/1124099
Signed-off-by: Greg Padgett <gpadg...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_05_0830_add_live_merge_supported.sql
M packaging/dbscripts/vds_sp.sql
23 files changed, 124 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/31169/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
index 6d56997..d26874d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
@@ -98,14 +98,20 @@
 
     @Override
     protected void executeCommand() {
-        if 
(FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())) {
-            if (!getVm().isQualifiedForSnapshotMerge()) {
-                log.error("Cannot remove VM snapshot. Vm is not Down, Up or 
Paused");
-                throw new 
VdcBLLException(VdcBllErrors.VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE);
+        if (!getVm().isDown()) {
+            if 
(FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())) {
+                if (!getVm().isQualifiedForSnapshotMerge()) {
+                    log.error("Cannot remove VM snapshot. Vm is not Down, Up 
or Paused");
+                    throw new 
VdcBLLException(VdcBllErrors.VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE);
+                } else if (getVm().getRunOnVds() == null ||
+                        
!getVdsDAO().get(getVm().getRunOnVds()).getLiveMergeSupport()) {
+                    log.error("Cannot remove VM snapshot. The host on which VM 
is running does not support Live Merge");
+                    throw new 
VdcBLLException(VdcBllErrors.VM_HOST_CANNOT_LIVE_MERGE);
+                }
+            } else {
+                log.error("Cannot remove VM snapshot. Vm is not Down and 
cluster version does not support Live Merge");
+                throw new 
VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL);
             }
-        } else if (!getVm().isDown()) {
-            log.error("Cannot remove VM snapshot. Vm is not Down and cluster 
version does not support Live Merge");
-            throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL);
         }
 
         final Snapshot snapshot = 
getSnapshotDao().get(getParameters().getSnapshotId());
@@ -299,9 +305,10 @@
                 !validateVmNotDuringSnapshot() ||
                 !validateVmNotInPreview() ||
                 !validateSnapshotExists() ||
-                
!(FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())
-                        ? validate(vmValidator.vmQualifiedForSnapshotMerge())
-                        : validate(vmValidator.vmDown())) ||
+                
(FeatureSupported.liveMerge(getVm().getVdsGroupCompatibilityVersion())
+                        ? (!validate(vmValidator.vmQualifiedForSnapshotMerge())
+                           || !validate(vmValidator.vmHostCanLiveMerge()))
+                        : !validate(vmValidator.vmDown())) ||
                 
!validate(vmValidator.vmNotHavingDeviceSnapshotsAttachedToOtherVms(false))) {
             return false;
         }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java
index 1c3ef6f..b7ca766 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java
@@ -54,7 +54,25 @@
     public ValidationResult vmQualifiedForSnapshotMerge() {
         for (VM vm : vms) {
             if (!vm.isQualifiedForSnapshotMerge()) {
-                return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP);
+                return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP,
+                        String.format("$VmName %s", vm.getName()));
+            }
+        }
+
+        return ValidationResult.VALID;
+    }
+
+    /**
+     * @return Validation result indicating that if a host is running, then it 
is running on a host capable
+     * of live merging snapshots.  Should be used in combination with 
vmQualifiedForSnapshotMerge().
+     */
+    public ValidationResult vmHostCanLiveMerge() {
+        for (VM vm : vms) {
+            if (!vm.isDown() &&
+                    ((vm.getRunOnVds() == null ||
+                    
!DbFacade.getInstance().getVdsDao().get(vm.getRunOnVds()).getLiveMergeSupport())))
 {
+                    return new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE,
+                            String.format("$VmName %s", vm.getName()));
             }
         }
 
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
index acba67a..66d7466 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveSnapshotCommandTest.java
@@ -236,13 +236,23 @@
     }
 
     @Test
-    public void testCanDoActionVmUp() {
+    public void testCanDoActionVmUpHostCapable() {
         prepareForVmValidatorTests();
+        
doReturn(ValidationResult.VALID).when(vmValidator).vmHostCanLiveMerge();
         cmd.getVm().setStatus(VMStatus.Up);
         CanDoActionTestUtils.runAndAssertCanDoActionSuccess(cmd);
     }
 
     @Test
+    public void testCanDoActionVmUpHostNotCapable() {
+        prepareForVmValidatorTests();
+        doReturn(new 
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE))
+                .when(vmValidator).vmHostCanLiveMerge();
+        cmd.getVm().setStatus(VMStatus.Up);
+        CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, 
VdcBllMessages.ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE);
+    }
+
+    @Test
     public void testCanDoActionVmDown() {
         prepareForVmValidatorTests();
         cmd.getVm().setStatus(VMStatus.Down);
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index 86ccf4e..0f8e738 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -1404,4 +1404,12 @@
     public Boolean getLiveSnapshotSupport() {
         return this.mVdsDynamic.getLiveSnapshotSupport();
     }
+
+    public void setLiveMergeSupport(boolean value) {
+        this.mVdsDynamic.setLiveMergeSupport(value);
+    }
+
+    public boolean getLiveMergeSupport() {
+        return this.mVdsDynamic.getLiveMergeSupport();
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
index 8d1b0fb..fa930b9 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
@@ -91,6 +91,8 @@
 
     private boolean liveSnapshotSupport;
 
+    private boolean liveMergeSupport;
+
     private VdsTransparentHugePagesState transparentHugePagesState;
 
     @Size(max = BusinessEntitiesDefinitions.GENERAL_NAME_SIZE)
@@ -200,6 +202,7 @@
         autoNumaBalancing = AutoNumaBalanceStatus.UNKNOWN;
         supportedRngSources = new HashSet<VmRngDevice.Source>();
         liveSnapshotSupport = true;  // usually supported, exceptional case if 
it isn't.
+        liveMergeSupport = true;
     }
 
     public Integer getcpu_cores() {
@@ -629,6 +632,14 @@
         this.liveSnapshotSupport = liveSnapshotSupport;
     }
 
+    public boolean getLiveMergeSupport() {
+        return liveMergeSupport;
+    }
+
+    public void setLiveMergeSupport(boolean liveMergeSupport) {
+        this.liveMergeSupport = liveMergeSupport;
+    }
+
     public List<VdsNumaNode> getNumaNodeList() {
         return numaNodeList;
     }
@@ -717,6 +728,7 @@
         result = prime * result + autoNumaBalancing.getValue();
         result = prime * result + (numaSupport ? 0 : 1);
         result = prime * result + (liveSnapshotSupport ? 0 : 1);
+        result = prime * result + (liveMergeSupport ? 0 : 1);
 
         return result;
     }
@@ -791,7 +803,8 @@
                 && ObjectUtils.objectsEqual(supportedEmulatedMachines, 
other.supportedEmulatedMachines)
                 && powerManagementControlledByPolicy == 
other.powerManagementControlledByPolicy
                 && ObjectUtils.objectsEqual(supportedRngSources, 
other.supportedRngSources)
-                && liveSnapshotSupport == other.liveSnapshotSupport;
+                && liveSnapshotSupport == other.liveSnapshotSupport
+                && liveMergeSupport == other.liveMergeSupport;
     }
 
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
index 32758a5..382ca11 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java
@@ -434,6 +434,7 @@
     PROVIDER_SSL_FAILURE(5052),
     FAILED_UPDATE_RUNNING_VM(5053),
     VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE(5054),
+    VM_HOST_CANNOT_LIVE_MERGE(5055),
 
     // Network Labels
     LABELED_NETWORK_INTERFACE_NOT_FOUND(5200),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 6c560e1..e835a4d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -160,6 +160,7 @@
     ACTION_TYPE_FAILED_VM_IS_NOT_UP(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_IS_NOT_DOWN(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP(ErrorType.CONFLICT),
+    ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_IS_SAVING_RESTORING(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_IS_DURING_SNAPSHOT(ErrorType.CONFLICT),
     ACTION_TYPE_FAILED_VM_NOT_FOUND(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
index efbbbe7..91a4641 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
@@ -359,6 +359,7 @@
             
entity.setAutoNumaBalancing(AutoNumaBalanceStatus.forValue(rs.getInt("auto_numa_balancing")));
             entity.setNumaSupport(rs.getBoolean("is_numa_supported"));
             
entity.setLiveSnapshotSupport(rs.getBoolean("is_live_snapshot_supported"));
+            
entity.setLiveMergeSupport(rs.getBoolean("is_live_merge_supported"));
             return entity;
         }
     }
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
index 3a91207..e092ed5 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
@@ -105,6 +105,7 @@
             
entity.setAutoNumaBalancing(AutoNumaBalanceStatus.forValue(rs.getInt("auto_numa_balancing")));
             entity.setNumaSupport(rs.getBoolean("is_numa_supported"));
             
entity.setLiveSnapshotSupport(rs.getBoolean("is_live_snapshot_supported"));
+            
entity.setLiveMergeSupport(rs.getBoolean("is_live_merge_supported"));
 
             return entity;
         }
@@ -269,7 +270,8 @@
                 .addValue("is_numa_supported", vds.isNumaSupport())
                 .addValue("supported_rng_sources", 
VmRngDevice.sourcesToCsv(vds.getSupportedRngSources()))
                 .addValue("supported_emulated_machines", 
vds.getSupportedEmulatedMachines())
-                .addValue("is_live_snapshot_supported", 
vds.getLiveSnapshotSupport());
+                .addValue("is_live_snapshot_supported", 
vds.getLiveSnapshotSupport())
+                .addValue("is_live_merge_supported", 
vds.getLiveMergeSupport());
 
         return parameterSource;
     }
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 cb93b38..46a01b1 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -174,6 +174,7 @@
 ACTION_TYPE_FAILED_VM_IS_NOT_UP=Cannot ${action} ${type}. VM is not up.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN=Cannot ${action} ${type}. At least one of 
the VMs is not down.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP=Cannot ${action} ${type}. VM ${VmName} 
must be in status Down, Up or Paused.
+ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE=Cannot ${action} ${type}. The 
host running VM ${VmName} is not capable of live merging snapshots.
 ACTION_TYPE_FAILED_VM_IS_SAVING_RESTORING=Cannot ${action} ${type}. VM is in 
saving/restoring state.\n\
        -Please try again when the VM is either up or down.
 ACTION_TYPE_FAILED_VM_IS_DURING_SNAPSHOT=Cannot ${action} ${type}. The VM is 
performing an operation on a Snapshot. Please wait for the operation to finish, 
and try again.
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
index f98da09..b4c978a 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties
@@ -391,6 +391,7 @@
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
+VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.
 MIGRATION_DEST_INVALID_HOSTNAME=Migration destination has an invalid hostname
 MIGRATION_CANCEL_ERROR=Migration not in progress
 MIGRATION_CANCEL_ERROR_NO_VM=Cancel migration has failed. Please try again in 
a few moments and track the VM's event log for details.
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 3e504d8..c96d444 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -2708,6 +2708,7 @@
         <column>is_numa_supported</column>
         <column>supported_rng_sources</column>
         <column>is_live_snapshot_supported</column>
+        <column>is_live_merge_supported</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>3</value>
@@ -2760,6 +2761,7 @@
             <value>2</value>
             <value>true</value>
             <value>RANDOM</value>
+            <value>true</value>
             <value>true</value>
         </row>
         <row>
@@ -2815,6 +2817,7 @@
             <value>true</value>
             <value></value>
             <value>false</value>
+            <value>false</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -2868,6 +2871,7 @@
             <value>2</value>
             <value>true</value>
             <value>HWRNG</value>
+            <value>false</value>
             <value>false</value>
         </row>
         <row>
@@ -2923,6 +2927,7 @@
             <value>true</value>
             <value>RANDOM</value>
             <value>true</value>
+            <value>true</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -2977,6 +2982,7 @@
             <value>true</value>
             <value>RANDOM,HWRNG</value>
             <value>true</value>
+            <value>true</value>
         </row>
     </table>
 
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
index e0abb3c..00c8e1c 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
@@ -492,6 +492,11 @@
         if (xmlRpcStruct.containsKey(VdsProperties.liveSnapshotSupport)) {
             vds.setLiveSnapshotSupport(AssignBoolValue(xmlRpcStruct, 
VdsProperties.liveSnapshotSupport));
         }
+        if (xmlRpcStruct.containsKey(VdsProperties.liveMergeSupport)) {
+            vds.setLiveMergeSupport(AssignBoolValue(xmlRpcStruct, 
VdsProperties.liveMergeSupport));
+        } else {
+            vds.setLiveMergeSupport(false);
+        }
     }
 
     private static void setRngSupportedSourcesToVds(VDS vds, Map<String, 
Object> xmlRpcStruct) {
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
index 5df1593..0f7f7f1 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
@@ -246,6 +246,7 @@
     public static final String session = "session";
     public static final String spiceSslCipherSuite = "spiceSslCipherSuite";
     public static final String liveSnapshotSupport = "liveSnapshot";
+    public static final String liveMergeSupport = "liveMerge";
 
     public static final String vm_balloonInfo = "balloonInfo";
     public static final String vm_balloon_cur = "balloon_cur";
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 f4e8bef..93834ef 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
@@ -448,6 +448,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. VM ${VmName} must be in 
status Down, Up or Paused.")
     String ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP();
 
+    @DefaultStringValue("Cannot ${action} ${type}. The host running VM 
${VmName} is not capable of live merging snapshots.")
+    String ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE();
+
     @DefaultStringValue("Cannot ${action} ${type}. VM is in saving/restoring 
state.\n-Please try again when the VM is either up or down.")
     String ACTION_TYPE_FAILED_VM_IS_SAVING_RESTORING();
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
index 1553029..cae600e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
@@ -18,6 +18,7 @@
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus;
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType;
 import org.ovirt.engine.core.common.businessentities.StoragePool;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
@@ -777,7 +778,20 @@
 
         VM vm = (VM) entity;
 
-        setLiveMergeSupported(AsyncDataProvider.isLiveMergeSupported(vm));
+        if (vm.getRunOnVds() == null || 
!AsyncDataProvider.isLiveMergeSupported(vm)) {
+            setLiveMergeSupported(false);
+            return;
+        }
+
+        AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() {
+            @Override
+            public void onSuccess(Object model, Object returnValue) {
+                VmSnapshotListModel vmSnapshotListModel = 
(VmSnapshotListModel) model;
+                VDS vds = (VDS) returnValue;
+                
vmSnapshotListModel.setLiveMergeSupported(vds.getLiveMergeSupport());
+            }
+        });
+        AsyncDataProvider.getHostById(query, vm.getRunOnVds());
     }
 
     @Override
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 312b0c6..33111ad 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
@@ -163,6 +163,7 @@
 ACTION_TYPE_FAILED_VM_IS_NOT_UP=Cannot ${action} ${type}. VM is not up.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN=Cannot ${action} ${type}. At least one of 
the VMs is not down.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP=Cannot ${action} ${type}. VM ${VmName} 
must be in status Down, Up or Paused.
+ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE=Cannot ${action} ${type}. The 
host running VM ${VmName} is not capable of live merging snapshots.
 ACTION_TYPE_FAILED_VM_IS_SAVING_RESTORING=Cannot ${action} ${type}. VM is in 
saving/restoring state.\n\
        -Please try again when the VM is either up or down.
 ACTION_TYPE_FAILED_VM_IS_DURING_SNAPSHOT=Cannot ${action} ${type}. The VM is 
performing an operation on a Snapshot. Please wait for the operation to finish, 
and try again.
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index 0f95c2d..a8a7e65 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -325,6 +325,7 @@
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
+VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.
 MIGRATION_DEST_INVALID_HOSTNAME=Migration destination has an invalid hostname
 MIGRATION_CANCEL_ERROR=Migration not in progress
 DB=Database error.
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 a3787f3..4a9205f 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
@@ -170,6 +170,7 @@
 ACTION_TYPE_FAILED_VM_IS_NOT_UP=Cannot ${action} ${type}. VM is not up.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN=Cannot ${action} ${type}. At least one of 
the VMs is not down.
 ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP=Cannot ${action} ${type}. VM ${VmName} 
must be in status Down, Up or Paused.
+ACTION_TYPE_FAILED_VM_HOST_CANNOT_LIVE_MERGE=Cannot ${action} ${type}. The 
host running VM ${VmName} is not capable of live merging snapshots.
 ACTION_TYPE_FAILED_VM_IS_SAVING_RESTORING=Cannot ${action} ${type}. VM is in 
saving/restoring state.\n\
        -Please try again when the VM is either up or down.
 ACTION_TYPE_FAILED_VM_IS_DURING_SNAPSHOT=Cannot ${action} ${type}. The VM is 
performing an operation on a Snapshot. Please wait for the operation to finish, 
and try again.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
index 14f59b9..148fae6 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/VdsmErrors.properties
@@ -325,6 +325,7 @@
 PROVIDER_SSL_FAILURE=SSL problem while trying to connect to the external 
provider.
 FAILED_UPDATE_RUNNING_VM=Failed to update VM while it is running, please try 
again when the VM is Down.
 VM_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused.
+VM_HOST_CANNOT_LIVE_MERGE=The host on which this VM is running does not 
support live merging snapshots.
 MIGRATION_DEST_INVALID_HOSTNAME=Migration destination has an invalid hostname
 MIGRATION_CANCEL_ERROR=Migration not in progress
 DB=Database error.
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index aa1f630..befa093 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -766,7 +766,8 @@
                       vds_statistics.ha_configured as ha_configured, 
vds_statistics.ha_active as ha_active, vds_statistics.ha_global_maintenance as 
ha_global_maintenance,
                       vds_statistics.ha_local_maintenance as 
ha_local_maintenance, vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy, 
vds_statistics.boot_time as boot_time,
                       vds_dynamic.kdump_status as kdump_status, 
vds_dynamic.selinux_enforce_mode as selinux_enforce_mode,
-                      vds_dynamic.auto_numa_balancing as auto_numa_balancing, 
vds_dynamic.is_numa_supported as is_numa_supported, 
vds_dynamic.is_live_snapshot_supported as is_live_snapshot_supported, 
vds_static.protocol as protocol
+                      vds_dynamic.auto_numa_balancing as auto_numa_balancing, 
vds_dynamic.is_numa_supported as is_numa_supported, 
vds_dynamic.is_live_snapshot_supported as is_live_snapshot_supported, 
vds_static.protocol as protocol,
+                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported
 FROM         vds_groups INNER JOIN
 vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN
 vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN
@@ -813,7 +814,8 @@
                       vds_statistics.boot_time, vds_dynamic.kdump_status as 
kdump_status, vds_dynamic.selinux_enforce_mode as selinux_enforce_mode,
                       vds_dynamic.auto_numa_balancing as auto_numa_balancing, 
vds_dynamic.is_numa_supported as is_numa_supported,
                       vds_dynamic.supported_rng_sources as 
supported_rng_sources,
-                      vds_dynamic.is_live_snapshot_supported as 
is_live_snapshot_supported, vds_static.protocol as protocol
+                      vds_dynamic.is_live_snapshot_supported as 
is_live_snapshot_supported, vds_static.protocol as protocol,
+                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported
 FROM         vds_groups INNER JOIN
 vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN
 vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN
diff --git 
a/packaging/dbscripts/upgrade/03_05_0830_add_live_merge_supported.sql 
b/packaging/dbscripts/upgrade/03_05_0830_add_live_merge_supported.sql
new file mode 100644
index 0000000..b2d4f06
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_0830_add_live_merge_supported.sql
@@ -0,0 +1 @@
+select fn_db_add_column('vds_dynamic', 'is_live_merge_supported', 'boolean not 
null default true');
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 201d3e3..389718a 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -207,14 +207,15 @@
  v_auto_numa_balancing SMALLINT,
  v_is_numa_supported BOOLEAN,
  v_supported_rng_sources VARCHAR(255),
- v_is_live_snapshot_supported BOOLEAN)
+ v_is_live_snapshot_supported BOOLEAN,
+ v_is_live_merge_supported BOOLEAN)
 RETURNS VOID
    AS $procedure$
 BEGIN
 
    BEGIN
-INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, 
software_version, version_name, build_name, previous_status, cpu_flags, 
cpu_over_commit_time_stamp, vms_cores_count, pending_vcpus_count, 
pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, 
supported_engines, host_os, kvm_version, libvirt_version, spice_version, 
gluster_version, kernel_version, iscsi_initiator_name, 
transparent_hugepages_state, hooks, hw_manufacturer, hw_product_name, 
hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, controlled_by_pm_policy, kdump_status, 
selinux_enforce_mode, auto_numa_balancing, is_numa_supported, 
supported_rng_sources, is_live_snapshot_supported)
-       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating,    v_reserved_mem, 
v_guest_overhead, v_rpm_version, v_software_version, v_version_name, 
v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, 
v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, 
v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, 
v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, 
v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, 
v_hooks, v_hw_manufacturer, v_hw_product_name, v_hw_version, 
v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, 
v_supported_emulated_machines, v_controlled_by_pm_policy, v_kdump_status, 
v_selinux_enforce_mode, v_auto_numa_balancing, v_is_numa_supported, 
v_supported_rng_sources, v_is_live_snapshot_supported);
+INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, 
software_version, version_name, build_name, previous_status, cpu_flags, 
cpu_over_commit_time_stamp, vms_cores_count, pending_vcpus_count, 
pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, 
supported_engines, host_os, kvm_version, libvirt_version, spice_version, 
gluster_version, kernel_version, iscsi_initiator_name, 
transparent_hugepages_state, hooks, hw_manufacturer, hw_product_name, 
hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, controlled_by_pm_policy, kdump_status, 
selinux_enforce_mode, auto_numa_balancing, is_numa_supported, 
supported_rng_sources, is_live_snapshot_supported, is_live_merge_supported)
+       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating,    v_reserved_mem, 
v_guest_overhead, v_rpm_version, v_software_version, v_version_name, 
v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, 
v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, 
v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, 
v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, 
v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, 
v_hooks, v_hw_manufacturer, v_hw_product_name, v_hw_version, 
v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, 
v_supported_emulated_machines, v_controlled_by_pm_policy, v_kdump_status, 
v_selinux_enforce_mode, v_auto_numa_balancing, v_is_numa_supported, 
v_supported_rng_sources, v_is_live_snapshot_supported, v_is_live_merge_support!
 ed);
    END;
 
    RETURN;
@@ -289,7 +290,8 @@
  v_auto_numa_balancing SMALLINT,
  v_is_numa_supported BOOLEAN,
  v_supported_rng_sources VARCHAR(255),
- v_is_live_snapshot_supported BOOLEAN)
+ v_is_live_snapshot_supported BOOLEAN,
+ v_is_live_merge_supported BOOLEAN)
 RETURNS VOID
 
        --The [vds_dynamic] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -325,7 +327,8 @@
       auto_numa_balancing = v_auto_numa_balancing,
       is_numa_supported = v_is_numa_supported,
       supported_rng_sources = v_supported_rng_sources,
-      is_live_snapshot_supported = v_is_live_snapshot_supported
+      is_live_snapshot_supported = v_is_live_snapshot_supported,
+      is_live_merge_supported = v_is_live_merge_supported
       WHERE vds_id = v_vds_id;
    END;
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I932a74f4010b8b256f8c0cd27a2279b9d83efbb9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Greg Padgett <gpadg...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to