Skip to content
Open
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 @@ -646,25 +646,21 @@ protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStor
if (templatePoolRef == null) {
throw new CloudRuntimeException(String.format("Failed to find template %s in storage pool %s", template.getImage(), dataStore));
} else {
if (logger.isDebugEnabled()) {
logger.debug("Found template {} in storage pool {} with VMTemplateStoragePool: {}", template.getImage(), dataStore, templatePoolRef);
}
logger.debug("Found template {} in storage pool {} with VMTemplateStoragePool: {}", template.getImage(), dataStore, templatePoolRef);
}
long templatePoolRefId = templatePoolRef.getId();
CreateBaseImageContext<CreateCmdResult> context = new CreateBaseImageContext<>(null, volume, dataStore, template, future, templateOnPrimaryStoreObj, templatePoolRefId);
AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> caller = AsyncCallbackDispatcher.create(this);
caller.setCallback(caller.getTarget().copyBaseImageCallback(null, null)).setContext(context);

int storagePoolMaxWaitSeconds = NumbersUtil.parseInt(configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()), 3600);
if (logger.isDebugEnabled()) {
logger.debug("Acquire lock on VMTemplateStoragePool " + templatePoolRefId + " with timeout " + storagePoolMaxWaitSeconds + " seconds");
}

logger.debug("Acquire lock on VMTemplateStoragePool {} with timeout {} seconds", templatePoolRefId, storagePoolMaxWaitSeconds);

templatePoolRef = _tmpltPoolDao.acquireInLockTable(templatePoolRefId, storagePoolMaxWaitSeconds);

if (templatePoolRef == null) {
if (logger.isDebugEnabled()) {
logger.info("Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId);
}
logger.debug("Unable to acquire lock on VMTemplateStoragePool {}", templatePoolRefId);
templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(), template.getId(), deployAsIsConfiguration);
if (templatePoolRef != null && templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready) {
logger.info("Unable to acquire lock on VMTemplateStoragePool {}, But " +
Expand All @@ -675,9 +671,8 @@ protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStor
throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + templatePoolRefId);
}

if (logger.isDebugEnabled()) {
logger.info("lock is acquired for VMTemplateStoragePool " + templatePoolRefId);
}
logger.debug("lock is acquired for VMTemplateStoragePool {}", templatePoolRefId);

try {
if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready) {
logger.info("Template {} is already copied to primary storage, skip copying", template.getImage());
Expand All @@ -694,9 +689,8 @@ protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStor
result.setResult(e.toString());
future.complete(result);
} finally {
if (logger.isDebugEnabled()) {
logger.info("releasing lock for VMTemplateStoragePool " + templatePoolRefId);
}
logger.debug("releasing lock for VMTemplateStoragePool {}", templatePoolRefId);

_tmpltPoolDao.releaseFromLockTable(templatePoolRefId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,11 @@ public boolean checkIfHostHasCapacity(Host host, Integer cpu, long ram, boolean
} else {

if (checkFromReservedCapacity) {
logger.debug("STATS: Failed to alloc resource from host: {} reservedCpu: {}, requested cpu: {}, reservedMem: {}, requested mem: {}", host, reservedCpu, cpu, toHumanReadableSize(reservedMem), toHumanReadableSize(ram));
logger.debug("STATS: Failed to alloc reserved resource from host: {} reservedCpu: {}, requested cpu: {}, reservedMem: {}, requested mem: {}", host, reservedCpu, cpu, toHumanReadableSize(reservedMem), toHumanReadableSize(ram));
logger.info("{} when checking for reserved resources. Checking for available resources now.", failureReason);
} else {
logger.debug("STATS: Failed to alloc resource from host: {}, reservedCpu: {}, used cpu: {}, requested cpu: {}, actual total cpu: {}, total cpu with overprovisioning: {}, reservedMem: {}, used Mem: {}, requested mem: {}, total Mem: {}, considerReservedCapacity?: {}", host, reservedCpu, usedCpu, cpu, actualTotalCpu, totalCpu, toHumanReadableSize(reservedMem), toHumanReadableSize(usedMem), toHumanReadableSize(ram), toHumanReadableSize(totalMem), considerReservedCapacity);
}

if (logger.isDebugEnabled()) {
logger.debug(failureReason + ", cannot allocate to this host.");
logger.info("{} when checking for available resources. Cannot allocate to this host.", failureReason);
}
}

Expand Down
2 changes: 1 addition & 1 deletion utils/src/main/java/com/cloud/utils/LogUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static String logGsonWithoutException(String formatMessage, Object ... ob
} catch (Exception e) {
Object errObj = ObjectUtils.defaultIfNull(object, "null");
LOGGER.trace(String.format("Failed to log object [%s] using GSON.", errObj.getClass().getSimpleName()));
gsons.add("error decoding " + errObj);
gsons.add(errObj.toString());
}
}
try {
Expand Down
Loading