From fc5c657980b8ca31e5c494a2ebb165ce91518789 Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 7 Jul 2011 19:40:04 -0700 Subject: [PATCH] bug 10608: only one primary storage in a cluster can be in PrepareMaintenance mode --- server/src/com/cloud/storage/StorageManagerImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 7fa1c0f26bf..f3be98c5776 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2048,6 +2048,13 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag throw new ExecutionException(msg); } + List spes = _storagePoolDao.listBy(primaryStorage.getDataCenterId(), primaryStorage.getPodId(), primaryStorage.getClusterId()); + for( StoragePoolVO sp : spes ) { + if( sp.getStatus() == StoragePoolStatus.PrepareForMaintenance ) { + throw new CloudRuntimeException("Only one storage pool in a cluster can be in PrepareForMaintenance mode, " + sp.getId() + " is already in PrepareForMaintenance mode " ); + } + } + if (!primaryStorage.getStatus().equals(StoragePoolStatus.Up) && !primaryStorage.getStatus().equals(StoragePoolStatus.ErrorInMaintenance)) { throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready for migration, as the status is:" + primaryStorage.getStatus().toString()); }