Merge pull request #725 from koushik-das/CLOUDSTACK-8754

CLOUDSTACK-8754: VM migration triggered by dynamic scaling is failingThis is caused by serialization failure for VmWorkMigrateForScale object. Replaced DeployDestination member present in VmWorkMigrateForScale with serializable types.

Haven't added any unit test as couldn't find a clean way to do it. Simply adding a test to do (de)serialization won't help catch any new member addition to the type which breaks serializability.

* pr/725:
  CLOUDSTACK-8754: VM migration triggered by dynamic scaling is failing This is caused by serialization failure for VmWorkMigrateForScale object. Replaced DeployDestination member present in VmWorkMigrateForScale with serializable types.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-08-26 14:24:38 +05:30
commit 22fad9d515
2 changed files with 4 additions and 16 deletions

View File

@ -4297,7 +4297,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob = new VmWorkJobVO(context.getContextId());
workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
workJob.setCmd(VmWorkMigrate.class.getName());
workJob.setCmd(VmWorkMigrateWithStorage.class.getName());
workJob.setAccountId(account.getId());
workJob.setUserId(user.getId());
@ -4340,7 +4340,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
workJob = new VmWorkJobVO(context.getContextId());
workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
workJob.setCmd(VmWorkMigrate.class.getName());
workJob.setCmd(VmWorkMigrateForScale.class.getName());
workJob.setAccountId(account.getId());
workJob.setUserId(user.getId());

View File

@ -18,30 +18,18 @@ package com.cloud.vm;
import com.cloud.deploy.DeployDestination;
public class VmWorkMigrateForScale extends VmWork {
public class VmWorkMigrateForScale extends VmWorkMigrate {
private static final long serialVersionUID = 6854870395568389613L;
long srcHostId;
DeployDestination deployDestination;
Long newSvcOfferingId;
public VmWorkMigrateForScale(long userId, long accountId, long vmId, String handlerName, long srcHostId,
DeployDestination dest, Long newSvcOfferingId) {
super(userId, accountId, vmId, handlerName);
this.srcHostId = srcHostId;
deployDestination = dest;
super(userId, accountId, vmId, handlerName, srcHostId, dest);
this.newSvcOfferingId = newSvcOfferingId;
}
public long getSrcHostId() {
return srcHostId;
}
public DeployDestination getDeployDestination() {
return deployDestination;
}
public Long getNewServiceOfferringId() {
return newSvcOfferingId;
}