cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [1/4] git commit: updated refs/heads/master to 302d519
Date Tue, 18 Nov 2014 13:32:03 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master e1d4a329c -> 302d5195d


CID-1254835 proxy can only be null in a special case

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8560cc3b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8560cc3b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8560cc3b

Branch: refs/heads/master
Commit: 8560cc3b012cfc8d1c4cf8dbbd5a4c6c06dc88e8
Parents: 3176068
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Tue Nov 18 09:30:37 2014 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Tue Nov 18 09:30:37 2014 +0100

----------------------------------------------------------------------
 .../cloud/alert/ConsoleProxyAlertAdapter.java   | 103 ++++++++++---------
 1 file changed, 54 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8560cc3b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
index 4ca5f4a..ba1dca4 100644
--- a/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
+++ b/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java
@@ -31,6 +31,7 @@ import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.events.SubscriptionMgr;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.ConsoleProxyVO;
 import com.cloud.vm.dao.ConsoleProxyDao;
 
@@ -57,87 +58,91 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte
         if (proxy == null && args.getProxyId() != 0)
             proxy = _consoleProxyDao.findById(args.getProxyId());
 
+        if (proxy == null && args.getType() != ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE)
{
+            throw new CloudRuntimeException("Invalid alert arguments, proxy must be set");
+        }
+
         switch (args.getType()) {
-            case ConsoleProxyAlertEventArgs.PROXY_CREATED:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("New console proxy created, zone: " + dc.getName() + ",
proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
+        case ConsoleProxyAlertEventArgs.PROXY_CREATED:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("New console proxy created, zone: " + dc.getName() + ", proxy:
" + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + proxy.getPrivateIpAddress());
-                break;
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_UP:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy:
" + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
+        case ConsoleProxyAlertEventArgs.PROXY_UP:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy: "
+ proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + proxy.getPrivateIpAddress());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
                     "Console proxy up in zone: " + dc.getName() +
-                        ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress()
+ ", private IP: " +
-                        (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
"Console proxy up (zone " + dc.getName() + ")");
-                break;
+                    ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress()
+ ", private IP: " +
+                    (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
"Console proxy up (zone " + dc.getName() + ")");
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_DOWN:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy:
" + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
+        case ConsoleProxyAlertEventArgs.PROXY_DOWN:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy:
" + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" :
proxy.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
                     "Console proxy down in zone: " + dc.getName() +
-                        ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress()
+ ", private IP: " +
-                        (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
"Console proxy down (zone " + dc.getName() + ")");
-                break;
+                    ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress()
+ ", private IP: " +
+                    (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
"Console proxy down (zone " + dc.getName() + ")");
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_REBOOTED:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy is rebooted, zone: " + dc.getName() + ",
proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
+        case ConsoleProxyAlertEventArgs.PROXY_REBOOTED:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy is rebooted, zone: " + dc.getName() + ", proxy:
" + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
                         ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" :
proxy.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
                     "Console proxy rebooted in zone: " + dc.getName() + ", proxy: " + proxy.getHostName()
+ ", public IP: " + proxy.getPublicIpAddress() +
-                        ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" :
proxy.getPrivateIpAddress()), "Console proxy rebooted (zone " + dc.getName() +
-                        ")");
-                break;
-
-            case ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy creation failure, zone: " + dc.getName());
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
null,
+                    ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
"Console proxy rebooted (zone " + dc.getName() +
+                    ")");
+            break;
+
+        case ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy creation failure, zone: " + dc.getName());
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
null,
                     "Console proxy creation failure. zone: " + dc.getName() + ", error details:
" + args.getMessage(),
                     "Console proxy creation failure (zone " + dc.getName() + ")");
-                break;
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy startup failure, zone: " + dc.getName()
+ ", proxy: " + proxy.getHostName() + ", public IP: " +
+        case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy startup failure, zone: " + dc.getName() + ",
proxy: " + proxy.getHostName() + ", public IP: " +
                         proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress()
== null ? "N/A" : proxy.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(),
proxy.getPodIdToDeployIn(),
                     "Console proxy startup failure. zone: " + dc.getName() + ", proxy: "
+ proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() +
-                        ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" :
proxy.getPrivateIpAddress()) + ", error details: " + args.getMessage(),
+                    ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())
+ ", error details: " + args.getMessage(),
                     "Console proxy startup failure (zone " + dc.getName() + ")");
-                break;
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy firewall alert, zone: " + dc.getName()
+ ", proxy: " + proxy.getHostName() + ", public IP: " +
+        case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy firewall alert, zone: " + dc.getName() + ",
proxy: " + proxy.getHostName() + ", public IP: " +
                         proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress()
== null ? "N/A" : proxy.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(
+            _alertMgr.sendAlert(
                     AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY,
                     args.getZoneId(),
                     proxy.getPodIdToDeployIn(),
                     "Failed to open console proxy firewall port. zone: " + dc.getName() +
", proxy: " + proxy.getHostName() + ", public IP: " +
-                        proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress()
== null ? "N/A" : proxy.getPrivateIpAddress()),
-                    "Console proxy alert (zone " + dc.getName() + ")");
-                break;
+                            proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress()
== null ? "N/A" : proxy.getPrivateIpAddress()),
+                            "Console proxy alert (zone " + dc.getName() + ")");
+            break;
 
-            case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Console proxy storage alert, zone: " + dc.getName() +
", proxy: " + proxy.getHostName() + ", public IP: " +
+        case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Console proxy storage alert, zone: " + dc.getName() + ",
proxy: " + proxy.getHostName() + ", public IP: " +
                         proxy.getPublicIpAddress() + ", private IP: " + proxy.getPrivateIpAddress()
+ ", message: " + args.getMessage());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(),
proxy.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(),
proxy.getPodIdToDeployIn(),
                     "Console proxy storage issue. zone: " + dc.getName() + ", message: "
+ args.getMessage(), "Console proxy alert (zone " + dc.getName() + ")");
-                break;
+            break;
         }
     }
 


Mime
View raw message