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;
}
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;
}
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);
}
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;
}
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);
}
}
Aggregations