mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
Normalize loggers and upgrade log4j 1.2 to log4j 2.19 (#7131)
* Normalize logs All classes that could have their loggers inherited from their fathers had their own loggers deleted; Most loggers didn't have to be static, so most of them were normalized so that they wouldn't be; All loggers are protected now; Static logger's name are now 'LOGGER'; Non-static logger's name are now 'logger'; New class DbUpgradeAbstractImpl created so that all Upgraders extend it and inherit its logger * Upgrade log4j * fix errors caused by the merge * Refactor cglibThrowableRenderer functionality to log4j2 and upgrade the last configuration files * fix sonarcloud bug * Fix errors caused by merge, remove some unused loggers, and rename a variable that was mistakenly renamed on the normalization commit * Readd snmpTrapAppender, remove TestAppender * Regenerate changes * regenerate changes * refactor last custom appender * fix systemvm configuration xml * Regenerate changes * Regenerate changes * regenerate changes * Regenerate changes * regenerate changes * regenerate changes * regenerate changes * Fix utils pom * fix some tests * regenerate changes * Fix jar being printed on exception * fix logging in system VMs, fix commands not having log4j2 classpath. * regenerate changes * Fix some unwanted renomeations * fix end of file * regenerate changes * regenerate changes * fix merge error * regenerate changes * fix tests * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * readd reload4j to tungsten as juniper depends on it * Regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * re-add reload4j dependency to network-contrail, as juniper depends on it * regenerate changes * regenerate changes * regenerate changes * fix typo * regenerate changes * regenerate changes * Fix end of files * regenerate changes * add logj42 to cloud-utils-SHADED.jar * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * regenerate changes * Regenerate changes * Regenerate changes * Regenerate changes * regenerate changes * Regenerate changes * regenerate changes * Regenerate changes * Regenerate changes * Regenerate changes * regenerate changes * Regenerate changes * Regenerate changes * fix some tests * Regenerate changes * Regenerate changes * fix test * Regenerate changes * Regenerate changes
This commit is contained in:
parent
2bfa9de282
commit
49cecaed06
@ -17,91 +17,60 @@ KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<Configuration monitorInterval="60">
|
||||
<Appenders>
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
|
||||
<!-- ================================= -->
|
||||
<!-- Preserve messages in a local file -->
|
||||
<!-- ================================= -->
|
||||
|
||||
<!-- ================================= -->
|
||||
<!-- Preserve messages in a local file -->
|
||||
<!-- ================================= -->
|
||||
<!-- A time/date based rolling appender -->
|
||||
<RollingFile name="FILE" append="true" fileName="@AGENTLOG@" filePattern="@AGENTLOG@.%d{yyyy-MM-dd}.gz">
|
||||
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
</Policies>
|
||||
<PatternLayout pattern="%d{ISO8601} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
|
||||
</RollingFile>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
|
||||
<param name="Append" value="true"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
|
||||
<param name="FileNamePattern" value="@AGENTLOG@.%d{yyyy-MM-dd}.gz"/>
|
||||
<param name="ActiveFileName" value="@AGENTLOG@"/>
|
||||
</rollingPolicy>
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- ============================== -->
|
||||
<!-- Append messages to the console -->
|
||||
<!-- ============================== -->
|
||||
<!-- ============================== -->
|
||||
<!-- Append messages to the console -->
|
||||
<!-- ============================== -->
|
||||
|
||||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
<Console name="CONSOLE" target="SYSTEM_OUT">
|
||||
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<Loggers>
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
|
||||
<category name="com.cloud">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="com.cloud.agent.metrics">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="com.cloud.agent.resource.computing.ComputingResource$StorageMonitorTask">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="com.cloud" level="INFO"/>
|
||||
|
||||
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
|
||||
<category name="org.apache">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="org.apache" level="INFO"/>
|
||||
|
||||
<category name="org">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="net">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="org" level="INFO"/>
|
||||
|
||||
<!-- Limit the com.amazonaws category to INFO as its DEBUG is verbose -->
|
||||
<category name="com.amazonaws">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="net" level="INFO"/>
|
||||
|
||||
<!-- Limit the httpclient.wire category to INFO as its DEBUG is verbose -->
|
||||
<category name="httpclient.wire">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="com.amazonaws" level="INFO"/>
|
||||
|
||||
<category name="org.apache.http.wire">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="httpclient.wire" level="INFO"/>
|
||||
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
<Logger name="org.apache.http.wire" level="INFO"/>
|
||||
|
||||
<root>
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
|
||||
</log4j:configuration>
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="CONSOLE"/>
|
||||
<AppenderRef ref="FILE"/>
|
||||
</Root>
|
||||
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
||||
@ -56,8 +56,8 @@ import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
import com.cloud.agent.api.AgentControlCommand;
|
||||
@ -89,6 +89,7 @@ import com.cloud.utils.nio.NioConnection;
|
||||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.script.OutputInterpreter;
|
||||
import com.cloud.utils.script.Script;
|
||||
import org.apache.logging.log4j.ThreadContext;
|
||||
|
||||
/**
|
||||
* @config
|
||||
@ -104,7 +105,7 @@ import com.cloud.utils.script.Script;
|
||||
*
|
||||
**/
|
||||
public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater {
|
||||
protected static Logger s_logger = Logger.getLogger(Agent.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public enum ExitStatus {
|
||||
Normal(0), // Normal status = 0.
|
||||
@ -181,7 +182,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
final String value = _shell.getPersistentProperty(getResourceName(), "id");
|
||||
_id = value != null ? Long.parseLong(value) : null;
|
||||
s_logger.info("id is " + (_id != null ? _id : ""));
|
||||
logger.info("id is " + (_id != null ? _id : ""));
|
||||
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
|
||||
@ -199,7 +200,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
// ((NioClient)_connection).setBindAddress(_shell.getPrivateIp());
|
||||
|
||||
s_logger.debug("Adding shutdown hook");
|
||||
logger.debug("Adding shutdown hook");
|
||||
Runtime.getRuntime().addShutdownHook(_shutdownThread);
|
||||
|
||||
_ugentTaskPool =
|
||||
@ -210,7 +211,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
|
||||
"agentRequest-Handler"));
|
||||
|
||||
s_logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() +
|
||||
logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() +
|
||||
" : workers = " + _shell.getWorkers() + " : host = " + host + " : port = " + _shell.getPort());
|
||||
}
|
||||
|
||||
@ -268,7 +269,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
public void start() {
|
||||
if (!_resource.start()) {
|
||||
s_logger.error("Unable to start the resource: " + _resource.getName());
|
||||
logger.error("Unable to start the resource: " + _resource.getName());
|
||||
throw new CloudRuntimeException("Unable to start the resource: " + _resource.getName());
|
||||
}
|
||||
|
||||
@ -285,14 +286,14 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
s_logger.warn("NIO Connection Exception " + e);
|
||||
s_logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...");
|
||||
logger.warn("NIO Connection Exception " + e);
|
||||
logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...");
|
||||
}
|
||||
while (!_connection.isStartup()) {
|
||||
final String host = _shell.getNextHost();
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
_connection = new NioClient("Agent", host, _shell.getPort(), _shell.getWorkers(), this);
|
||||
s_logger.info("Connecting to host:" + host);
|
||||
logger.info("Connecting to host:" + host);
|
||||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
@ -300,9 +301,9 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException ex) {
|
||||
s_logger.warn("Fail to clean up old connection. " + ex);
|
||||
logger.warn("Fail to clean up old connection. " + ex);
|
||||
}
|
||||
s_logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...", e);
|
||||
logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...", e);
|
||||
}
|
||||
}
|
||||
_shell.updateConnectedHost();
|
||||
@ -311,7 +312,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
|
||||
public void stop(final String reason, final String detail) {
|
||||
s_logger.info("Stopping the agent: Reason = " + reason + (detail != null ? ": Detail = " + detail : ""));
|
||||
logger.info("Stopping the agent: Reason = " + reason + (detail != null ? ": Detail = " + detail : ""));
|
||||
_reconnectAllowed = false;
|
||||
if (_connection != null) {
|
||||
final ShutdownCommand cmd = new ShutdownCommand(reason, detail);
|
||||
@ -321,15 +322,15 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_link.send(req.toBytes());
|
||||
}
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send: " + cmd.toString());
|
||||
logger.warn("Unable to send: " + cmd.toString());
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Unable to send: " + cmd.toString() + " due to exception: ", e);
|
||||
logger.warn("Unable to send: " + cmd.toString() + " due to exception: ", e);
|
||||
}
|
||||
s_logger.debug("Sending shutdown to management server");
|
||||
logger.debug("Sending shutdown to management server");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (final InterruptedException e) {
|
||||
s_logger.debug("Who the heck interrupted me here?");
|
||||
logger.debug("Who the heck interrupted me here?");
|
||||
}
|
||||
_connection.stop();
|
||||
_connection = null;
|
||||
@ -376,7 +377,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
s_logger.info("Set agent id " + id);
|
||||
logger.info("Set agent id " + id);
|
||||
_id = id;
|
||||
_shell.setPersistentProperty(getResourceName(), "id", Long.toString(id));
|
||||
}
|
||||
@ -395,7 +396,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
hostLBTimer.cancel();
|
||||
}
|
||||
if (checkInterval > 0L) {
|
||||
s_logger.info("Scheduling preferred host timer task with host.lb.interval=" + checkInterval + "ms");
|
||||
logger.info("Scheduling preferred host timer task with host.lb.interval=" + checkInterval + "ms");
|
||||
hostLBTimer = new Timer("Host LB Timer");
|
||||
hostLBTimer.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval);
|
||||
}
|
||||
@ -403,8 +404,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
public void scheduleWatch(final Link link, final Request request, final long delay, final long period) {
|
||||
synchronized (_watchList) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Adding a watch list");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Adding a watch list");
|
||||
}
|
||||
final WatchTask task = new WatchTask(link, request, this);
|
||||
_timer.schedule(task, 0, period);
|
||||
@ -415,14 +416,14 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
public void triggerUpdate() {
|
||||
PingCommand command = _resource.getCurrentStatus(getId());
|
||||
command.setOutOfBand(true);
|
||||
s_logger.debug("Sending out of band ping");
|
||||
logger.debug("Sending out of band ping");
|
||||
|
||||
final Request request = new Request(_id, -1, command, false);
|
||||
request.setSequence(getNextSequence());
|
||||
try {
|
||||
_link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send ping update: " + request.toString());
|
||||
logger.warn("Unable to send ping update: " + request.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,8 +432,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
for (final WatchTask task : _watchList) {
|
||||
task.cancel();
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Clearing watch list: " + _watchList.size());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Clearing watch list: " + _watchList.size());
|
||||
}
|
||||
_watchList.clear();
|
||||
}
|
||||
@ -469,14 +470,14 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
final Request request = new Request(_id != null ? _id : -1, -1, commands, false, false);
|
||||
request.setSequence(getNextSequence());
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Sending Startup: " + request.toString());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Sending Startup: " + request.toString());
|
||||
}
|
||||
lockStartupTask(link);
|
||||
try {
|
||||
link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
logger.warn("Unable to send request: " + request.toString());
|
||||
}
|
||||
|
||||
if (_resource instanceof ResourceStatusUpdater) {
|
||||
@ -490,11 +491,11 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
addr = InetAddress.getLocalHost();
|
||||
} catch (final UnknownHostException e) {
|
||||
s_logger.warn("unknown host? ", e);
|
||||
logger.warn("unknown host? ", e);
|
||||
throw new CloudRuntimeException("Cannot get local IP address");
|
||||
}
|
||||
|
||||
final Script command = new Script("hostname", 500, s_logger);
|
||||
final Script command = new Script("hostname", 500, logger);
|
||||
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
|
||||
final String result = command.execute(parser);
|
||||
final String hostname = result == null ? parser.getLine() : addr.toString();
|
||||
@ -536,14 +537,14 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
_resource.disconnected();
|
||||
|
||||
s_logger.info("Lost connection to host: " + _shell.getConnectedHost() + ". Attempting reconnection while we still have " + _inProgress.get() + " commands in progress.");
|
||||
logger.info("Lost connection to host: " + _shell.getConnectedHost() + ". Attempting reconnection while we still have " + _inProgress.get() + " commands in progress.");
|
||||
|
||||
_connection.stop();
|
||||
|
||||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Fail to clean up old connection. " + e);
|
||||
logger.warn("Fail to clean up old connection. " + e);
|
||||
}
|
||||
|
||||
while (_connection.isStartup()) {
|
||||
@ -553,22 +554,22 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
do {
|
||||
final String host = _shell.getNextHost();
|
||||
_connection = new NioClient("Agent", host, _shell.getPort(), _shell.getWorkers(), this);
|
||||
s_logger.info("Reconnecting to host:" + host);
|
||||
logger.info("Reconnecting to host:" + host);
|
||||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
s_logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
_connection.stop();
|
||||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException ex) {
|
||||
s_logger.warn("Fail to clean up old connection. " + ex);
|
||||
logger.warn("Fail to clean up old connection. " + ex);
|
||||
}
|
||||
}
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
} while (!_connection.isStartup());
|
||||
_shell.updateConnectedHost();
|
||||
s_logger.info("Connected to the host: " + _shell.getConnectedHost());
|
||||
logger.info("Connected to the host: " + _shell.getConnectedHost());
|
||||
}
|
||||
|
||||
public void processStartupAnswer(final Answer answer, final Response response, final Link link) {
|
||||
@ -583,15 +584,15 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
final StartupAnswer startup = (StartupAnswer)answer;
|
||||
if (!startup.getResult()) {
|
||||
s_logger.error("Not allowed to connect to the server: " + answer.getDetails());
|
||||
logger.error("Not allowed to connect to the server: " + answer.getDetails());
|
||||
System.exit(1);
|
||||
}
|
||||
if (cancelled) {
|
||||
s_logger.warn("Threw away a startup answer because we're reconnecting.");
|
||||
logger.warn("Threw away a startup answer because we're reconnecting.");
|
||||
return;
|
||||
}
|
||||
|
||||
s_logger.info("Process agent startup answer, agent id = " + startup.getHostId());
|
||||
logger.info("Process agent startup answer, agent id = " + startup.getHostId());
|
||||
|
||||
setId(startup.getHostId());
|
||||
_pingInterval = (long)startup.getPingInterval() * 1000; // change to ms.
|
||||
@ -601,7 +602,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
_ugentTaskPool.setKeepAliveTime(2 * _pingInterval, TimeUnit.MILLISECONDS);
|
||||
|
||||
s_logger.info("Startup Response Received: agent id = " + getId());
|
||||
logger.info("Startup Response Received: agent id = " + getId());
|
||||
}
|
||||
|
||||
protected void processRequest(final Request request, final Link link) {
|
||||
@ -616,18 +617,18 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
Answer answer;
|
||||
try {
|
||||
if (cmd.getContextParam("logid") != null) {
|
||||
MDC.put("logcontextid", cmd.getContextParam("logid"));
|
||||
ThreadContext.put("logcontextid", cmd.getContextParam("logid"));
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (!requestLogged) // ensures request is logged only once per method call
|
||||
{
|
||||
final String requestMsg = request.toString();
|
||||
if (requestMsg != null) {
|
||||
s_logger.debug("Request:" + requestMsg);
|
||||
logger.debug("Request:" + requestMsg);
|
||||
}
|
||||
requestLogged = true;
|
||||
}
|
||||
s_logger.debug("Processing command: " + cmd.toString());
|
||||
logger.debug("Processing command: " + cmd.toString());
|
||||
}
|
||||
|
||||
if (cmd instanceof CronCommand) {
|
||||
@ -636,7 +637,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ShutdownCommand) {
|
||||
final ShutdownCommand shutdown = (ShutdownCommand)cmd;
|
||||
s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
|
||||
logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
|
||||
cancelTasks();
|
||||
if (shutdown.isRemoveHost()) {
|
||||
cleanupAgentZoneProperties();
|
||||
@ -644,11 +645,11 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_reconnectAllowed = false;
|
||||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ReadyCommand && ((ReadyCommand)cmd).getDetails() != null) {
|
||||
s_logger.debug("Not ready to connect to mgt server: " + ((ReadyCommand)cmd).getDetails());
|
||||
logger.debug("Not ready to connect to mgt server: " + ((ReadyCommand)cmd).getDetails());
|
||||
System.exit(1);
|
||||
return;
|
||||
} else if (cmd instanceof MaintainCommand) {
|
||||
s_logger.debug("Received maintainCommand, do not cancel current tasks");
|
||||
logger.debug("Received maintainCommand, do not cancel current tasks");
|
||||
answer = new MaintainAnswer((MaintainCommand)cmd);
|
||||
} else if (cmd instanceof AgentControlCommand) {
|
||||
answer = null;
|
||||
@ -662,7 +663,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
|
||||
if (answer == null) {
|
||||
s_logger.warn("No handler found to process cmd: " + cmd.toString());
|
||||
logger.warn("No handler found to process cmd: " + cmd.toString());
|
||||
answer = new AgentControlAnswer(cmd);
|
||||
}
|
||||
} else if (cmd instanceof SetupKeyStoreCommand && ((SetupKeyStoreCommand) cmd).isHandleByAgent()) {
|
||||
@ -685,12 +686,12 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_inProgress.decrementAndGet();
|
||||
}
|
||||
if (answer == null) {
|
||||
s_logger.debug("Response: unsupported command" + cmd.toString());
|
||||
logger.debug("Response: unsupported command" + cmd.toString());
|
||||
answer = Answer.createUnsupportedCommandAnswer(cmd);
|
||||
}
|
||||
}
|
||||
} catch (final Throwable th) {
|
||||
s_logger.warn("Caught: ", th);
|
||||
logger.warn("Caught: ", th);
|
||||
final StringWriter writer = new StringWriter();
|
||||
th.printStackTrace(new PrintWriter(writer));
|
||||
answer = new Answer(cmd, false, writer.toString());
|
||||
@ -706,10 +707,10 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
response = new Response(request, answers);
|
||||
} finally {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
final String responseMsg = response.toString();
|
||||
if (responseMsg != null) {
|
||||
s_logger.debug(response.toString());
|
||||
logger.debug(response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -717,7 +718,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
link.send(response.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send response: " + response.toString());
|
||||
logger.warn("Unable to send response: " + response.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -727,7 +728,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
final String keyStorePassword = cmd.getKeystorePassword();
|
||||
final long validityDays = cmd.getValidityDays();
|
||||
|
||||
s_logger.debug("Setting up agent keystore file and generating CSR");
|
||||
logger.debug("Setting up agent keystore file and generating CSR");
|
||||
|
||||
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
|
||||
if (agentFile == null) {
|
||||
@ -742,7 +743,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_shell.setPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY, storedPassword);
|
||||
}
|
||||
|
||||
Script script = new Script(_keystoreSetupPath, 300000, s_logger);
|
||||
Script script = new Script(_keystoreSetupPath, 300000, logger);
|
||||
script.add(agentFile.getAbsolutePath());
|
||||
script.add(keyStoreFile);
|
||||
script.add(storedPassword);
|
||||
@ -767,7 +768,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
final String privateKey = cmd.getPrivateKey();
|
||||
final String caCertificates = cmd.getCaCertificates();
|
||||
|
||||
s_logger.debug("Importing received certificate to agent's keystore");
|
||||
logger.debug("Importing received certificate to agent's keystore");
|
||||
|
||||
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
|
||||
if (agentFile == null) {
|
||||
@ -781,13 +782,13 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
FileUtils.writeStringToFile(new File(certFile), certificate, Charset.defaultCharset());
|
||||
FileUtils.writeStringToFile(new File(caCertFile), caCertificates, Charset.defaultCharset());
|
||||
s_logger.debug("Saved received client certificate to: " + certFile);
|
||||
logger.debug("Saved received client certificate to: " + certFile);
|
||||
} catch (IOException e) {
|
||||
throw new CloudRuntimeException("Unable to save received agent client and ca certificates", e);
|
||||
}
|
||||
|
||||
String ksPassphrase = _shell.getPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
|
||||
Script script = new Script(_keystoreCertImportPath, 300000, s_logger);
|
||||
Script script = new Script(_keystoreCertImportPath, 300000, logger);
|
||||
script.add(agentFile.getAbsolutePath());
|
||||
script.add(ksPassphrase);
|
||||
script.add(keyStoreFile);
|
||||
@ -812,7 +813,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_shell.setPersistentProperty(null, "host", newMSHosts);
|
||||
_shell.setHosts(newMSHosts);
|
||||
_shell.resetHostCounter();
|
||||
s_logger.info("Processed new management server list: " + newMSHosts);
|
||||
logger.info("Processed new management server list: " + newMSHosts);
|
||||
} catch (final Exception e) {
|
||||
throw new CloudRuntimeException("Could not persist received management servers list", e);
|
||||
}
|
||||
@ -831,8 +832,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
public void processResponse(final Response response, final Link link) {
|
||||
final Answer answer = response.getAnswer();
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Received response: " + response.toString());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Received response: " + response.toString());
|
||||
}
|
||||
if (answer instanceof StartupAnswer) {
|
||||
processStartupAnswer(answer, response, link);
|
||||
@ -844,7 +845,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
}
|
||||
} else if (answer instanceof PingAnswer && (((PingAnswer) answer).isSendStartup()) && _reconnectAllowed) {
|
||||
s_logger.info("Management server requested startup command to reinitialize the agent");
|
||||
logger.info("Management server requested startup command to reinitialize the agent");
|
||||
sendStartup(link);
|
||||
} else {
|
||||
setLastPingResponseTime();
|
||||
@ -859,29 +860,29 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
NumbersUtil.enableHumanReadableSizes = humanReadable;
|
||||
}
|
||||
|
||||
s_logger.info("Processing agent ready command, agent id = " + ready.getHostId());
|
||||
logger.info("Processing agent ready command, agent id = " + ready.getHostId());
|
||||
if (ready.getHostId() != null) {
|
||||
setId(ready.getHostId());
|
||||
}
|
||||
|
||||
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
|
||||
|
||||
s_logger.info("Ready command is processed for agent id = " + getId());
|
||||
logger.info("Ready command is processed for agent id = " + getId());
|
||||
}
|
||||
|
||||
public void processOtherTask(final Task task) {
|
||||
final Object obj = task.get();
|
||||
if (obj instanceof Response) {
|
||||
if (System.currentTimeMillis() - _lastPingResponseTime > _pingInterval * _shell.getPingRetries()) {
|
||||
s_logger.error("Ping Interval has gone past " + _pingInterval * _shell.getPingRetries() + ". Won't reconnect to mgt server, as connection is still alive");
|
||||
logger.error("Ping Interval has gone past " + _pingInterval * _shell.getPingRetries() + ". Won't reconnect to mgt server, as connection is still alive");
|
||||
return;
|
||||
}
|
||||
|
||||
final PingCommand ping = _resource.getCurrentStatus(getId());
|
||||
final Request request = new Request(_id, -1, ping, false);
|
||||
request.setSequence(getNextSequence());
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Sending ping: " + request.toString());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Sending ping: " + request.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -889,14 +890,14 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
//if i can send pingcommand out, means the link is ok
|
||||
setLastPingResponseTime();
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
logger.warn("Unable to send request: " + request.toString());
|
||||
}
|
||||
|
||||
} else if (obj instanceof Request) {
|
||||
final Request req = (Request)obj;
|
||||
final Command command = req.getCommand();
|
||||
if (command.getContextParam("logid") != null) {
|
||||
MDC.put("logcontextid", command.getContextParam("logid"));
|
||||
ThreadContext.put("logcontextid", command.getContextParam("logid"));
|
||||
}
|
||||
Answer answer = null;
|
||||
_inProgress.incrementAndGet();
|
||||
@ -908,17 +909,17 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
if (answer != null) {
|
||||
final Response response = new Response(req, answer);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Watch Sent: " + response.toString());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Watch Sent: " + response.toString());
|
||||
}
|
||||
try {
|
||||
task.getLink().send(response.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send response: " + response.toString());
|
||||
logger.warn("Unable to send response: " + response.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.warn("Ignoring an unknown task");
|
||||
logger.warn("Ignoring an unknown task");
|
||||
}
|
||||
}
|
||||
|
||||
@ -958,7 +959,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
listener.wait(timeoutInMilliseconds);
|
||||
} catch (final InterruptedException e) {
|
||||
s_logger.warn("sendRequest is interrupted, exit waiting");
|
||||
logger.warn("sendRequest is interrupted, exit waiting");
|
||||
}
|
||||
}
|
||||
|
||||
@ -980,7 +981,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
try {
|
||||
_link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to post agent control request: " + request.toString());
|
||||
logger.warn("Unable to post agent control request: " + request.toString());
|
||||
throw new AgentControlChannelException("Unable to post agent control request due to " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
@ -1044,8 +1045,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Scheduling " + (_request instanceof Response ? "Ping" : "Watch Task"));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Scheduling " + (_request instanceof Response ? "Ping" : "Watch Task"));
|
||||
}
|
||||
try {
|
||||
if (_request instanceof Response) {
|
||||
@ -1054,7 +1055,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_link.schedule(new ServerHandler(Task.Type.OTHER, _link, _request));
|
||||
}
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to schedule task because channel is closed");
|
||||
logger.warn("Unable to schedule task because channel is closed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1064,7 +1065,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
protected volatile boolean cancelled = false;
|
||||
|
||||
public StartupTask(final Link link) {
|
||||
s_logger.debug("Startup task created");
|
||||
logger.debug("Startup task created");
|
||||
_link = link;
|
||||
}
|
||||
|
||||
@ -1074,7 +1075,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
if (!cancelled) {
|
||||
cancelled = true;
|
||||
_startupWait = _startupWaitDefault;
|
||||
s_logger.debug("Startup task cancelled");
|
||||
logger.debug("Startup task cancelled");
|
||||
return super.cancel();
|
||||
}
|
||||
return true;
|
||||
@ -1083,8 +1084,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
@Override
|
||||
protected synchronized void runInContext() {
|
||||
if (!cancelled) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("The startup command is now cancelled");
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("The startup command is now cancelled");
|
||||
}
|
||||
cancelled = true;
|
||||
_startup = null;
|
||||
@ -1136,9 +1137,9 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
_executor.submit(new AgentRequestHandler(getType(), getLink(), request));
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to find this request ");
|
||||
logger.error("Unable to find this request ");
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("Error parsing task", e);
|
||||
logger.error("Error parsing task", e);
|
||||
}
|
||||
} else if (task.getType() == Task.Type.DISCONNECT) {
|
||||
reconnect(task.getLink());
|
||||
@ -1166,7 +1167,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
while (true) {
|
||||
try {
|
||||
if (_inProgress.get() == 0) {
|
||||
s_logger.debug("Running post certificate renewal task to restart services.");
|
||||
logger.debug("Running post certificate renewal task to restart services.");
|
||||
|
||||
// Let the resource perform any post certificate renewal cleanups
|
||||
_resource.executeRequest(new PostCertificateRenewalCommand());
|
||||
@ -1191,12 +1192,12 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
shell.launchNewAgent(resource);
|
||||
return;
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.debug("Other tasks are in progress, will retry post certificate renewal command after few seconds");
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.debug("Other tasks are in progress, will retry post certificate renewal command after few seconds");
|
||||
}
|
||||
Thread.sleep(5000);
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Failed to execute post certificate renewal command:", e);
|
||||
logger.warn("Failed to execute post certificate renewal command:", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1214,8 +1215,8 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
}
|
||||
final String preferredHost = msList[0];
|
||||
final String connectedHost = _shell.getConnectedHost();
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Running preferred host checker task, connected host=" + connectedHost + ", preferred host=" + preferredHost);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Running preferred host checker task, connected host=" + connectedHost + ", preferred host=" + preferredHost);
|
||||
}
|
||||
if (preferredHost != null && !preferredHost.equals(connectedHost) && _link != null) {
|
||||
boolean isHostUp = true;
|
||||
@ -1223,20 +1224,20 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
||||
socket.connect(new InetSocketAddress(preferredHost, _shell.getPort()), 5000);
|
||||
} catch (final IOException e) {
|
||||
isHostUp = false;
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Host: " + preferredHost + " is not reachable");
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Host: " + preferredHost + " is not reachable");
|
||||
}
|
||||
}
|
||||
if (isHostUp && _link != null && _inProgress.get() == 0) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Preferred host " + preferredHost + " is found to be reachable, trying to reconnect");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Preferred host " + preferredHost + " is found to be reachable, trying to reconnect");
|
||||
}
|
||||
_shell.resetHostCounter();
|
||||
reconnect(_link);
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
s_logger.error("Error caught while attempting to connect to preferred host", t);
|
||||
logger.error("Error caught while attempting to connect to preferred host", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,8 +34,9 @@ import org.apache.commons.daemon.DaemonInitException;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.File;
|
||||
@ -53,7 +54,7 @@ import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AgentShell implements IAgentShell, Daemon {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class.getName());
|
||||
protected static Logger LOGGER = LogManager.getLogger(AgentShell.class);
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
|
||||
@ -221,7 +222,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
throw new ConfigurationException("Unable to find agent.properties.");
|
||||
}
|
||||
|
||||
s_logger.info("agent.properties found at " + file.getAbsolutePath());
|
||||
LOGGER.info("agent.properties found at " + file.getAbsolutePath());
|
||||
|
||||
try {
|
||||
PropertiesUtil.loadFromFile(_properties, file);
|
||||
@ -349,7 +350,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
|
||||
@Override
|
||||
public void init(DaemonContext dc) throws DaemonInitException {
|
||||
s_logger.debug("Initializing AgentShell from JSVC");
|
||||
LOGGER.debug("Initializing AgentShell from JSVC");
|
||||
try {
|
||||
init(dc.getArguments());
|
||||
} catch (ConfigurationException ex) {
|
||||
@ -369,11 +370,11 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
}
|
||||
|
||||
if (null != file) {
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
Configurator.initialize(null, file.getAbsolutePath());
|
||||
|
||||
s_logger.info("Agent started");
|
||||
LOGGER.info("Agent started");
|
||||
} else {
|
||||
s_logger.error("Could not start the Agent because the absolute path of the \"log4j-cloud.xml\" file cannot be determined.");
|
||||
LOGGER.error("Could not start the Agent because the absolute path of the \"log4j-cloud.xml\" file cannot be determined.");
|
||||
}
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
@ -381,19 +382,19 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
if (_version == null) {
|
||||
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
|
||||
}
|
||||
s_logger.info("Implementation Version is " + _version);
|
||||
LOGGER.info("Implementation Version is " + _version);
|
||||
|
||||
loadProperties();
|
||||
parseCommand(args);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
|
||||
for (String property : properties) {
|
||||
s_logger.debug("Found property: " + property);
|
||||
LOGGER.debug("Found property: " + property);
|
||||
}
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
LOGGER.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
|
||||
@ -403,14 +404,14 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
LOGGER.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
private void launchAgent() throws ConfigurationException {
|
||||
String resourceClassNames = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.RESOURCE);
|
||||
s_logger.trace("resource=" + resourceClassNames);
|
||||
LOGGER.trace("resource=" + resourceClassNames);
|
||||
if (resourceClassNames != null) {
|
||||
launchAgentFromClassInfo(resourceClassNames);
|
||||
return;
|
||||
@ -440,10 +441,10 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
private void launchAgentFromTypeInfo() throws ConfigurationException {
|
||||
String typeInfo = getProperty(null, "type");
|
||||
if (typeInfo == null) {
|
||||
s_logger.error("Unable to retrieve the type");
|
||||
LOGGER.error("Unable to retrieve the type");
|
||||
throw new ConfigurationException("Unable to retrieve the type of this agent.");
|
||||
}
|
||||
s_logger.trace("Launching agent based on type=" + typeInfo);
|
||||
LOGGER.trace("Launching agent based on type=" + typeInfo);
|
||||
}
|
||||
|
||||
public void launchNewAgent(ServerResource resource) throws ConfigurationException {
|
||||
@ -477,17 +478,17 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
}
|
||||
|
||||
if (ipv6disabled) {
|
||||
s_logger.info("Preferring IPv4 address family for agent connection");
|
||||
LOGGER.info("Preferring IPv4 address family for agent connection");
|
||||
System.setProperty("java.net.preferIPv4Stack", "true");
|
||||
if (ipv6prefer) {
|
||||
s_logger.info("ipv6prefer is set to true, but ipv6disabled is false. Not preferring IPv6 for agent connection");
|
||||
LOGGER.info("ipv6prefer is set to true, but ipv6disabled is false. Not preferring IPv6 for agent connection");
|
||||
}
|
||||
} else {
|
||||
if (ipv6prefer) {
|
||||
s_logger.info("Preferring IPv6 address family for agent connection");
|
||||
LOGGER.info("Preferring IPv6 address family for agent connection");
|
||||
System.setProperty("java.net.preferIPv6Addresses", "true");
|
||||
} else {
|
||||
s_logger.info("Using default Java settings for IPv6 preference for agent connection");
|
||||
LOGGER.info("Using default Java settings for IPv6 preference for agent connection");
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,7 +506,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
String pidDir = getProperty(null, "piddir");
|
||||
|
||||
final String run = "agent." + instance + "pid";
|
||||
s_logger.debug("Checking to see if " + run + " exists.");
|
||||
LOGGER.debug("Checking to see if " + run + " exists.");
|
||||
ProcessUtil.pidCheck(pidDir, run);
|
||||
|
||||
launchAgent();
|
||||
@ -514,11 +515,11 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
while (!_exit)
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
s_logger.debug("[ignored] AgentShell was interrupted.");
|
||||
LOGGER.debug("[ignored] AgentShell was interrupted.");
|
||||
}
|
||||
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("Unable to start agent: ", e);
|
||||
LOGGER.error("Unable to start agent: ", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
@ -535,7 +536,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
s_logger.debug("Initializing AgentShell from main");
|
||||
LOGGER.debug("Initializing AgentShell from main");
|
||||
AgentShell shell = new AgentShell();
|
||||
shell.init(args);
|
||||
shell.start();
|
||||
|
||||
@ -24,7 +24,8 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.dao.StorageComponent;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
@ -36,7 +37,7 @@ import com.cloud.utils.PropertiesUtil;
|
||||
* path to the properties _file | String | db/db.properties || * }
|
||||
**/
|
||||
public class PropertiesStorage implements StorageComponent {
|
||||
private static final Logger s_logger = Logger.getLogger(PropertiesStorage.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
Properties _properties = new Properties();
|
||||
File _file;
|
||||
String _name;
|
||||
@ -49,7 +50,7 @@ public class PropertiesStorage implements StorageComponent {
|
||||
@Override
|
||||
public synchronized void persist(String key, String value) {
|
||||
if (!loadFromFile(_file)) {
|
||||
s_logger.error("Failed to load changes and then write to them");
|
||||
logger.error("Failed to load changes and then write to them");
|
||||
}
|
||||
_properties.setProperty(key, value);
|
||||
FileOutputStream output = null;
|
||||
@ -59,7 +60,7 @@ public class PropertiesStorage implements StorageComponent {
|
||||
output.flush();
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
s_logger.error("Uh-oh: ", e);
|
||||
logger.error("Uh-oh: ", e);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(output);
|
||||
}
|
||||
@ -70,10 +71,10 @@ public class PropertiesStorage implements StorageComponent {
|
||||
PropertiesUtil.loadFromFile(_properties, file);
|
||||
_file = file;
|
||||
} catch (FileNotFoundException e) {
|
||||
s_logger.error("How did we get here? ", e);
|
||||
logger.error("How did we get here? ", e);
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
s_logger.error("IOException: ", e);
|
||||
logger.error("IOException: ", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -92,13 +93,13 @@ public class PropertiesStorage implements StorageComponent {
|
||||
file = new File(path);
|
||||
try {
|
||||
if (!file.createNewFile()) {
|
||||
s_logger.error(String.format("Unable to create _file: %s", file.getAbsolutePath()));
|
||||
logger.error(String.format("Unable to create _file: %s", file.getAbsolutePath()));
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.error(String.format("Unable to create file: %s", file.getAbsolutePath()));
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug(String.format("IOException while trying to create file: %s", file.getAbsolutePath()), e);
|
||||
logger.error(String.format("Unable to create file: %s", file.getAbsolutePath()));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("IOException while trying to create file: %s", file.getAbsolutePath()), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -25,12 +25,13 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
public class DhcpProtocolParserServer extends Thread {
|
||||
private static final Logger s_logger = Logger.getLogger(DhcpProtocolParserServer.class);;
|
||||
protected Logger logger = LogManager.getLogger(DhcpProtocolParserServer.class);;
|
||||
protected ExecutorService _executor;
|
||||
private int dhcpServerPort = 67;
|
||||
private int bufferSize = 300;
|
||||
@ -54,7 +55,7 @@ public class DhcpProtocolParserServer extends Thread {
|
||||
dhcpSocket.receive(dgp);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.debug(e.getMessage());
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,14 +22,15 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
||||
public class MockVmMgr implements VmMgr {
|
||||
private static final Logger s_logger = Logger.getLogger(MockVmMgr.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private static final int DEFAULT_DOM0_MEM_MB = 128;
|
||||
private static final Random randSeed = new Random();
|
||||
@ -56,14 +57,14 @@ public class MockVmMgr implements VmMgr {
|
||||
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP,
|
||||
String publicMac, String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword) {
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Start VM. name: " + vmName + ", vnet: " + vnetId + ", dns: " + dns);
|
||||
sb.append(", privateIP: " + privateIP + ", privateMac: " + privateMac + ", privateMask: " + privateMask);
|
||||
sb.append(", publicIP: " + publicIP + ", publicMac: " + publicMac + ", publicMask: " + publicMask);
|
||||
sb.append(", cpu count: " + cpuCount + ", cpuUtilization: " + cpuUtilization + ", ram : " + ramSize);
|
||||
sb.append(", localPath: " + localPath);
|
||||
s_logger.info(sb.toString());
|
||||
logger.info(sb.toString());
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
@ -86,8 +87,8 @@ public class MockVmMgr implements VmMgr {
|
||||
|
||||
@Override
|
||||
public String stopVM(String vmName, boolean force) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Stop VM. name: " + vmName);
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Stop VM. name: " + vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
@ -102,8 +103,8 @@ public class MockVmMgr implements VmMgr {
|
||||
|
||||
@Override
|
||||
public String rebootVM(String vmName) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Reboot VM. name: " + vmName);
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Reboot VM. name: " + vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
@ -115,8 +116,8 @@ public class MockVmMgr implements VmMgr {
|
||||
|
||||
@Override
|
||||
public boolean migrate(String vmName, String params) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Migrate VM. name: " + vmName);
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Migrate VM. name: " + vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
@ -258,13 +259,13 @@ public class MockVmMgr implements VmMgr {
|
||||
vm = vms.get(vmName);
|
||||
if (vm == null) {
|
||||
if (ramSize > getHostFreeMemory()) {
|
||||
s_logger.debug("host is out of memory");
|
||||
logger.debug("host is out of memory");
|
||||
throw new CloudRuntimeException("Host is out of Memory");
|
||||
}
|
||||
|
||||
int vncPort = allocVncPort();
|
||||
if (vncPort < 0) {
|
||||
s_logger.debug("Unable to allocate VNC port");
|
||||
logger.debug("Unable to allocate VNC port");
|
||||
throw new CloudRuntimeException("Unable to allocate vnc port");
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@ import org.apache.commons.beanutils.ConvertUtils;
|
||||
import org.apache.commons.beanutils.converters.IntegerConverter;
|
||||
import org.apache.commons.beanutils.converters.LongConverter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
/**
|
||||
* This class provides a facility to read the agent's properties file and get
|
||||
@ -31,7 +32,7 @@ import org.apache.log4j.Logger;
|
||||
*/
|
||||
public class AgentPropertiesFileHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AgentPropertiesFileHandler.class);
|
||||
protected static Logger LOGGER = LogManager.getLogger(AgentPropertiesFileHandler.class);
|
||||
|
||||
/**
|
||||
* This method reads the property in the agent.properties file.
|
||||
@ -47,7 +48,7 @@ public class AgentPropertiesFileHandler {
|
||||
File agentPropertiesFile = PropertiesUtil.findConfigFile(KeyStoreUtils.AGENT_PROPSFILE);
|
||||
|
||||
if (agentPropertiesFile == null) {
|
||||
logger.debug(String.format("File [%s] was not found, we will use default defined values. Property [%s]: [%s].", KeyStoreUtils.AGENT_PROPSFILE, name, defaultValue));
|
||||
LOGGER.debug(String.format("File [%s] was not found, we will use default defined values. Property [%s]: [%s].", KeyStoreUtils.AGENT_PROPSFILE, name, defaultValue));
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
@ -55,7 +56,7 @@ public class AgentPropertiesFileHandler {
|
||||
try {
|
||||
String configValue = PropertiesUtil.loadFromFile(agentPropertiesFile).getProperty(name);
|
||||
if (StringUtils.isBlank(configValue)) {
|
||||
logger.debug(String.format("Property [%s] has empty or null value. Using default value [%s].", name, defaultValue));
|
||||
LOGGER.debug(String.format("Property [%s] has empty or null value. Using default value [%s].", name, defaultValue));
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@ -67,11 +68,11 @@ public class AgentPropertiesFileHandler {
|
||||
ConvertUtils.register(new LongConverter(defaultValue), Long.class);
|
||||
}
|
||||
|
||||
logger.debug(String.format("Property [%s] was altered. Now using the value [%s].", name, configValue));
|
||||
LOGGER.debug(String.format("Property [%s] was altered. Now using the value [%s].", name, configValue));
|
||||
return (T)ConvertUtils.convert(configValue, property.getTypeClass());
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.debug(String.format("Failed to get property [%s]. Using default value [%s].", name, defaultValue), ex);
|
||||
LOGGER.debug(String.format("Failed to get property [%s]. Using default value [%s].", name, defaultValue), ex);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
||||
@ -34,7 +34,6 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.agent.api.proxy.AllowConsoleAccessCommand;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.Agent.ExitStatus;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
@ -81,7 +80,6 @@ import com.google.gson.Gson;
|
||||
*
|
||||
*/
|
||||
public class ConsoleProxyResource extends ServerResourceBase implements ServerResource {
|
||||
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
private Thread consoleProxyMain = null;
|
||||
@ -101,7 +99,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
|
||||
return execute((WatchConsoleProxyLoadCommand)cmd);
|
||||
} else if (cmd instanceof ReadyCommand) {
|
||||
s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
|
||||
logger.info("Receive ReadyCommand, response with ReadyAnswer");
|
||||
return new ReadyAnswer((ReadyCommand)cmd);
|
||||
} else if (cmd instanceof CheckHealthCommand) {
|
||||
return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
|
||||
@ -123,13 +121,13 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
return new Answer(cmd);
|
||||
} catch (SecurityException | NoSuchMethodException | ClassNotFoundException | InvocationTargetException | IllegalAccessException e) {
|
||||
String errorMsg = "Unable to add allowed session due to: " + e.getMessage();
|
||||
s_logger.error(errorMsg, e);
|
||||
logger.error(errorMsg, e);
|
||||
return new Answer(cmd, false, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private Answer execute(StartConsoleProxyAgentHttpHandlerCommand cmd) {
|
||||
s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
launchConsoleProxy(cmd.getKeystoreBits(), cmd.getKeystorePassword(), cmd.getEncryptorPassword(), cmd.isSourceIpCheckEnabled());
|
||||
return new Answer(cmd);
|
||||
}
|
||||
@ -140,7 +138,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
{
|
||||
out.write("0");
|
||||
} catch (IOException e) {
|
||||
s_logger.warn("Unable to disable rp_filter");
|
||||
logger.warn("Unable to disable rp_filter");
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,12 +175,12 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
try {
|
||||
is.close();
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
|
||||
logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
|
||||
logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
|
||||
@ -227,14 +225,14 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
if (eth1Ip != null) {
|
||||
params.put("private.network.device", "eth1");
|
||||
} else {
|
||||
s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
|
||||
logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
|
||||
}
|
||||
|
||||
String eth2ip = (String)params.get("eth2ip");
|
||||
if (eth2ip != null) {
|
||||
params.put("public.network.device", "eth2");
|
||||
} else {
|
||||
s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
|
||||
logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
|
||||
}
|
||||
|
||||
super.configure(name, params);
|
||||
@ -262,7 +260,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
}
|
||||
String internalDns1 = (String) params.get("internaldns1");
|
||||
if (internalDns1 == null) {
|
||||
s_logger.warn("No DNS entry found during configuration of ConsoleProxy");
|
||||
logger.warn("No DNS entry found during configuration of ConsoleProxy");
|
||||
} else {
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, internalDns1);
|
||||
}
|
||||
@ -280,20 +278,20 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
disableRpFilter();
|
||||
}
|
||||
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + proxyVmId);
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + proxyVmId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) {
|
||||
s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
|
||||
logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
|
||||
if (destIpOrCidr == null) {
|
||||
s_logger.debug("addRouteToInternalIp: destIp is null");
|
||||
logger.debug("addRouteToInternalIp: destIp is null");
|
||||
return;
|
||||
}
|
||||
if (!NetUtils.isValidIp4(destIpOrCidr) && !NetUtils.isValidIp4Cidr(destIpOrCidr)) {
|
||||
s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
|
||||
logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
|
||||
return;
|
||||
}
|
||||
boolean inSameSubnet = false;
|
||||
@ -301,27 +299,27 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
if (eth1ip != null && eth1mask != null) {
|
||||
inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask);
|
||||
} else {
|
||||
s_logger.warn("addRouteToInternalIp: unable to determine same subnet: eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", eth1mask=" + eth1mask);
|
||||
logger.warn("addRouteToInternalIp: unable to determine same subnet: eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", eth1mask=" + eth1mask);
|
||||
}
|
||||
} else {
|
||||
inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
|
||||
}
|
||||
if (inSameSubnet) {
|
||||
s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
|
||||
logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
|
||||
return;
|
||||
}
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
Script command = new Script("/bin/bash", logger);
|
||||
command.add("-c");
|
||||
command.add("ip route delete " + destIpOrCidr);
|
||||
command.execute();
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command = new Script("/bin/bash", logger);
|
||||
command.add("-c");
|
||||
command.add("ip route add " + destIpOrCidr + " via " + localgw);
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in configuring route to internal ip err=" + result);
|
||||
logger.warn("Error in configuring route to internal ip err=" + result);
|
||||
} else {
|
||||
s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
|
||||
logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,36 +330,36 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
|
||||
private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, final String encryptorPassword, final Boolean isSourceIpCheckEnabled) {
|
||||
final Object resource = this;
|
||||
s_logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
if (consoleProxyMain == null) {
|
||||
s_logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
|
||||
logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
|
||||
consoleProxyMain = new Thread(new ManagedContextRunnable() {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
try {
|
||||
s_logger.info("Invoke startWithContext()");
|
||||
logger.info("Invoke startWithContext()");
|
||||
Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class, String.class, Boolean.class);
|
||||
method.invoke(null, properties, resource, ksBits, ksPassword, encryptorPassword, isSourceIpCheckEnabled);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (NoSuchMethodException e) {
|
||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
||||
logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
@ -369,7 +367,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
consoleProxyMain.setDaemon(true);
|
||||
consoleProxyMain.start();
|
||||
} else {
|
||||
s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
@ -378,22 +376,22 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
methodSetup = consoleProxyClazz.getMethod("setIsSourceIpCheckEnabled", Boolean.class);
|
||||
methodSetup.invoke(null, isSourceIpCheckEnabled);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (NoSuchMethodException e) {
|
||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
|
||||
logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
@ -420,10 +418,10 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
result.setTunnelUrl(authAnswer.getTunnelUrl());
|
||||
result.setTunnelSession(authAnswer.getTunnelSession());
|
||||
} else {
|
||||
s_logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
|
||||
logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
|
||||
}
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
|
||||
logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
return new Gson().toJson(result);
|
||||
@ -434,17 +432,17 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
try {
|
||||
getAgentControl().postRequest(cmd);
|
||||
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Report proxy load info, proxy : " + proxyVmId + ", load: " + gsonLoadInfo);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Report proxy load info, proxy : " + proxyVmId + ", load: " + gsonLoadInfo);
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error("Unable to send out load info due to " + e.getMessage(), e);
|
||||
logger.error("Unable to send out load info due to " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureRoute(String address) {
|
||||
if (localGateway != null) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Ensure route for " + address + " via " + localGateway);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Ensure route for " + address + " via " + localGateway);
|
||||
|
||||
// this method won't be called in high frequency, serialize access
|
||||
// to script execution
|
||||
@ -452,7 +450,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
||||
try {
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, address);
|
||||
} catch (Throwable e) {
|
||||
s_logger.warn("Unexpected exception while adding internal route to " + address, e);
|
||||
logger.warn("Unexpected exception while adding internal route to " + address, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
/**
|
||||
* implemented by classes that extends the Command class. Command specifies
|
||||
@ -27,6 +29,8 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
*/
|
||||
public abstract class Command {
|
||||
|
||||
protected transient Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public static enum OnError {
|
||||
Continue, Stop
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -41,7 +41,7 @@ public @interface LogLevel {
|
||||
}
|
||||
|
||||
public boolean enabled(Logger logger) {
|
||||
return _level != Level.OFF && logger.isEnabledFor(_level);
|
||||
return _level != Level.OFF && logger.isEnabled(_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,8 @@ import org.apache.cloudstack.utils.security.ParserUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@ -63,7 +64,7 @@ import com.cloud.utils.compression.CompressionUtil;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class OVFHelper {
|
||||
private static final Logger s_logger = Logger.getLogger(OVFHelper.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private final OVFParser ovfParser;
|
||||
|
||||
@ -118,7 +119,7 @@ public class OVFHelper {
|
||||
boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true");
|
||||
String label = ovfParser.getChildNodeValue(node, "Label");
|
||||
String description = ovfParser.getChildNodeValue(node, "Description");
|
||||
s_logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category)
|
||||
logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category)
|
||||
+ " with key = " + key);
|
||||
return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable,
|
||||
label, description, password, index, category);
|
||||
@ -151,7 +152,7 @@ public class OVFHelper {
|
||||
if (child.getNodeName().equalsIgnoreCase("Category") ||
|
||||
child.getNodeName().endsWith(":Category")) {
|
||||
lastCategoryFound = child.getTextContent();
|
||||
s_logger.info("Category found " + lastCategoryFound);
|
||||
logger.info("Category found " + lastCategoryFound);
|
||||
} else if (child.getNodeName().equalsIgnoreCase("Property") ||
|
||||
child.getNodeName().endsWith(":Property")) {
|
||||
OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound);
|
||||
@ -249,13 +250,13 @@ public class OVFHelper {
|
||||
int diskNumber = 0;
|
||||
for (OVFVirtualHardwareItemTO diskItem : diskHardwareItems) {
|
||||
if (StringUtils.isBlank(diskItem.getHostResource())) {
|
||||
s_logger.error("Missing disk information for hardware item " + diskItem.getElementName() + " " + diskItem.getInstanceId());
|
||||
logger.error("Missing disk information for hardware item " + diskItem.getElementName() + " " + diskItem.getInstanceId());
|
||||
continue;
|
||||
}
|
||||
String diskId = extractDiskIdFromDiskHostResource(diskItem.getHostResource());
|
||||
OVFDisk diskDefinition = getDiskDefinitionFromDiskId(diskId, disks);
|
||||
if (diskDefinition == null) {
|
||||
s_logger.error("Missing disk definition for disk ID " + diskId);
|
||||
logger.error("Missing disk definition for disk ID " + diskId);
|
||||
}
|
||||
OVFFile fileDefinition = getFileDefinitionFromDiskDefinition(diskDefinition._fileRef, files);
|
||||
DatadiskTO datadiskTO = generateDiskTO(fileDefinition, diskDefinition, ovfParentPath, diskNumber, diskItem);
|
||||
@ -277,7 +278,7 @@ public class OVFHelper {
|
||||
if (StringUtils.isNotBlank(path)) {
|
||||
File f = new File(path);
|
||||
if (!f.exists() || f.isDirectory()) {
|
||||
s_logger.error("One of the attached disk or iso does not exists " + path);
|
||||
logger.error("One of the attached disk or iso does not exists " + path);
|
||||
throw new InternalErrorException("One of the attached disk or iso as stated on OVF does not exists " + path);
|
||||
}
|
||||
}
|
||||
@ -333,8 +334,8 @@ public class OVFHelper {
|
||||
od._controller = getControllerType(items, od._diskId);
|
||||
vd.add(od);
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d disk definitions",vd.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d disk definitions",vd.size()));
|
||||
}
|
||||
return vd;
|
||||
}
|
||||
@ -365,8 +366,8 @@ public class OVFHelper {
|
||||
vf.add(of);
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath()));
|
||||
}
|
||||
return vf;
|
||||
}
|
||||
@ -461,7 +462,7 @@ public class OVFHelper {
|
||||
Element disk = (Element)disks.item(i);
|
||||
String fileRef = ovfParser.getNodeAttribute(disk, "fileRef");
|
||||
if (keepfile == null) {
|
||||
s_logger.info("FATAL: OVA format error");
|
||||
logger.info("FATAL: OVA format error");
|
||||
} else if (keepfile.equals(fileRef)) {
|
||||
keepdisk = ovfParser.getNodeAttribute(disk, "diskId");
|
||||
} else {
|
||||
@ -505,7 +506,7 @@ public class OVFHelper {
|
||||
outfile.write(writer.toString());
|
||||
outfile.close();
|
||||
} catch (IOException | TransformerException e) {
|
||||
s_logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e);
|
||||
logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e);
|
||||
throw new CloudRuntimeException(e);
|
||||
}
|
||||
}
|
||||
@ -521,8 +522,8 @@ public class OVFHelper {
|
||||
|
||||
public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws InternalErrorException {
|
||||
if (doc == null) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("no document to parse; returning no prerequisite networks");
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("no document to parse; returning no prerequisite networks");
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -539,8 +540,8 @@ public class OVFHelper {
|
||||
private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement) {
|
||||
final DocumentTraversal traversal = (DocumentTraversal) systemElement;
|
||||
final NodeIterator iterator = traversal.createNodeIterator(systemElement, NodeFilter.SHOW_ELEMENT, null, true);
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size()));
|
||||
}
|
||||
int nicCount = 0;
|
||||
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
|
||||
@ -549,8 +550,8 @@ public class OVFHelper {
|
||||
nicCount++;
|
||||
String name = e.getTextContent(); // should be in our nets
|
||||
if(nets.get(name) == null) {
|
||||
if(s_logger.isInfoEnabled()) {
|
||||
s_logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name));
|
||||
if(logger.isInfoEnabled()) {
|
||||
logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name));
|
||||
}
|
||||
nets.put(name, new OVFNetworkTO());
|
||||
}
|
||||
@ -560,8 +561,8 @@ public class OVFHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount));
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,7 +585,7 @@ public class OVFHelper {
|
||||
int addressOnParent = Integer.parseInt(addressOnParentStr);
|
||||
nic.setAddressOnParent(addressOnParent);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr);
|
||||
logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr);
|
||||
}
|
||||
|
||||
boolean automaticAllocation = StringUtils.isNotBlank(automaticAllocationStr) && Boolean.parseBoolean(automaticAllocationStr);
|
||||
@ -596,7 +597,7 @@ public class OVFHelper {
|
||||
int instanceId = Integer.parseInt(instanceIdStr);
|
||||
nic.setInstanceID(instanceId);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr);
|
||||
logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr);
|
||||
}
|
||||
|
||||
nic.setResourceSubType(resourceSubType);
|
||||
@ -608,7 +609,7 @@ public class OVFHelper {
|
||||
NodeList systemElements = ovfParser.getElementsFromOVFDocument(doc, "VirtualSystem");
|
||||
if (systemElements.getLength() != 1) {
|
||||
String msg = "found " + systemElements.getLength() + " system definitions in OVA, can only handle exactly one.";
|
||||
s_logger.warn(msg);
|
||||
logger.warn(msg);
|
||||
throw new InternalErrorException(msg);
|
||||
}
|
||||
}
|
||||
@ -629,8 +630,8 @@ public class OVFHelper {
|
||||
|
||||
nets.put(networkName,network);
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d networks in template", nets.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d networks in template", nets.size()));
|
||||
}
|
||||
return nets;
|
||||
}
|
||||
@ -770,7 +771,7 @@ public class OVFHelper {
|
||||
try {
|
||||
return Long.parseLong(value);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -781,7 +782,7 @@ public class OVFHelper {
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -819,7 +820,7 @@ public class OVFHelper {
|
||||
try {
|
||||
compressedLicense = compressOVFEula(eulaLicense);
|
||||
} catch (IOException e) {
|
||||
s_logger.error("Could not compress the license for info " + eulaInfo);
|
||||
logger.error("Could not compress the license for info " + eulaInfo);
|
||||
continue;
|
||||
}
|
||||
OVFEulaSectionTO eula = new OVFEulaSectionTO(eulaInfo, compressedLicense, eulaIndex);
|
||||
|
||||
@ -27,7 +27,8 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.utils.security.ParserUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@ -36,7 +37,7 @@ import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class OVFParser {
|
||||
private static final Logger s_logger = Logger.getLogger(OVFParser.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private static final String DEFAULT_OVF_SCHEMA = "http://schemas.dmtf.org/ovf/envelope/1";
|
||||
private static final String VMW_SCHEMA = "http://www.vmware.com/schema/ovf";
|
||||
@ -53,7 +54,7 @@ public class OVFParser {
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
s_logger.error("Cannot start the OVF parser: " + e.getMessage(), e);
|
||||
logger.error("Cannot start the OVF parser: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ public class OVFParser {
|
||||
try {
|
||||
return documentBuilder.parse(new File(ovfFilePath));
|
||||
} catch (SAXException | IOException e) {
|
||||
s_logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e);
|
||||
logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,10 +22,8 @@ import java.util.Date;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
static final Logger s_logger = Logger.getLogger(NetworkProfile.class);
|
||||
private final long id;
|
||||
private final String uuid;
|
||||
private final long dataCenterId;
|
||||
|
||||
@ -20,6 +20,7 @@ package com.cloud.storage;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
|
||||
public enum DataStoreRole {
|
||||
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup"), Object("object");
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import com.google.common.base.Enums;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -37,7 +38,7 @@ public enum RoleType {
|
||||
private Account.Type accountType;
|
||||
private int mask;
|
||||
|
||||
private static Logger logger = Logger.getLogger(RoleType.class.getName());
|
||||
private static Logger LOGGER = LogManager.getLogger(RoleType.class.getName());
|
||||
private static Map<Account.Type, RoleType> ACCOUNT_TYPE_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
@ -104,10 +105,10 @@ public enum RoleType {
|
||||
* */
|
||||
public static Account.Type getAccountTypeByRole(final Role role, final Account.Type defautAccountType) {
|
||||
if (role != null) {
|
||||
logger.debug(String.format("Role [%s] is not null; therefore, we use its account type [%s].", role, defautAccountType));
|
||||
LOGGER.debug(String.format("Role [%s] is not null; therefore, we use its account type [%s].", role, defautAccountType));
|
||||
return role.getRoleType().getAccountType();
|
||||
}
|
||||
logger.debug(String.format("Role is null; therefore, we use the default account type [%s] value.", defautAccountType));
|
||||
LOGGER.debug(String.format("Role is null; therefore, we use the default account type [%s] value.", defautAccountType));
|
||||
return defautAccountType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,11 +25,9 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class AbstractGetUploadParamsCmd extends BaseCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(AbstractGetUploadParamsCmd.class.getName());
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume/template/iso")
|
||||
private String name;
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* queryAsyncJobResult API command.
|
||||
@ -30,7 +29,6 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
||||
public static final String migrationSyncObject = "migration";
|
||||
public static final String snapshotHostSyncObject = "snapshothost";
|
||||
public static final String gslbSyncObject = "globalserverloadbalancer";
|
||||
private static final Logger s_logger = Logger.getLogger(BaseAsyncCmd.class.getName());
|
||||
|
||||
private Object job;
|
||||
|
||||
|
||||
@ -47,7 +47,8 @@ import org.apache.cloudstack.storage.ImageStoreService;
|
||||
import org.apache.cloudstack.storage.template.VnfTemplateManager;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -95,7 +96,7 @@ import com.cloud.vm.UserVmService;
|
||||
import com.cloud.vm.snapshot.VMSnapshotService;
|
||||
|
||||
public abstract class BaseCmd {
|
||||
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
|
||||
protected transient Logger logger = LogManager.getLogger(getClass());
|
||||
public static final String RESPONSE_SUFFIX = "response";
|
||||
public static final String RESPONSE_TYPE_XML = HttpUtils.RESPONSE_TYPE_XML;
|
||||
public static final String RESPONSE_TYPE_JSON = HttpUtils.RESPONSE_TYPE_JSON;
|
||||
@ -374,7 +375,7 @@ public abstract class BaseCmd {
|
||||
if (roleIsAllowed) {
|
||||
validFields.add(field);
|
||||
} else {
|
||||
s_logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in");
|
||||
logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in");
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +420,7 @@ public abstract class BaseCmd {
|
||||
if(!isDisplay)
|
||||
break;
|
||||
} catch (Exception e){
|
||||
s_logger.trace("Caught exception while checking first class entities for display property, continuing on", e);
|
||||
logger.trace("Caught exception while checking first class entities for display property, continuing on", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.ResponseViewProvider;
|
||||
@ -28,7 +27,6 @@ import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd implements ResponseViewProvider {
|
||||
public Logger logger = getLogger();
|
||||
protected static final String s_name = "listtemplatepermissionsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -59,9 +57,6 @@ public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd implem
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
protected Logger getLogger() {
|
||||
return Logger.getLogger(BaseListTemplateOrIsoPermissionsCmd.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
|
||||
@ -24,7 +23,6 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(BaseUpdateTemplateOrIsoCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
@ -27,16 +26,12 @@ import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
|
||||
public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
|
||||
public Logger _logger = getLogger();
|
||||
protected String _name = getResponseName();
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
protected Logger getLogger() {
|
||||
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class);
|
||||
}
|
||||
|
||||
protected String getResponseName() {
|
||||
return "updatetemplateorisopermissionsresponse";
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
@ -43,7 +42,6 @@ import com.cloud.user.UserAccount;
|
||||
@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = true, responseHasSensitiveInfo = true)
|
||||
public class CreateAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateAccountCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -31,7 +31,6 @@ import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.region.RegionService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
@ -39,7 +38,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteAccountCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteAccountCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api.command.admin.account;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
@ -43,7 +42,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "disableAccount", description = "Disables an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class DisableAccountCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DisableAccountCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.account;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
@ -39,7 +38,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "enableAccount", description = "Enables an account", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class EnableAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(EnableAccountCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.account;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -35,7 +34,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = true)
|
||||
public class LockAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -23,7 +23,6 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.response.RoleResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
@ -43,7 +42,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||
public class UpdateAccountCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.address;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -35,7 +34,6 @@ import com.cloud.exception.ResourceUnavailableException;
|
||||
@APICommand(name = "acquirePodIpAddress", description = "Allocates IP addresses in respective Pod of a Zone", responseObject = AcquirePodIpCmdResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AcquirePodIpCmdByAdmin extends BaseCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(AcquirePodIpCmdByAdmin.class.getName());
|
||||
private static final String s_name = "acquirepodipaddress";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.address;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
@ -27,5 +26,4 @@ import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AssociateIPAddrCmdByAdmin extends AssociateIPAddrCmd implements AdminCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AssociateIPAddrCmdByAdmin.class.getName());
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
//under the License.
|
||||
package org.apache.cloudstack.api.command.admin.address;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -31,7 +30,6 @@ import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "releasePodIpAddress", description = "Releases a Pod IP back to the Pod", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ReleasePodIpCmdByAdmin extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ReleasePodIpCmdByAdmin.class.getName());
|
||||
|
||||
private static final String s_name = "releasepodipresponse";
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.affinitygroup;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
@ -33,5 +32,4 @@ import com.cloud.vm.VirtualMachine;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = true)
|
||||
public class UpdateVMAffinityGroupCmdByAdmin extends UpdateVMAffinityGroupCmd implements AdminCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmdByAdmin.class.getName());
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
|
||||
@ -35,7 +34,6 @@ import com.cloud.event.EventTypes;
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class GenerateAlertCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(GenerateAlertCmd.class.getName());
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.autoscale;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "createCounter", description = "Adds metric counter for VM auto scaling", responseObject = CounterResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateCounterCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateCounterCmd.class.getName());
|
||||
private static final String s_name = "counterresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.cloudstack.api.command.admin.autoscale;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteCounter", description = "Deletes a counter for VM auto scaling", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteCounterCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteCounterCmd.class.getName());
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
@ -55,7 +53,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
|
||||
try {
|
||||
result = _autoScaleService.deleteCounter(getId());
|
||||
} catch (ResourceInUseException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
|
||||
}
|
||||
|
||||
@ -63,7 +61,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
s_logger.warn("Failed to delete counter with Id: " + getId());
|
||||
logger.warn("Failed to delete counter with Id: " + getId());
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ import org.apache.cloudstack.backup.BackupManager;
|
||||
import org.apache.cloudstack.backup.BackupOffering;
|
||||
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.user.Account;
|
||||
@ -39,7 +38,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@APICommand(name = "updateBackupOffering", description = "Updates a backup offering.", responseObject = BackupOfferingResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16.0")
|
||||
public class UpdateBackupOfferingCmd extends BaseCmd {
|
||||
private static final Logger LOGGER = Logger.getLogger(UpdateBackupOfferingCmd.class.getName());
|
||||
|
||||
@Inject
|
||||
private BackupManager backupManager;
|
||||
@ -100,7 +98,7 @@ public class UpdateBackupOfferingCmd extends BaseCmd {
|
||||
this.setResponseObject(response);
|
||||
} catch (CloudRuntimeException e) {
|
||||
ApiErrorCode paramError = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR;
|
||||
LOGGER.error(String.format("Failed to update Backup Offering [id: %s] due to: [%s].", id, e.getMessage()), e);
|
||||
logger.error(String.format("Failed to update Backup Offering [id: %s] due to: [%s].", id, e.getMessage()), e);
|
||||
throw new ServerApiException(paramError, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.ca.Certificate;
|
||||
import org.apache.cloudstack.utils.security.CertUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
|
||||
@ -49,7 +48,6 @@ import com.cloud.event.EventTypes;
|
||||
since = "4.11.0",
|
||||
authorized = {RoleType.Admin})
|
||||
public class IssueCertificateCmd extends BaseAsyncCmd {
|
||||
private static final Logger LOG = Logger.getLogger(IssueCertificateCmd.class);
|
||||
|
||||
|
||||
@Inject
|
||||
@ -132,7 +130,7 @@ public class IssueCertificateCmd extends BaseAsyncCmd {
|
||||
certificateResponse.setCaCertificate(CertUtils.x509CertificatesToPem(certificate.getCaCertificates()));
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Failed to generate and convert client certificate(s) to PEM due to error: ", e);
|
||||
logger.error("Failed to generate and convert client certificate(s) to PEM due to error: ", e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to process and return client certificate");
|
||||
}
|
||||
certificateResponse.setResponseName(getCommandName());
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -42,7 +41,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "addCluster", description = "Adds a new cluster", responseObject = ClusterResponse.class,
|
||||
requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
|
||||
public class AddClusterCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, required = true, description = "the cluster name")
|
||||
@ -226,10 +224,10 @@ public class AddClusterCmd extends BaseCmd {
|
||||
|
||||
this.setResponseObject(response);
|
||||
} catch (DiscoveryException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
} catch (ResourceInUseException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
for (String proxyObj : ex.getIdProxyList()) {
|
||||
e.addProxyObject(proxyObj);
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.cluster;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -33,7 +32,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteCluster", description = "Deletes a cluster.", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteClusterCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteClusterCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.cluster;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -36,7 +35,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = "listClusters", description = "Lists clusters.", responseObject = ClusterResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListClustersCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListClustersCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.cluster;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -34,7 +33,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "updateCluster", description = "Updates an existing cluster", responseObject = ClusterResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateClusterCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddClusterCmd.class.getName());
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the ID of the Cluster")
|
||||
|
||||
@ -27,14 +27,12 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ConfigurationGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.config.ConfigurationGroup;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = ListCfgGroupsByCmd.APINAME, description = "Lists all configuration groups (primarily used for UI).", responseObject = ConfigurationGroupResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0")
|
||||
public class ListCfgGroupsByCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListCfgGroupsByCmd.class.getName());
|
||||
|
||||
public static final String APINAME = "listConfigurationGroups";
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -47,7 +46,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
public class ListCfgsByCmd extends BaseListCmd {
|
||||
|
||||
public static final String APINAME = "listConfigurations";
|
||||
public static final Logger s_logger = Logger.getLogger(ListCfgsByCmd.class.getName());
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
@ -29,7 +28,6 @@ import org.apache.cloudstack.api.response.ListResponse;
|
||||
@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDeploymentPlannersCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -39,7 +38,6 @@ import com.cloud.utils.Pair;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class ListHypervisorCapabilitiesCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListHypervisorCapabilitiesCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -25,7 +25,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ClusterResponse;
|
||||
@ -41,7 +40,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = "resetConfiguration", description = "Resets a configuration. The configuration will be set to default value for global setting, and removed from account_details or domain_details for Account/Domain settings", responseObject = ConfigurationResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16.0")
|
||||
public class ResetCfgCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ResetCfgCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.config;
|
||||
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||
import org.apache.cloudstack.acl.RoleService;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiArgValidator;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -41,7 +40,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateCfgCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateCfgCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.config;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateHypervisorCapabilitiesCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -38,7 +38,6 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.diagnostics.DiagnosticsService;
|
||||
import org.apache.cloudstack.diagnostics.DiagnosticsType;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
@ -53,7 +52,6 @@ import com.cloud.vm.VirtualMachine;
|
||||
authorized = {RoleType.Admin},
|
||||
since = "4.12.0.0")
|
||||
public class RunDiagnosticsCmd extends BaseAsyncCmd {
|
||||
private static final Logger LOGGER = Logger.getLogger(RunDiagnosticsCmd.class);
|
||||
|
||||
@Inject
|
||||
private DiagnosticsService diagnosticsService;
|
||||
|
||||
@ -35,7 +35,6 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadCertificate;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadCertificateHostMap;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
@ -63,7 +62,6 @@ public class ListTemplateDirectDownloadCertificatesCmd extends BaseListCmd {
|
||||
description = "if set to true: include the hosts where the certificate is uploaded to")
|
||||
private Boolean listHosts;
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ListTemplateDirectDownloadCertificatesCmd.class);
|
||||
|
||||
public boolean isListHosts() {
|
||||
return listHosts != null && listHosts;
|
||||
|
||||
@ -41,7 +41,6 @@ import org.apache.cloudstack.direct.download.DirectDownloadManager;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadManager.HostCertificateStatus;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
@ -57,7 +56,6 @@ public class RevokeTemplateDirectDownloadCertificateCmd extends BaseCmd {
|
||||
@Inject
|
||||
DirectDownloadManager directDownloadManager;
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(RevokeTemplateDirectDownloadCertificateCmd.class);
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID,
|
||||
entityType = DirectDownloadCertificateResponse.class,
|
||||
|
||||
@ -33,7 +33,6 @@ import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadCertificate;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadManager;
|
||||
import org.apache.cloudstack.direct.download.DirectDownloadManager.HostCertificateStatus;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
@ -49,7 +48,6 @@ public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd {
|
||||
@Inject
|
||||
DirectDownloadManager directDownloadManager;
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(UploadTemplateDirectDownloadCertificateCmd.class);
|
||||
|
||||
@Parameter(name = ApiConstants.CERTIFICATE, type = BaseCmd.CommandType.STRING, required = true, length = 65535,
|
||||
description = "SSL certificate")
|
||||
@ -97,7 +95,7 @@ public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
try {
|
||||
LOG.debug("Uploading certificate " + name + " to agents for Direct Download");
|
||||
logger.debug("Uploading certificate " + name + " to agents for Direct Download");
|
||||
Pair<DirectDownloadCertificate, List<HostCertificateStatus>> uploadStatus =
|
||||
directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor, zoneId, hostId);
|
||||
DirectDownloadCertificate certificate = uploadStatus.first();
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.domain;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {
|
||||
RoleType.Admin, RoleType.DomainAdmin })
|
||||
public class CreateDomainCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateDomainCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -30,7 +30,6 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.region.RegionService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.event.EventTypes;
|
||||
@ -40,7 +39,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {
|
||||
RoleType.Admin, RoleType.DomainAdmin })
|
||||
public class DeleteDomainCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteDomainCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -22,7 +22,6 @@ import java.util.List;
|
||||
import com.cloud.server.ResourceIcon;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import org.apache.cloudstack.api.response.ResourceIconResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -37,7 +36,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = "listDomainChildren", description = "Lists all children domains belonging to a specified domain", responseObject = DomainResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDomainChildrenCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDomainChildrenCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -23,7 +23,6 @@ import java.util.List;
|
||||
import com.cloud.server.ResourceIcon;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import org.apache.cloudstack.api.response.ResourceIconResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -41,7 +40,6 @@ import com.cloud.exception.InvalidParameterValueException;
|
||||
@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class, responseView = ResponseView.Restricted, entityType = {Domain.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDomainsCmd extends BaseListCmd implements UserCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDomainsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listdomainsresponse";
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.domain;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -37,7 +36,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "updateDomain", description = "Updates a domain with a new name", responseObject = DomainResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateDomainCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateDomainCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -43,7 +42,6 @@ import java.util.Map;
|
||||
@APICommand(name = "addGuestOs", description = "Add a new guest OS type", responseObject = GuestOSResponse.class,
|
||||
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AddGuestOsCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddGuestOsCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "addGuestOsMapping", description = "Adds a guest OS name to hypervisor OS name mapping", responseObject = GuestOsMappingResponse.class,
|
||||
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AddGuestOsMappingCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddGuestOsMappingCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -26,7 +26,6 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.HypervisorGuestOsNamesResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
@ -35,8 +34,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = GetHypervisorGuestOsNamesCmd.APINAME, description = "Gets the guest OS names in the hypervisor", responseObject = HypervisorGuestOsNamesResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin})
|
||||
public class GetHypervisorGuestOsNamesCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(GetHypervisorGuestOsNamesCmd.class.getName());
|
||||
|
||||
public static final String APINAME = "getHypervisorGuestOsNames";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.guest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -35,7 +34,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = "listGuestOsMapping", description = "Lists all available OS mappings for given hypervisor", responseObject = GuestOsMappingResponse.class,
|
||||
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListGuestOsMappingCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListGuestOsMappingCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class RemoveGuestOsCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(RemoveGuestOsCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class RemoveGuestOsMappingCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(RemoveGuestOsMappingCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -42,7 +41,6 @@ import java.util.Map;
|
||||
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateGuestOsCmd extends BaseAsyncCmd {
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateGuestOsCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.guest;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "updateGuestOsMapping", description = "Updates the information about Guest OS to Hypervisor specific name mapping", responseObject = GuestOsMappingResponse.class,
|
||||
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateGuestOsMappingCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateGuestOsMappingCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.host;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -40,7 +39,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "addHost", description = "Adds a new host.", responseObject = HostResponse.class,
|
||||
requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
|
||||
public class AddHostCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddHostCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -150,7 +148,7 @@ public class AddHostCmd extends BaseCmd {
|
||||
|
||||
this.setResponseObject(response);
|
||||
} catch (DiscoveryException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -34,7 +33,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AddSecondaryStorageCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddSecondaryStorageCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
@ -81,7 +79,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||
}
|
||||
} catch (DiscoveryException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "cancelHostMaintenance", description = "Cancels host maintenance.", responseObject = HostResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CancelMaintenanceCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CancelMaintenanceCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -32,7 +31,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteHostCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteHostCmd.class.getName());
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -37,7 +36,6 @@ import com.cloud.utils.Ternary;
|
||||
@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class FindHostsForMigrationCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(FindHostsForMigrationCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
@ -27,7 +26,6 @@ import org.apache.cloudstack.api.response.HostTagResponse;
|
||||
|
||||
@APICommand(name = "listHostTags", description = "Lists host tags", responseObject = HostTagResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListHostTagsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListHostTagsCmd.class.getName());
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -45,7 +44,6 @@ import com.cloud.utils.Ternary;
|
||||
@APICommand(name = "listHosts", description = "Lists hosts.", responseObject = HostResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListHostsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -25,7 +25,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.host.Host;
|
||||
@ -35,7 +34,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@APICommand(name = "prepareHostForMaintenance", description = "Prepares a host for maintenance.", responseObject = HostResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(PrepareForMaintenanceCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -25,7 +25,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
@ -36,7 +35,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ReconnectHostCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.host;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "releaseHostReservation", description = "Releases host reservation.", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ReleaseHostReservationCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ReleaseHostReservationCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -27,14 +27,12 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateHostCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateHostCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
@ -127,7 +125,7 @@ public class UpdateHostCmd extends BaseCmd {
|
||||
hostResponse.setResponseName(getCommandName());
|
||||
this.setResponseObject(hostResponse);
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to update host:" + getId(), e);
|
||||
logger.debug("Failed to update host:" + getId(), e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,14 +24,12 @@ import org.apache.cloudstack.api.response.ClusterResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
|
||||
public class UpdateHostPasswordCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateHostPasswordCmd.class.getName());
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -47,7 +46,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ConfigureInternalLoadBalancerElementCmd.class.getName());
|
||||
|
||||
@Inject
|
||||
private List<InternalLoadBalancerElementService> _service;
|
||||
|
||||
@ -20,7 +20,6 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -45,7 +44,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateInternalLoadBalancerElementCmd.class.getName());
|
||||
|
||||
@Inject
|
||||
private List<InternalLoadBalancerElementService> _service;
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -39,7 +38,6 @@ import com.cloud.vm.VirtualMachine;
|
||||
@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListInternalLBVMsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listinternallbvmsresponse";
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -46,7 +45,6 @@ import com.cloud.network.VirtualRouterProvider;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
|
||||
|
||||
@Inject
|
||||
private InternalLoadBalancerElementService _service;
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
@ -42,7 +41,6 @@ import com.cloud.vm.VirtualMachine;
|
||||
@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.", entityType = {VirtualMachine.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class StartInternalLBVMCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(StartInternalLBVMCmd.class.getName());
|
||||
private static final String s_name = "startinternallbvmresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.internallb;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
@ -41,7 +40,6 @@ import com.cloud.vm.VirtualMachine;
|
||||
@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class StopInternalLBVMCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(StopInternalLBVMCmd.class.getName());
|
||||
private static final String s_name = "stopinternallbvmresponse";
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@ -23,12 +23,10 @@ import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ManagementServerResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listManagementServers", description = "Lists management servers.", responseObject = ManagementServerResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListMgmtsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListMgmtsCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -20,7 +20,6 @@ import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -44,7 +43,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
responseObject = NetworkDeviceResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AddNetworkDeviceCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddNetworkDeviceCmd.class);
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -43,7 +42,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddNetworkServiceProviderCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -27,7 +27,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DataCenterGuestIpv6PrefixResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.DataCenterGuestIpv6Prefix;
|
||||
import com.cloud.event.EventTypes;
|
||||
@ -45,7 +44,6 @@ import com.cloud.user.Account;
|
||||
responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin})
|
||||
public class CreateGuestNetworkIpv6PrefixCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateGuestNetworkIpv6PrefixCmd.class);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.ApiArgValidator;
|
||||
@ -44,7 +43,6 @@ import com.cloud.user.Account;
|
||||
responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin})
|
||||
public class CreateManagementNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateManagementNetworkIpRangeCmd.class);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.cloudstack.api.ApiArgValidator;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -32,7 +31,6 @@ import com.cloud.network.Network;
|
||||
@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full, entityType = {Network.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateNetworkCmdByAdmin extends CreateNetworkCmd implements AdminCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateNetworkCmdByAdmin.class.getName());
|
||||
|
||||
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the network")
|
||||
private String vlan;
|
||||
|
||||
@ -29,7 +29,6 @@ import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -50,7 +49,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateNetworkOfferingCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateNetworkOfferingCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -40,7 +39,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "createPhysicalNetwork", description = "Creates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreatePhysicalNetworkCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -42,7 +41,6 @@ import com.cloud.user.Account;
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = false)
|
||||
public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateStorageNetworkIpRangeCmd.class);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -119,7 +117,7 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Create storage network IP range failed", e);
|
||||
logger.warn("Create storage network IP range failed", e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -39,7 +38,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "dedicateGuestVlanRange", description = "Dedicates a guest vlan range to an account", responseObject = GuestVlanRangeResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DedicateGuestVlanRangeCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DedicateGuestVlanRangeCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -26,7 +26,6 @@ import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DataCenterGuestIpv6PrefixResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -45,7 +44,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin})
|
||||
public class DeleteGuestNetworkIpv6PrefixCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteGuestNetworkIpv6PrefixCmd.class);
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.ApiArgValidator;
|
||||
@ -42,7 +41,6 @@ import com.cloud.user.Account;
|
||||
responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin})
|
||||
public class DeleteManagementNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteManagementNetworkIpRangeCmd.class);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -112,13 +110,13 @@ public class DeleteManagementNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} catch (ResourceUnavailableException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||
} catch (ConcurrentOperationException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Failed to delete management ip range from " + getStartIp() + " to " + getEndIp() + " of Pod: " + getPodId(), e);
|
||||
logger.warn("Failed to delete management ip range from " + getStartIp() + " to " + getEndIp() + " of Pod: " + getPodId(), e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -40,7 +39,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@APICommand(name = "deleteNetworkDevice", description = "Deletes network device.", responseObject = SuccessResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteNetworkDeviceCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteNetworkDeviceCmd.class);
|
||||
|
||||
@Inject
|
||||
ExternalNetworkDeviceManager nwDeviceMgr;
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -32,7 +31,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteNetworkOffering", description = "Deletes a network offering.", responseObject = SuccessResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteNetworkOfferingCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -36,7 +35,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteNetworkServiceProvider", description = "Deletes a Network Service Provider.", responseObject = SuccessResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteNetworkServiceProviderCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -78,10 +76,10 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network service provider");
|
||||
}
|
||||
} catch (ResourceUnavailableException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
|
||||
} catch (ConcurrentOperationException ex) {
|
||||
s_logger.warn("Exception: ", ex);
|
||||
logger.warn("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
@ -35,7 +34,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deletePhysicalNetwork", description = "Deletes a Physical Network.", responseObject = SuccessResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeletePhysicalNetworkCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -37,7 +36,6 @@ import com.cloud.user.Account;
|
||||
@APICommand(name = "deleteStorageNetworkIpRange", description = "Deletes a storage network IP Range.", responseObject = SuccessResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteStorageNetworkIpRangeCmd.class);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
@ -77,7 +75,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Failed to delete storage network ip range " + getId(), e);
|
||||
logger.warn("Failed to delete storage network ip range " + getId(), e);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.api.command.admin.network;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
@ -39,7 +38,6 @@ import com.cloud.utils.Pair;
|
||||
@APICommand(name = "listDedicatedGuestVlanRanges", description = "Lists dedicated guest vlan ranges", responseObject = GuestVlanRangeResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDedicatedGuestVlanRangesCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDedicatedGuestVlanRangesCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user