Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -25,7 +25,6 @@
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper;
import org.apache.log4j.Logger;

import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
Expand All @@ -39,9 +38,12 @@
import com.cloud.storage.StoragePoolHostVO;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.utils.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class BasePrimaryDataStoreLifeCycleImpl {
private static final Logger s_logger = Logger.getLogger(BasePrimaryDataStoreLifeCycleImpl.class);
private static final Logger logger = LogManager.getLogger(BasePrimaryDataStoreLifeCycleImpl.class);
Comment thread
vishesh92 marked this conversation as resolved.
Outdated

@Inject
AgentManager agentMgr;
@Inject
Expand Down Expand Up @@ -70,13 +72,13 @@ private List<HostVO> getPoolHostsList(ClusterScope clusterScope, HypervisorType

public void changeStoragePoolScopeToZone(DataStore store, ClusterScope clusterScope, HypervisorType hypervisorType) {
List<HostVO> hosts = getPoolHostsList(clusterScope, hypervisorType);
s_logger.debug("Changing scope of the storage pool to Zone");
logger.debug("Changing scope of the storage pool to Zone");
if (hosts != null) {
for (HostVO host : hosts) {
try {
storageMgr.connectHostToSharedPool(host.getId(), store.getId());
} catch (Exception e) {
s_logger.warn("Unable to establish a connection between " + host + " and " + store, e);
logger.warn("Unable to establish a connection between " + host + " and " + store, e);
}
}
}
Expand All @@ -85,7 +87,7 @@ public void changeStoragePoolScopeToZone(DataStore store, ClusterScope clusterSc

public void changeStoragePoolScopeToCluster(DataStore store, ClusterScope clusterScope, HypervisorType hypervisorType) {
Pair<List<StoragePoolHostVO>, Integer> hostPoolRecords = storagePoolHostDao.listByPoolIdNotInCluster(clusterScope.getScopeId(), store.getId());
s_logger.debug("Changing scope of the storage pool to Cluster");
logger.debug("Changing scope of the storage pool to Cluster");
if (hostPoolRecords.second() > 0) {
StoragePool pool = (StoragePool) store;
for (StoragePoolHostVO host : hostPoolRecords.first()) {
Expand All @@ -94,7 +96,7 @@ public void changeStoragePoolScopeToCluster(DataStore store, ClusterScope cluste

if (answer != null) {
if (!answer.getResult()) {
s_logger.debug("Failed to delete storage pool: " + answer.getResult());
logger.debug("Failed to delete storage pool: " + answer.getResult());
} else if (HypervisorType.KVM != hypervisorType) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public void validateEndDateOnCreatingNewQuotaTariffTestEndDateLessThanNowThrowIn
@Test
public void validateEndDateOnCreatingNewQuotaTariffTestSetValidEndDate() {
Date startDate = DateUtils.addDays(date, -100);
Date endDate = DateUtils.addMilliseconds(new Date(), 1);
Date endDate = DateUtils.addMinutes(new Date(), 1);
Comment thread
vishesh92 marked this conversation as resolved.

quotaResponseBuilderSpy.validateEndDateOnCreatingNewQuotaTariff(quotaTariffVoMock, startDate, endDate);
Mockito.verify(quotaTariffVoMock).setEndDate(Mockito.any(Date.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
//
package com.cloud.hypervisor.kvm.resource.wrapper;

import org.apache.log4j.Logger;

import com.cloud.agent.api.Answer;
import com.cloud.agent.api.CheckConvertInstanceAnswer;
import com.cloud.agent.api.CheckConvertInstanceCommand;
Expand All @@ -30,21 +28,19 @@
@ResourceWrapper(handles = CheckConvertInstanceCommand.class)
public class LibvirtCheckConvertInstanceCommandWrapper extends CommandWrapper<CheckConvertInstanceCommand, Answer, LibvirtComputingResource> {

private static final Logger s_logger = Logger.getLogger(LibvirtCheckConvertInstanceCommandWrapper.class);

@Override
public Answer execute(CheckConvertInstanceCommand cmd, LibvirtComputingResource serverResource) {
if (!serverResource.hostSupportsInstanceConversion()) {
String msg = String.format("Cannot convert the instance from VMware as the virt-v2v binary is not found on host %s. " +
"Please install virt-v2v%s on the host before attempting the instance conversion.", serverResource.getPrivateIp(), serverResource.isUbuntuHost()? ", nbdkit" : "");
s_logger.info(msg);
logger.info(msg);
return new CheckConvertInstanceAnswer(cmd, false, msg);
}

if (cmd.getCheckWindowsGuestConversionSupport() && !serverResource.hostSupportsWindowsGuestConversion()) {
String msg = String.format("Cannot convert the instance from VMware as the virtio-win package is not found on host %s. " +
"Please install virtio-win package on the host before attempting the windows guest instance conversion.", serverResource.getPrivateIp());
s_logger.info(msg);
logger.info(msg);
return new CheckConvertInstanceAnswer(cmd, false, msg);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

import java.util.Map;

import org.apache.log4j.Logger;

import com.cloud.agent.api.Answer;
import com.cloud.agent.api.PrepareStorageClientAnswer;
import com.cloud.agent.api.PrepareStorageClientCommand;
Expand All @@ -35,15 +33,13 @@
@ResourceWrapper(handles = PrepareStorageClientCommand.class)
public class LibvirtPrepareStorageClientCommandWrapper extends CommandWrapper<PrepareStorageClientCommand, Answer, LibvirtComputingResource> {

private static final Logger s_logger = Logger.getLogger(LibvirtPrepareStorageClientCommandWrapper.class);

@Override
public Answer execute(PrepareStorageClientCommand cmd, LibvirtComputingResource libvirtComputingResource) {
final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();
Ternary<Boolean, Map<String, String>, String> prepareStorageClientResult = storagePoolMgr.prepareStorageClient(cmd.getPoolType(), cmd.getPoolUuid(), cmd.getDetails());
if (!prepareStorageClientResult.first()) {
String msg = prepareStorageClientResult.third();
s_logger.debug("Unable to prepare storage client, due to: " + msg);
logger.debug("Unable to prepare storage client, due to: " + msg);
return new PrepareStorageClientAnswer(cmd, false, msg);
}
Map<String, String> details = prepareStorageClientResult.second();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.cloud.hypervisor.kvm.resource.wrapper;

import org.apache.log4j.Logger;

import com.cloud.agent.api.Answer;
import com.cloud.agent.api.UnprepareStorageClientAnswer;
import com.cloud.agent.api.UnprepareStorageClientCommand;
Expand All @@ -33,15 +31,13 @@
@ResourceWrapper(handles = UnprepareStorageClientCommand.class)
public class LibvirtUnprepareStorageClientCommandWrapper extends CommandWrapper<UnprepareStorageClientCommand, Answer, LibvirtComputingResource> {

private static final Logger s_logger = Logger.getLogger(LibvirtUnprepareStorageClientCommandWrapper.class);

@Override
public Answer execute(UnprepareStorageClientCommand cmd, LibvirtComputingResource libvirtComputingResource) {
final KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();
Pair<Boolean, String> unprepareStorageClientResult = storagePoolMgr.unprepareStorageClient(cmd.getPoolType(), cmd.getPoolUuid());
if (!unprepareStorageClientResult.first()) {
String msg = unprepareStorageClientResult.second();
s_logger.debug("Couldn't unprepare storage client, due to: " + msg);
logger.debug("Couldn't unprepare storage client, due to: " + msg);
return new UnprepareStorageClientAnswer(cmd, false, msg);
}
return new UnprepareStorageClientAnswer(cmd, true);
Expand Down
Loading