Arik Hadas has uploaded a new change for review.

Change subject: core: trigger auto-start VMs runner job after live snapshot 
operation
......................................................................

core: trigger auto-start VMs runner job after live snapshot operation

Since live snapshot can be a long operation (if it creates large images
for storing the memory for example) and in that time the VM cannot be
restarted since it is locked, there's a reasonable chance that HA VM
that went down during live snapshot operation won't be able to restart
and will be added to the collection of VMs the auto-start VMs runner job
should run on its next iteration.

So we trigger the auto-start VMs runner job when live snapshot operation
ends so that HA VMs that went down during the process and could not be
restarted because the VM was locked, will be restarted then, without
waiting for the next iteration of the job to occur (which can be after a
long time, depending on the configuration).

The auto-start VMs runner (quartz) job is triggered using the same
mechanism which was implemented for triggering the VM pool monitoring
job after the pool is updated.

Change-Id: I2c6403d69d0b6725d8a1d5e065620d42cb8dfa64
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
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/interfaces/BackendInternal.java
3 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/19164/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
index ef6d914..4332bb6 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
@@ -669,6 +669,12 @@
         SchedulerUtilQuartzImpl.getInstance().triggerJob(poolMonitoringJobId);
     }
 
+    @Override
+    @ExcludeClassInterceptors
+    public void triggerAutoStartVmsRunnerJob() {
+        
SchedulerUtilQuartzImpl.getInstance().triggerJob(autoStartVmsRunnerJobId);
+    }
+
     private void initOsRepository() {
         
OsInfoPreferencesLoader.INSTANCE.init(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getEtcDir().getAbsolutePath(),
 Config.<String>GetValue(ConfigValues.OsRepositoryConfDir)));
         
OsRepositoryImpl.INSTANCE.init(OsInfoPreferencesLoader.INSTANCE.getPreferences());
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 45432ec..b21e363 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
@@ -253,6 +253,13 @@
         endActionOnDisks();
         setSucceeded(taskGroupSucceeded);
         getReturnValue().setEndActionTryAgain(false);
+
+        // Need to release the lock before triggering the auto-start VMs 
runner job
+        freeLock();
+        // This command might be long and while it is being executed the VM 
cannot be restarted
+        // so we're triggering the job that restarts HA VMs when it is 
finished so that if
+        // the VM is HA and it failed in the process, we'll try to run it 
immediately
+        Backend.getInstance().triggerAutoStartVmsRunnerJob();
     }
 
     private void logMemorySavingFailed() {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/interfaces/BackendInternal.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/interfaces/BackendInternal.java
index 5377f94..cd14748 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/interfaces/BackendInternal.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/interfaces/BackendInternal.java
@@ -61,6 +61,11 @@
     void triggerPoolMonitoringJob();
 
     /**
+     * Execute the auto-start VMs runner job immediately
+     */
+    void triggerAutoStartVmsRunnerJob();
+
+    /**
      * Invokes multiple actions of the same action type with different 
parameters under a given execution context which
      * determines the visibility of the action.<br>
      * The context determines the monitoring of the action:


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

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

Reply via email to