cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [2/4] git commit: updated refs/heads/master to 302d519
Date Tue, 18 Nov 2014 13:32:04 GMT
CID-1254834 secStorageVm 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/ef303002
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ef303002
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ef303002

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

----------------------------------------------------------------------
 .../alert/SecondaryStorageVmAlertAdapter.java   | 105 ++++++++++---------
 1 file changed, 55 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ef303002/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
index 3bfedce..392015b 100644
--- a/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
+++ b/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java
@@ -31,6 +31,7 @@ import com.cloud.storage.secondary.SecStorageVmAlertEventArgs;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.events.SubscriptionMgr;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.SecondaryStorageVmVO;
 import com.cloud.vm.dao.SecondaryStorageVmDao;
 
@@ -56,92 +57,96 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements
Alert
         if (secStorageVm == null && args.getSecStorageVmId() != 0)
             secStorageVm = _ssvmDao.findById(args.getSecStorageVmId());
 
+        if (secStorageVm == null && args.getType() != SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE)
{
+            throw new CloudRuntimeException("Invalid alert arguments, secStorageVm must be
set");
+        }
+
         switch (args.getType()) {
-            case SecStorageVmAlertEventArgs.SSVM_CREATED:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("New secondary storage vm created, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_CREATED:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("New secondary storage vm created, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress());
-                break;
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_UP:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() +
", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_UP:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() + ", secStorageVm:
" + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm up in zone: " +
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm up in zone: " +
                     dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public
IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
                     (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()),
"Secondary Storage Vm up (zone " + dc.getName() + ")");
-                break;
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_DOWN:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm is down, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_DOWN:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm is down, zone: " + dc.getName() + ",
secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(
+            _alertMgr.sendAlert(
                     AlertManager.AlertType.ALERT_TYPE_SSVM,
                     args.getZoneId(),
                     secStorageVm.getPodIdToDeployIn(),
                     "Secondary Storage Vm down in zone: " + dc.getName() + ", secStorageVm:
" + secStorageVm.getHostName() + ", public IP: " +
-                        secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
-                    "Secondary Storage Vm down (zone " + dc.getName() + ")");
-                break;
+                            secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
+                            "Secondary Storage Vm down (zone " + dc.getName() + ")");
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_REBOOTED:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_REBOOTED:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(
+            _alertMgr.sendAlert(
                     AlertManager.AlertType.ALERT_TYPE_SSVM,
                     args.getZoneId(),
                     secStorageVm.getPodIdToDeployIn(),
                     "Secondary Storage Vm rebooted in zone: " + dc.getName() + ", secStorageVm:
" + secStorageVm.getHostName() + ", public IP: " +
-                        secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
-                    "Secondary Storage Vm rebooted (zone " + dc.getName() + ")");
-                break;
+                            secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
+                            "Secondary Storage Vm rebooted (zone " + dc.getName() + ")");
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName());
+        case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
null,
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
null,
                     "Secondary Storage Vm creation failure. zone: " + dc.getName() + ", error
details: " + args.getMessage(),
                     "Secondary Storage Vm creation failure (zone " + dc.getName() + ")");
-                break;
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_START_FAILURE:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_START_FAILURE:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
                     "Secondary Storage Vm startup failure. zone: " +
-                        dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() +
", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
-                        (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())
+ ", error details: " + args.getMessage(),
-                    "Secondary Storage Vm startup failure (zone " + dc.getName() + ")");
-                break;
-
-            case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+                            dc.getName() + ", secStorageVm: " + secStorageVm.getHostName()
+ ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
+                            (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())
+ ", error details: " + args.getMessage(),
+                            "Secondary Storage Vm startup failure (zone " + dc.getName()
+ ")");
+            break;
+
+        case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()));
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
                     "Failed to open secondary storage vm firewall port. zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
-                        secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
-                    "Secondary Storage Vm alert (zone " + dc.getName() + ")");
-                break;
+                            secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress()
== null ? "N/A" : secStorageVm.getPrivateIpAddress()),
+                            "Secondary Storage Vm alert (zone " + dc.getName() + ")");
+            break;
 
-            case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT:
-                if (s_logger.isDebugEnabled())
-                    s_logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
+        case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT:
+            if (s_logger.isDebugEnabled())
+                s_logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName()
+ ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " +
                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress()
+ ", message: " + args.getMessage());
 
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
+            _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(),
secStorageVm.getPodIdToDeployIn(),
                     "Secondary Storage Vm storage issue. zone: " + dc.getName() + ", message:
" + args.getMessage(), "Secondary Storage Vm alert (zone " + dc.getName() +
-                        ")");
-                break;
+                    ")");
+            break;
         }
     }
 


Mime
View raw message