Roy Golan has uploaded a new change for review.

Change subject: core: on handing over a VM mark it as MigratingTo
......................................................................

core: on handing over a VM mark it as MigratingTo

This patch aims to reflect the VM handover more clear so instead of
moving a VM to Unknown it will move to MigratingTo so tracking a VM
status transition wouldn't puzzle users

Non responding treatment has been changed to collect also VMs that are
migrating to the host (i.e status MigratingTo and run_on_vds == 
nonRespongindVds)

Change-Id: I96b855c11171fd5f65cd2e22801d09608cba805d
Signed-off-by: Roy Golan <rgo...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/909932
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
1 file changed, 20 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/40/13040/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index f41a5b5..5459b45 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -1518,12 +1518,7 @@
             boolean isInMigration = false;
             if (vmToRemove.getStatus() == VMStatus.MigratingFrom) {
                 isInMigration = true;
-                vmToRemove.setRunOnVds(vmToRemove.getmigrating_to_vds());
-                log.infoFormat("Setting VM {0} {1} to status unknown", 
vmToRemove.getName(), vmToRemove.getId());
-                ResourceManager.getInstance().InternalSetVmStatus(vmToRemove, 
VMStatus.Unknown);
-                addVmDynamicToList(vmToRemove.getDynamicData());
-                addVmStatisticsToList(vmToRemove.getStatisticsData());
-                addVmInterfaceStatisticsToList(vmToRemove.getInterfaces());
+                handOverVM(vmToRemove);
             } else {
                 clearVm(vmToRemove,
                         VmExitStatus.Error,
@@ -1552,6 +1547,25 @@
         }
     }
 
+    private void handOverVM(VM vmToRemove) {
+        // handing over the VM to the DST by marking it running on it. it will 
now be its SRC host.
+        vmToRemove.setRunOnVds(vmToRemove.getmigrating_to_vds());
+
+        log.infoFormat("Handing over VM {0} {1} to Host {2}. Setting VM to 
status {3}",
+                vmToRemove.getName(),
+                vmToRemove.getId(),
+                vmToRemove.getmigrating_to_vds(),
+                VMStatus.MigratingTo);
+
+        // if the DST host goes unresponsive it will take care all MigratingTo 
and unknown VMs
+        ResourceManager.getInstance().InternalSetVmStatus(vmToRemove, 
VMStatus.MigratingTo);
+
+        // save the VM state
+        addVmDynamicToList(vmToRemove.getDynamicData());
+        addVmStatisticsToList(vmToRemove.getStatisticsData());
+        addVmInterfaceStatisticsToList(vmToRemove.getInterfaces());
+    }
+
     private boolean inMigrationTo(VmDynamic runningVm, VM vmToUpdate) {
         boolean returnValue = false;
         if (runningVm.getstatus() == VMStatus.MigratingTo) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96b855c11171fd5f65cd2e22801d09608cba805d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <rgo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to