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 <[email protected]>
---
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/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/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/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/dataprovider/AsyncDataProvider.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/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_06_0070_add_live_merge_supported.sql
M packaging/dbscripts/vds_sp.sql
20 files changed, 111 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/30773/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..7275981 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,19 @@
 
     @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()
+                        || getVm().getRunOnVds() == null
+                        || 
!getVdsDAO().get(getVm().getRunOnVds()).getLiveMergeSupport()) {
+                    log.error("Cannot remove VM snapshot. Vm is not Down, Up 
or Paused," +
+                              " or is running on a host that does not support 
Live Merge");
+                    throw new 
VdcBLLException(VdcBllErrors.VM_NOT_QUALIFIED_FOR_SNAPSHOT_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 +304,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..e59ad5e 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
@@ -61,6 +61,22 @@
         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);
+            }
+        }
+
+        return ValidationResult.VALID;
+    }
+
     public ValidationResult vmNotLocked() {
         for (VM vm : vms) {
             if (vm.getStatus() == VMStatus.ImageLocked) {
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..f5e2df6 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/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index c2c65a8..2a9397f 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
@@ -159,6 +159,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 01a9b1d..9bf9c53 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
@@ -104,6 +104,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;
         }
@@ -256,7 +257,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 1afd979..4b0a855 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -172,6 +172,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/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..87f22c1 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(Boolean.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 3670f39..f3fcbe5 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 b65f597..fd3f399 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
@@ -445,6 +445,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/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index 27e75aa..5db52e5 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
@@ -404,6 +404,10 @@
     }
 
     public boolean isLiveMergeSupported(VM vm) {
+        if (vm == null || vm.getRunOnVds() == null) {
+            return false;
+        }
+        Guid vdsId = vm.getRunOnVds();
         return (vm != null && (Boolean) getConfigValuePreConverted(
                 ConfigurationValues.LiveMergeSupported,
                 vm.getVdsGroupCompatibilityVersion().toString()));
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 d37e72b..cc8c633 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,21 @@
 
         VM vm = (VM) entity;
 
-        
setLiveMergeSupported(AsyncDataProvider.getInstance().isLiveMergeSupported(vm));
+        if (vm.getRunOnVds() == null || 
!AsyncDataProvider.getInstance().isLiveMergeSupported(vm)) {
+            setLiveMergeSupported(false);
+            return;
+        }
+
+        // TODO GP
+        AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() {
+            @Override
+            public void onSuccess(Object model, Object returnValue) {
+                VmSnapshotListModel target = (VmSnapshotListModel) model;
+                VDS vds = (VDS) returnValue;
+                target.setLiveMergeSupported(vds.getLiveMergeSupport());
+            }
+        });
+        AsyncDataProvider.getInstance().getHostById(query, vm.getRunOnVds());
     }
 
     @Override
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..e7b8a12 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
@@ -324,7 +324,7 @@
 PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR=Failed to import provider certificate 
chain.
 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_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused. If running, the host must also be capable of 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 5c2a823..b863d48 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
@@ -169,6 +169,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..80a677b 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
@@ -324,7 +324,7 @@
 PROVIDER_IMPORT_CERTIFICATE_CHAIN_ERROR=Failed to import provider certificate 
chain.
 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_NOT_QUALIFIED_FOR_SNAPSHOT_MERGE=To merge snapshots, a VM must be Down, Up 
or Paused. If running, the host must also be capable of 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 1c8288d..ed68b35 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_06_0070_add_live_merge_supported.sql 
b/packaging/dbscripts/upgrade/03_06_0070_add_live_merge_supported.sql
new file mode 100644
index 0000000..b2d4f06
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_06_0070_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/30773
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to