Allon Mureinik has uploaded a new change for review. Change subject: core: Move lock RunVmCommand -> RunVmCommandBase ......................................................................
core: Move lock RunVmCommand -> RunVmCommandBase Move RunVmCommand's exclusive lock up to its ancestor, RunVmCommandBase. RunVmCommand and all it's extending classes' locking will remain unchanged (as they inherit the lock from RunVmCommandBase), and the migration flows will also benefit from the lock. This is done in order to solve a race in virt/storage migration flows, like the bug mentioned below, and makes sense regardless - you can't start running a VM, e.g., if it's in the middle of migrating to another host. Change-Id: I8cbea4ae3a8bc47b4bbc451d8ecd3080287a3df0 Bug-Url: https://bugzilla.redhat.com/878131 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java 2 files changed, 12 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/12315/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java index fa64220..931cbf5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java @@ -36,19 +36,18 @@ import org.ovirt.engine.core.common.businessentities.FileTypeExtension; import org.ovirt.engine.core.common.businessentities.RepoFileMetaData; import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType; -import org.ovirt.engine.core.common.businessentities.network.Network; -import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; +import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; import org.ovirt.engine.core.common.businessentities.StorageDomainType; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VMStatus; -import org.ovirt.engine.core.common.businessentities.StorageDomain; +import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllErrors; import org.ovirt.engine.core.common.job.Job; import org.ovirt.engine.core.common.job.Step; import org.ovirt.engine.core.common.job.StepEnum; -import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.utils.VmDeviceType; import org.ovirt.engine.core.common.vdscommands.CreateVmVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.IrsBaseVDSCommandParameters; @@ -846,11 +845,6 @@ return false; } return true; - } - - @Override - protected Map<String, Pair<String, String>> getExclusiveLocks() { - return Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.VM); } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java index 006b26e..135d85d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java @@ -3,8 +3,10 @@ import static org.ovirt.engine.core.common.config.ConfigValues.VdsRefreshRate; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; @@ -20,16 +22,17 @@ import org.ovirt.engine.core.common.businessentities.IVdsAsyncCommand; import org.ovirt.engine.core.common.businessentities.LUNs; import org.ovirt.engine.core.common.businessentities.LunDisk; +import org.ovirt.engine.core.common.businessentities.StorageServerConnections; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSType; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmDynamic; -import org.ovirt.engine.core.common.businessentities.StorageServerConnections; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.job.Job; import org.ovirt.engine.core.common.job.JobExecutionStatus; +import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.vdscommands.FailedToRunVmVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.UpdateVdsDynamicDataVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.UpdateVmDynamicDataVDSCommandParameters; @@ -486,4 +489,9 @@ public void onPowerringUp() { decreasePendingVms(getCurrentVdsId()); } + + @Override + protected Map<String, Pair<String, String>> getExclusiveLocks() { + return Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.VM); + } } -- To view, visit http://gerrit.ovirt.org/12315 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cbea4ae3a8bc47b4bbc451d8ecd3080287a3df0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
