cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [2/3] git commit: updated refs/heads/vmsync to 1f0186a
Date Wed, 26 Jun 2013 00:19:55 GMT
Migrate bugs fixed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/241d5469
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/241d5469
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/241d5469

Branch: refs/heads/vmsync
Commit: 241d54696e4bce374381ba00c358bff1554d3e97
Parents: fe4cc37
Author: Alex Huang <alex.huang@gmail.com>
Authored: Tue Jun 25 16:49:56 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Tue Jun 25 16:49:56 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java          | 7 +++----
 .../orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java  | 7 ++++++-
 engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java     | 8 +++++++-
 .../src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java       | 4 +++-
 4 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/241d5469/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index f378f4f..3ca651f 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -216,7 +216,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 
     protected static final StateMachine<Step, VirtualMachine.Event> MigrationStateMachine
= new StateMachine<Step, VirtualMachine.Event>();
     static {
-        MigrationStateMachine.addTransition(null, VirtualMachine.Event.MigrationRequested,
Step.Prepare);
+        MigrationStateMachine.addTransition(Step.Filed, VirtualMachine.Event.MigrationRequested,
Step.Prepare);
         MigrationStateMachine.addTransition(Step.Prepare, VirtualMachine.Event.OperationSucceeded,
Step.Migrating);
         MigrationStateMachine.addTransition(Step.Prepare, VirtualMachine.Event.OperationFailed,
Step.Error);
         MigrationStateMachine.addTransition(Step.Migrating, VirtualMachine.Event.OperationSucceeded,
Step.Started);
@@ -1462,16 +1462,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             workJob = new VmWorkJobVO(context.getContextId());
 
             workJob.setDispatcher(VmWorkJobDispatcher.VM_WORK_JOB_DISPATCHER);
-            workJob.setCmd(VmWorkJobDispatcher.Start);
+            workJob.setCmd(VmWorkJobDispatcher.Migrate);
 
             workJob.setAccountId(account.getId());
             workJob.setUserId(user.getId());
-            workJob.setStep(VmWorkJobVO.Step.Migrating);
             workJob.setVmType(vm.getType());
             workJob.setVmInstanceId(vm.getId());
 
             // save work context info (there are some duplications)
-            VmWorkMigrate workInfo = new VmWorkMigrate(user.getId(), account.getId(), vm.getId(),
dest);
+            VmWorkMigrate workInfo = new VmWorkMigrate(user.getId(), account.getId(), vm.getId(),
srcHostId, dest);
             workJob.setCmdInfo(VmWorkJobDispatcher.serialize(workInfo));
 
             _jobMgr.submitAsyncJob(workJob, VmWorkJobDispatcher.VM_WORK_QUEUE, vm.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/241d5469/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
index f869bf6..272a18b 100644
--- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -78,8 +78,10 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
         	
         	if (cmd.equals(Start)) {
                 work = deserialize(VmWorkStart.class, job.getCmdInfo());
-            } else {
+            } else if (cmd.equals(Stop)){
                 work = deserialize(VmWorkStop.class, job.getCmdInfo());
+            } else if (cmd.equals(Migrate)) {
+                work = deserialize(VmWorkMigrate.class, job.getCmdInfo());
             }
         	assert(work != null);
         	
@@ -97,6 +99,9 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
             } else if (cmd.equals(Stop)) {
                 VmWorkStop stop = (VmWorkStop)work;
                 _vmMgr.orchestrateStop(vm.getUuid(), stop.isCleanup());
+            } else if (cmd.equals(Migrate)) {
+                VmWorkMigrate migrate = (VmWorkMigrate)work;
+                _vmMgr.orchestrateMigrate(vm.getUuid(), migrate.getSrcHostId(), migrate.getDeployDestination());
             }
             _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.SUCCEEDED, 0, null);
         } catch(Throwable e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/241d5469/engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java b/engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java
index 85892fd..f4543b8 100644
--- a/engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java
+++ b/engine/orchestration/src/com/cloud/vm/VmWorkMigrate.java
@@ -34,9 +34,11 @@ public class VmWorkMigrate extends VmWork {
     Long clusterId;
     Long hostId;
     private Map<String, String> storage;
+    long srcHostId;
 
-    public VmWorkMigrate(long userId, long accountId, long vmId, DeployDestination dst) {
+    public VmWorkMigrate(long userId, long accountId, long vmId, long srcHostId, DeployDestination
dst) {
         super(userId, accountId, vmId);
+        this.srcHostId = srcHostId;
         zoneId = dst.getDataCenter() != null ? dst.getDataCenter().getId() : null;
         podId = dst.getPod() != null ? dst.getPod().getId() : null;
         clusterId = dst.getCluster() != null ? dst.getCluster().getId() : null;
@@ -70,6 +72,10 @@ public class VmWorkMigrate extends VmWork {
         return dest;
     }
 
+    public long getSrcHostId() {
+        return srcHostId;
+    }
+
     static private EntityManager s_entityMgr;
 
     static public void init(EntityManager entityMgr) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/241d5469/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java
index e8c0304..824f8e7 100644
--- a/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java
+++ b/engine/schema/src/org/apache/cloudstack/vm/jobs/VmWorkJobVO.java
@@ -35,9 +35,10 @@ import com.cloud.vm.VirtualMachine;
 @PrimaryKeyJoinColumn(name="id")
 public class VmWorkJobVO extends AsyncJobVO {
 
-    // These steps are rather arbiturary.  What's recorded depends on the
+    // These steps are rather arbitrary.  What's recorded depends on the
     // the operation being performed.
 	public enum Step {
+        Filed(false),
         Prepare(false),
         Starting(true),
         Started(false),
@@ -71,6 +72,7 @@ public class VmWorkJobVO extends AsyncJobVO {
     }
 
     public VmWorkJobVO(String related) {
+        step = Step.Filed;
         setRelated(related);
     }
     


Mime
View raw message