public static LockStatus LockAllOrNone(List <DynamicDisk> disksToLock, List <DynamicVolume> volumesToLock) { bool success = DiskLockHelper.LockAllOrNone(disksToLock); if (!success) { return(LockStatus.CannotLockDisk); } success = WindowsDynamicVolumeHelper.LockAllMountedOrNone(volumesToLock); if (!success) { DiskLockHelper.ReleaseLock(disksToLock); return(LockStatus.CannotLockVolume); } return(LockStatus.Success); }
public static LockStatus LockDynamicDiskGroup(List <DynamicDisk> disksToLock, bool lockAllDynamicVolumes) { List <DynamicVolume> volumesToLock = new List <DynamicVolume>(); if (lockAllDynamicVolumes) { volumesToLock = WindowsDynamicVolumeHelper.GetLockableDynamicVolumes(disksToLock); } LockStatus status = LockHelper.LockAllOrNone(disksToLock, volumesToLock); if (status == LockStatus.Success) { m_lockedDisks.AddRange(disksToLock); m_lockedVolumes.AddRange(volumesToLock); } return(status); }