Search in sources :

Example 26 with EngineLock

use of org.ovirt.engine.core.utils.lock.EngineLock in project ovirt-engine by oVirt.

the class GlusterVolumeSnapshotCommandBase method acquireVolumeSnapshotLock.

protected EngineLock acquireVolumeSnapshotLock(Guid id) {
    EngineLock lock = new EngineLock(Collections.singletonMap(id.toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_SNAPSHOT, EngineMessage.ACTION_TYPE_FAILED_VOLUME_SNAPSHOT_LOCKED)), null);
    lockManager.acquireLockWait(lock);
    return lock;
}
Also used : EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 27 with EngineLock

use of org.ovirt.engine.core.utils.lock.EngineLock in project ovirt-engine by oVirt.

the class MoveDiskCommand method lockVmWithWait.

protected EngineLock lockVmWithWait(Guid vmId) {
    EngineLock liveStorageMigrationEngineLock = new EngineLock();
    liveStorageMigrationEngineLock.setExclusiveLocks(Collections.singletonMap(vmId.toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.LIVE_STORAGE_MIGRATION, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED)));
    lockManager.acquireLockWait(liveStorageMigrationEngineLock);
    return liveStorageMigrationEngineLock;
}
Also used : EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 28 with EngineLock

use of org.ovirt.engine.core.utils.lock.EngineLock in project ovirt-engine by oVirt.

the class BaseImagesCommand method lockVmSnapshotsWithWait.

protected void lockVmSnapshotsWithWait(VM vm) {
    snapshotsEngineLock = new EngineLock();
    Map<String, Pair<String, String>> snapshotsExlusiveLockMap = Collections.singletonMap(vm.getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_SNAPSHOTS, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED));
    snapshotsEngineLock.setExclusiveLocks(snapshotsExlusiveLockMap);
    lockManager.acquireLockWait(snapshotsEngineLock);
}
Also used : EngineLock(org.ovirt.engine.core.utils.lock.EngineLock) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 29 with EngineLock

use of org.ovirt.engine.core.utils.lock.EngineLock in project ovirt-engine by oVirt.

the class AbstractDiskVmCommand method lockVmDiskHotPlugWithWait.

protected EngineLock lockVmDiskHotPlugWithWait() {
    EngineLock vmDiskHotPlugEngineLock = new EngineLock();
    vmDiskHotPlugEngineLock.setExclusiveLocks(Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_DISK_HOT_PLUG, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED)));
    lockManager.acquireLockWait(vmDiskHotPlugEngineLock);
    return vmDiskHotPlugEngineLock;
}
Also used : EngineLock(org.ovirt.engine.core.utils.lock.EngineLock)

Example 30 with EngineLock

use of org.ovirt.engine.core.utils.lock.EngineLock in project ovirt-engine by oVirt.

the class RemoveCinderDiskCommand method freeVmSnapshotsWithWait.

private void freeVmSnapshotsWithWait() {
    if (getParameters().getVmId() != null) {
        EngineLock snapshotsEngineLock = new EngineLock();
        Map<String, Pair<String, String>> snapshotsExclusiveLockMap = Collections.singletonMap(getParameters().getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_SNAPSHOTS, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED));
        snapshotsEngineLock.setExclusiveLocks(snapshotsExclusiveLockMap);
        lockManager.releaseLock(snapshotsEngineLock);
    }
}
Also used : EngineLock(org.ovirt.engine.core.utils.lock.EngineLock) Pair(org.ovirt.engine.core.common.utils.Pair)

Aggregations

EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)54 Pair (org.ovirt.engine.core.common.utils.Pair)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)11 HashMap (java.util.HashMap)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)9 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)9 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)8 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)7 Guid (org.ovirt.engine.core.compat.Guid)6 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)5 EngineException (org.ovirt.engine.core.common.errors.EngineException)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 Date (java.util.Date)3 Set (java.util.Set)3 GlusterServerInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo)3 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)3 Network (org.ovirt.engine.core.common.businessentities.network.Network)3 Callable (java.util.concurrent.Callable)2 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)2