use of org.ovirt.engine.core.common.action.MoveDiskParameters in project ovirt-engine by oVirt.
the class BackendVmDiskResource method move.
@Override
public Response move(Action action) {
validateParameters(action, "storageDomain.id|name");
Guid storageDomainId = getStorageDomainId(action);
Disk disk = getDisk();
Guid sourceStorageDomainId = getSourceStorageDomainId(disk);
Guid imageId = getDiskImageId(disk.getImageId());
MoveDiskParameters innerParams = new MoveDiskParameters(imageId, sourceStorageDomainId, storageDomainId);
innerParams.setImageGroupID(asGuid(disk.getId()));
MoveDisksParameters params = new MoveDisksParameters(Collections.singletonList(innerParams));
return doAction(ActionType.MoveDisk, params, action);
}
use of org.ovirt.engine.core.common.action.MoveDiskParameters in project ovirt-engine by oVirt.
the class MoveDiskCommand method executeCommand.
@Override
protected void executeCommand() {
List<DiskVmElement> diskVmElements = diskVmElementDao.getAllDiskVmElementsByDiskId(getParameters().getImageGroupID());
ActionType actionType = getMoveActionType(diskVmElements);
if (actionType == ActionType.MoveOrCopyDisk) {
MoveDiskParameters moveDiskParameters = getParameters();
// This is required to make MoveDiskCommand and MoveOrCopyDiskCommand have
// different a commandId. Having the same commandId will make CommandsCache
// return the wrong command and lead to unexpected results
moveDiskParameters.setCommandId(null);
setReturnValue(runInternalAction(actionType, moveDiskParameters, ExecutionHandler.createInternalJobContext(getContext(), getLock())));
} else {
Guid vmId = diskVmElements.get(0).getVmId();
engineLock = lockVmWithWait(vmId);
setReturnValue(runInternalAction(actionType, createLiveMigrateDiskParameters(getParameters(), vmId), ExecutionHandler.createInternalJobContext(getContext(), engineLock)));
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.MoveDiskParameters in project ovirt-engine by oVirt.
the class BackendDiskResource method move.
@Override
public Response move(Action action) {
validateParameters(action, "storageDomain.id|name");
Guid storageDomainId = getStorageDomainId(action);
Disk disk = get();
Guid imageId = getDiskImageId(disk.getImageId());
Guid sourceStorageDomainId = getSourceStorageDomainId(disk);
MoveDiskParameters params = new MoveDiskParameters(imageId, sourceStorageDomainId, storageDomainId);
params.setImageGroupID(asGuid(disk.getId()));
params.setQuotaId(action.isSetQuota() ? asGuid(action.getQuota().getId()) : null);
params.setDiskProfileId(action.isSetDiskProfile() ? asGuid(action.getDiskProfile().getId()) : null);
return doAction(ActionType.MoveDisk, params, action);
}
use of org.ovirt.engine.core.common.action.MoveDiskParameters in project ovirt-engine by oVirt.
the class MoveDiskModel method createParameters.
@Override
protected MoveOrCopyImageGroupParameters createParameters(Guid sourceStorageDomainGuid, Guid destStorageDomainGuid, DiskImage disk) {
MoveDiskParameters moveDiskParameters = new MoveDiskParameters(disk.getImageId(), sourceStorageDomainGuid, destStorageDomainGuid);
moveDiskParameters.setImageGroupID(disk.getId());
return moveDiskParameters;
}
Aggregations