This is an automated email from the ASF dual-hosted git repository.
vishesh pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new 620ed164d8b VMware: Improve error messaging / logs when starting
non-user VMs, and secondary storage not available or doesn't have enough
capacity (#9207)
620ed164d8b is described below
commit 620ed164d8bad44657c3b6478a1bfacb6220a7c0
Author: Suresh Kumar Anaparti <[email protected]>
AuthorDate: Tue Jun 25 12:25:42 2024 +0530
VMware: Improve error messaging / logs when starting non-user VMs, and
secondary storage not available or doesn't have enough capacity (#9207)
---
.../image/manager/ImageStoreProviderManagerImpl.java | 2 +-
.../hypervisor/vmware/manager/VmwareManagerImpl.java | 13 +++++--------
.../hypervisor/vmware/resource/VmwareResource.java | 19 ++++++++++---------
3 files changed, 16 insertions(+), 18 deletions(-)
diff --git
a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
index 5bb0d19be74..27fb77660ac 100644
---
a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
+++
b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/manager/ImageStoreProviderManagerImpl.java
@@ -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;
}
diff --git
a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index b5f4cf3a93f..61a949f42d3 100644
---
a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++
b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -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");
}
}
diff --git
a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 830f4e7a25b..157ed75c9d0 100644
---
a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++
b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -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));
}
}