Leonardo Bianconi has uploaded a new change for review.

Change subject: core, engine: Prevent memory snapshot in ppc64
......................................................................

core, engine: Prevent memory snapshot in ppc64

This change disables memory snapshot in the back end for clusters
with architecture that doesn't support it.
All logic was added in conjunction with the snapshot validation from
the class FeatureSupported.

Change-Id: I4f201b63ddf441a9bc76a37fda33f54fa766d937
https://bugzilla.redhat.com/show_bug.cgi?id=1061774
Signed-off-by: Leonardo Bianconi <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
3 files changed, 19 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/25073/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 5e269e9..5c02a45 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
@@ -179,7 +179,7 @@
     }
 
     private MemoryImageBuilder createMemoryImageBuilder() {
-        if 
(!FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion())) {
+        if (!isMemorySnapshotSupported()) {
             return new NullableMemoryImageBuilder();
         }
 
@@ -369,7 +369,7 @@
         // 'filteredPluggedDisks' should contain only disks from 
'getDisksList()' that are plugged to the VM.
         List<DiskImage> filteredPluggedDisks = 
ImagesHandler.imagesIntersection(filteredPluggedDisksForVm, getDisksList());
 
-        if 
(FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion())) {
+        if (isMemorySnapshotSupported()) {
             return new SnapshotVDSCommandParameters(getVm().getRunOnVds(),
                     getVm().getId(),
                     filteredPluggedDisks,
@@ -382,6 +382,15 @@
         }
     }
 
+    /**
+     * Check if Memory Snapshot is supported
+     * @return
+     */
+    private boolean isMemorySnapshotSupported () {
+        return 
FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion())
+                && 
FeatureSupported.isMemorySnapshotSupportedByArchitecture(getVm().getClusterArch(),
 getVm().getVdsGroupCompatibilityVersion());
+    }
+
     private void handleVdsLiveSnapshotFailure(VdcBLLException e) {
         log.warnFormat("Wasn't able to live snapshot due to error: {0}. VM 
will still be configured to the new created snapshot",
                 ExceptionUtils.getMessage(e));
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 498f2a2..1ee0ad1 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -135,7 +135,10 @@
             VmHandler.updateDisksForVm(getVm(), 
getDiskDao().getAllForVm(getVm().getId()));
 
             if (getVm().getStatus() != VMStatus.Suspended) {
-                memorySnapshotSupported = 
FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion());
+                boolean archSupportSnapshot = 
FeatureSupported.isMemorySnapshotSupportedByArchitecture(
+                        getVm().getClusterArch(),
+                        getVm().getVdsGroupCompatibilityVersion());
+                memorySnapshotSupported = archSupportSnapshot && 
FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion());
                 // If the VM is not hibernated, save the hibernation volume 
from the baseline snapshot
                 memoryVolumeFromSnapshot = 
getActiveSnapshot().getMemoryVolume();
             }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
index c60e28f..0c7da9a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
@@ -121,7 +121,10 @@
     @Override
     protected void executeVmCommand() {
         final boolean restoreMemory = getParameters().isRestoreMemory() &&
-                
FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion());
+                
FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion()) &&
+                FeatureSupported.isMemorySnapshotSupportedByArchitecture(
+                        getVm().getClusterArch(),
+                        getVm().getVdsGroupCompatibilityVersion());
 
         final Guid newActiveSnapshotId = Guid.newGuid();
         final Snapshot snapshotToBePreviewed = getDstSnapshot();


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

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

Reply via email to