From e9b1c5f9c3932819a43733b65b314be3be327d60 Mon Sep 17 00:00:00 2001 From: frank Date: Wed, 30 Nov 2011 11:24:47 -0800 Subject: [PATCH] Bug 12047 - OVM Host Agent Username and Password are being logged in the management Server Log status 12047: resolved fixed --- ovm/src/com/cloud/ovm/object/Connection.java | 19 +++++++++++++++++-- ovm/src/com/cloud/ovm/object/OvmHost.java | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) mode change 100644 => 100755 ovm/src/com/cloud/ovm/object/Connection.java mode change 100644 => 100755 ovm/src/com/cloud/ovm/object/OvmHost.java diff --git a/ovm/src/com/cloud/ovm/object/Connection.java b/ovm/src/com/cloud/ovm/object/Connection.java old mode 100644 new mode 100755 index 8055a3e9c48..7bb92900900 --- a/ovm/src/com/cloud/ovm/object/Connection.java +++ b/ovm/src/com/cloud/ovm/object/Connection.java @@ -62,7 +62,12 @@ public class Connection { return callTimeoutInSec(method, params, 600); } - public Object callTimeoutInSec(String method, Object[] params, int timeout) throws XmlRpcException { + public Object call(String method, Object[] params, boolean debug) throws XmlRpcException { + /* default timeout is 10 mins */ + return callTimeoutInSec(method, params, 600, debug); + } + + public Object callTimeoutInSec(String method, Object[] params, int timeout, boolean debug) throws XmlRpcException { TimingOutCallback callback = new TimingOutCallback(timeout * 1000); Object[] mParams = new Object[params.length + 1]; mParams[0] = method; @@ -70,7 +75,13 @@ public class Connection { mParams[i+1] = params[i]; } - s_logger.debug("Call Ovm agent: " + Coder.toJson(mParams)); + if (debug) { + /* + * some parameters including user password should not be printed in log + */ + s_logger.debug("Call Ovm agent: " + Coder.toJson(mParams)); + } + long startTime = System.currentTimeMillis(); _client.executeAsync("OvmDispatch", mParams, callback); try { @@ -86,6 +97,10 @@ public class Connection { } } + public Object callTimeoutInSec(String method, Object[] params, int timeout) throws XmlRpcException { + return callTimeoutInSec(method, params, timeout, true); + } + public String getIp() { return _ip; } diff --git a/ovm/src/com/cloud/ovm/object/OvmHost.java b/ovm/src/com/cloud/ovm/object/OvmHost.java old mode 100644 new mode 100755 index 5a3492477f8..864e6a1fa2a --- a/ovm/src/com/cloud/ovm/object/OvmHost.java +++ b/ovm/src/com/cloud/ovm/object/OvmHost.java @@ -29,7 +29,7 @@ public class OvmHost extends OvmObject { public static void registerAsMaster(Connection c) throws XmlRpcException { Object[] params = {c.getIp(), c.getUserName(), c.getPassword(), c.getPort(), c.getIsSsl()}; - c.call("OvmHost.registerAsMaster", params); + c.call("OvmHost.registerAsMaster", params, false); } public static void registerAsVmServer(Connection c) throws XmlRpcException {