mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
VMware: Improve error messaging / logs when starting non-user VMs, and secondary storage not available or doesn't have enough capacity (#9207)
This commit is contained in:
parent
6ee6603359
commit
620ed164d8
@ -201,7 +201,7 @@ public class ImageStoreProviderManagerImpl implements ImageStoreProviderManager,
|
||||
|
||||
// No store with space found
|
||||
s_logger.error(String.format("Can't find an image storage in zone with less than %d usage",
|
||||
Math.round(_statsCollector.getImageStoreCapacityThreshold()*100)));
|
||||
Math.round(_statsCollector.getImageStoreCapacityThreshold() * 100)));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -562,7 +562,6 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
|
||||
@Override
|
||||
public Pair<String, Long> getSecondaryStorageStoreUrlAndId(long dcId) {
|
||||
|
||||
String secUrl = null;
|
||||
Long secId = null;
|
||||
DataStore secStore = _dataStoreMgr.getImageStoreWithFreeCapacity(dcId);
|
||||
@ -572,18 +571,17 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
}
|
||||
|
||||
if (secUrl == null) {
|
||||
// we are using non-NFS image store, then use cache storage instead
|
||||
s_logger.info("Secondary storage is not NFS, we need to use staging storage");
|
||||
s_logger.info("Secondary storage is either not having free capacity or not NFS, then use cache/staging storage instead");
|
||||
DataStore cacheStore = _dataStoreMgr.getImageCacheStore(dcId);
|
||||
if (cacheStore != null) {
|
||||
secUrl = cacheStore.getUri();
|
||||
secId = cacheStore.getId();
|
||||
} else {
|
||||
s_logger.warn("No staging storage is found when non-NFS secondary storage is used");
|
||||
s_logger.warn("No cache/staging storage found when NFS secondary storage with free capacity not available or non-NFS secondary storage is used");
|
||||
}
|
||||
}
|
||||
|
||||
return new Pair<String, Long>(secUrl, secId);
|
||||
return new Pair<>(secUrl, secId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -599,13 +597,12 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
}
|
||||
|
||||
if (urlIdList.isEmpty()) {
|
||||
// we are using non-NFS image store, then use cache storage instead
|
||||
s_logger.info("Secondary storage is not NFS, we need to use staging storage");
|
||||
s_logger.info("Secondary storage is either not having free capacity or not NFS, then use cache/staging storage instead");
|
||||
DataStore cacheStore = _dataStoreMgr.getImageCacheStore(dcId);
|
||||
if (cacheStore != null) {
|
||||
urlIdList.add(new Pair<>(cacheStore.getUri(), cacheStore.getId()));
|
||||
} else {
|
||||
s_logger.warn("No staging storage is found when non-NFS secondary storage is used");
|
||||
s_logger.warn("No cache/staging storage found when NFS secondary storage with free capacity not available or non-NFS secondary storage is used");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ import java.util.stream.Collectors;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.hypervisor.vmware.mo.HostDatastoreBrowserMO;
|
||||
import com.vmware.vim25.FileInfo;
|
||||
import com.vmware.vim25.FileQueryFlags;
|
||||
@ -2279,15 +2280,15 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
// attach ISO (for patching of system VM)
|
||||
Pair<String, Long> secStoreUrlAndId = mgr.getSecondaryStorageStoreUrlAndId(Long.parseLong(_dcId));
|
||||
String secStoreUrl = secStoreUrlAndId.first();
|
||||
Long secStoreId = secStoreUrlAndId.second();
|
||||
if (secStoreUrl == null) {
|
||||
String msg = "secondary storage for dc " + _dcId + " is not ready yet?";
|
||||
String msg = String.format("NFS secondary or cache storage of dc %s either doesn't have enough capacity (has reached %d%% usage threshold) or not ready yet, or non-NFS secondary storage is used",
|
||||
_dcId, Math.round(CapacityManager.SecondaryStorageCapacityThreshold.value() * 100));
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
ManagedObjectReference morSecDs = prepareSecondaryDatastoreOnHost(secStoreUrl);
|
||||
if (morSecDs == null) {
|
||||
String msg = "Failed to prepare secondary storage on host, secondary store url: " + secStoreUrl;
|
||||
String msg = "Failed to prepare secondary storage on host, NFS secondary or cache store url: " + secStoreUrl + " in dc "+ _dcId;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
DatastoreMO secDsMo = new DatastoreMO(hyperHost.getContext(), morSecDs);
|
||||
@ -4613,15 +4614,15 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
List<Pair<String, Long>> secStoreUrlAndIdList = mgr.getSecondaryStorageStoresUrlAndIdList(Long.parseLong(_dcId));
|
||||
for (Pair<String, Long> secStoreUrlAndId : secStoreUrlAndIdList) {
|
||||
String secStoreUrl = secStoreUrlAndId.first();
|
||||
Long secStoreId = secStoreUrlAndId.second();
|
||||
if (secStoreUrl == null) {
|
||||
String msg = String.format("Secondary storage for dc %s is not ready yet?", _dcId);
|
||||
String msg = String.format("NFS secondary or cache storage of dc %s either doesn't have enough capacity (has reached %d%% usage threshold) or not ready yet, or non-NFS secondary storage is used",
|
||||
_dcId, Math.round(CapacityManager.SecondaryStorageCapacityThreshold.value() * 100));
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
ManagedObjectReference morSecDs = prepareSecondaryDatastoreOnHost(secStoreUrl);
|
||||
if (morSecDs == null) {
|
||||
String msg = "Failed to prepare secondary storage on host, secondary store url: " + secStoreUrl;
|
||||
String msg = "Failed to prepare secondary storage on host, NFS secondary or cache store url: " + secStoreUrl + " in dc "+ _dcId;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
@ -7342,14 +7343,14 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
VmwareManager mgr = targetHyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
|
||||
Pair<String, Long> secStoreUrlAndId = mgr.getSecondaryStorageStoreUrlAndId(Long.parseLong(_dcId));
|
||||
String secStoreUrl = secStoreUrlAndId.first();
|
||||
Long secStoreId = secStoreUrlAndId.second();
|
||||
if (secStoreUrl == null) {
|
||||
String msg = "secondary storage for dc " + _dcId + " is not ready yet?";
|
||||
String msg = String.format("NFS secondary or cache storage of dc %s either doesn't have enough capacity (has reached %d%% usage threshold) or not ready yet, or non-NFS secondary storage is used",
|
||||
_dcId, Math.round(CapacityManager.SecondaryStorageCapacityThreshold.value() * 100));
|
||||
throw new Exception(msg);
|
||||
}
|
||||
ManagedObjectReference morSecDs = prepareSecondaryDatastoreOnSpecificHost(secStoreUrl, targetHyperHost);
|
||||
if (morSecDs == null) {
|
||||
throw new Exception(String.format("Failed to prepare secondary storage on host, secondary store url: %s", secStoreUrl));
|
||||
throw new Exception(String.format("Failed to prepare secondary storage on host, NFS secondary or cache store url: %s in dc %s", secStoreUrl, _dcId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user