Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public int compare(DataStore store1, DataStore store2) {

// 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceCon

@Override
public Pair<String, Long> getSecondaryStorageStoreUrlAndId(long dcId) {

String secUrl = null;
Long secId = null;
DataStore secStore = _dataStoreMgr.getImageStoreWithFreeCapacity(dcId);
Expand All @@ -572,18 +571,17 @@ public Pair<String, Long> getSecondaryStorageStoreUrlAndId(long dcId) {
}

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
Expand All @@ -599,13 +597,12 @@ public List<Pair<String, Long>> getSecondaryStorageStoresUrlAndIdList(long dcId)
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
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;
Expand Down Expand Up @@ -2279,15 +2280,15 @@ protected StartAnswer execute(StartCommand cmd) {
// 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);
Expand Down Expand Up @@ -4613,15 +4614,15 @@ protected Answer execute(PrepareForMigrationCommand cmd) {
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);
}
}
Expand Down Expand Up @@ -7342,14 +7343,14 @@ private List<VolumeObjectTO> relocateVirtualMachine(final VmwareHypervisorHost h
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));
}
}

Expand Down