mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Merge release branch 4.18 to main
* 4.18: Fix PR 7131 bugs and vulnerabilities (#7140)
This commit is contained in:
		
						commit
						1d0762e43a
					
				| @ -1759,7 +1759,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public boolean passCmdLine(final String vmName, final String cmdLine) throws InternalErrorException { |     public boolean passCmdLine(final String vmName, final String cmdLine) throws InternalErrorException { | ||||||
|         final Script command = new Script(_patchScriptPath, 300 * 1000, s_logger); |         final Script command = new Script(_patchScriptPath, 300000, s_logger); | ||||||
|         String result; |         String result; | ||||||
|         command.add("-n", vmName); |         command.add("-n", vmName); | ||||||
|         command.add("-c", cmdLine); |         command.add("-c", cmdLine); | ||||||
|  | |||||||
| @ -1427,7 +1427,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { | |||||||
| 
 | 
 | ||||||
|                 r.ioCtxDestroy(io); |                 r.ioCtxDestroy(io); | ||||||
|             } catch (QemuImgException | LibvirtException e) { |             } catch (QemuImgException | LibvirtException e) { | ||||||
|                 s_logger.error("Failed to convert from " + srcFile.getFileName() + " to " + destFile.getFileName() + " the error was: " + e.getMessage()); |                 String srcFilename = srcFile != null ? srcFile.getFileName() : null; | ||||||
|  |                 String destFilename = destFile != null ? destFile.getFileName() : null; | ||||||
|  |                 s_logger.error(String.format("Failed to convert from %s to %s the error was: %s", srcFilename, destFilename, e.getMessage())); | ||||||
|                 newDisk = null; |                 newDisk = null; | ||||||
|             } catch (RadosException e) { |             } catch (RadosException e) { | ||||||
|                 s_logger.error("A Ceph RADOS operation failed (" + e.getReturnValue() + "). The error was: " + e.getMessage()); |                 s_logger.error("A Ceph RADOS operation failed (" + e.getReturnValue() + "). The error was: " + e.getMessage()); | ||||||
|  | |||||||
| @ -258,7 +258,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { | |||||||
| 
 | 
 | ||||||
|         _canBridgeFirewall = false; |         _canBridgeFirewall = false; | ||||||
| 
 | 
 | ||||||
|         s_logger.debug(_canBridgeFirewall ? "OVM host supports security groups." : "OVM host doesn't support security groups."); |         s_logger.debug("OVM host doesn't support security groups."); | ||||||
| 
 | 
 | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -7541,6 +7541,11 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes | |||||||
|                     // prepare network on the host |                     // prepare network on the host | ||||||
|                     prepareNetworkFromNicInfo((HostMO)targetHyperHost, nic, false, vmTo.getType()); |                     prepareNetworkFromNicInfo((HostMO)targetHyperHost, nic, false, vmTo.getType()); | ||||||
|                 } |                 } | ||||||
|  | 
 | ||||||
|  |                 if (targetHyperHost == null) { | ||||||
|  |                     throw new CloudRuntimeException(String.format("Trying to relocate VM [%s], but target hyper host is null.", vmTo.getUuid())); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 // Ensure secondary storage mounted on target host |                 // Ensure secondary storage mounted on target host | ||||||
|                 VmwareManager mgr = targetHyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); |                 VmwareManager mgr = targetHyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); | ||||||
|                 Pair<String, Long> secStoreUrlAndId = mgr.getSecondaryStorageStoreUrlAndId(Long.parseLong(_dcId)); |                 Pair<String, Long> secStoreUrlAndId = mgr.getSecondaryStorageStoreUrlAndId(Long.parseLong(_dcId)); | ||||||
|  | |||||||
| @ -210,7 +210,8 @@ public class XenServerConnectionPool { | |||||||
|                         throw e; |                         throw e; | ||||||
|                 } catch (Exception e) { |                 } catch (Exception e) { | ||||||
|                     if (s_logger.isDebugEnabled()) { |                     if (s_logger.isDebugEnabled()) { | ||||||
|                         s_logger.debug("connect through IP(" + mConn.getIp() + " for pool(" + poolUuid + ") is broken due to " + e.toString()); |                         String ip = mConn != null ? mConn.getIp() : null; | ||||||
|  |                         s_logger.debug("connect through IP(" + ip + ") for pool(" + poolUuid + ") is broken due to " + e.toString()); | ||||||
|                     } |                     } | ||||||
|                     removeConnect(poolUuid); |                     removeConnect(poolUuid); | ||||||
|                     mConn = null; |                     mConn = null; | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ import java.util.Map; | |||||||
| import javax.inject.Inject; | import javax.inject.Inject; | ||||||
| import javax.naming.ConfigurationException; | import javax.naming.ConfigurationException; | ||||||
| 
 | 
 | ||||||
|  | import org.apache.cloudstack.alert.AlertService; | ||||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
| 
 | 
 | ||||||
| @ -60,87 +61,95 @@ public class ConsoleProxyAlertAdapter extends AdapterBase implements AlertAdapte | |||||||
|             throw new CloudRuntimeException("Invalid alert arguments, proxy must be set"); |             throw new CloudRuntimeException("Invalid alert arguments, proxy must be set"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         String proxyHostName = ""; | ||||||
|  |         String proxyPublicIpAddress = ""; | ||||||
|  |         String proxyPrivateIpAddress = "N/A"; | ||||||
|  |         Long proxyPodIdToDeployIn = null; | ||||||
|  | 
 | ||||||
|  |         if (proxy != null) { | ||||||
|  |             proxyHostName = proxy.getHostName(); | ||||||
|  |             proxyPublicIpAddress = proxy.getPublicIpAddress(); | ||||||
|  |             proxyPrivateIpAddress = proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress(); | ||||||
|  |             proxyPodIdToDeployIn = proxy.getPodIdToDeployIn(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String message = ""; | ||||||
|  |         String zoneProxyPublicAndPrivateIp = String.format("zone [%s], proxy [%s], public IP [%s], private IP [%s].", dc.getName(), proxyHostName, proxyPublicIpAddress, | ||||||
|  |                 proxyPrivateIpAddress); | ||||||
|  |         String zone = String.format("(zone %s)", dc.getName()); | ||||||
|  |         String errorDetails = " Error details: " + args.getMessage(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|         switch (args.getType()) { |         switch (args.getType()) { | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_CREATED: |             case ConsoleProxyAlertEventArgs.PROXY_CREATED: | ||||||
|             if (s_logger.isDebugEnabled()) |                 if (s_logger.isDebugEnabled()) { | ||||||
|                 s_logger.debug("New console proxy created, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                     s_logger.debug("New console proxy created, " + zoneProxyPublicAndPrivateIp); | ||||||
|                         ", private IP: " + proxy.getPrivateIpAddress()); |                 } | ||||||
|             break; |                 break; | ||||||
| 
 | 
 | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_UP: |             case ConsoleProxyAlertEventArgs.PROXY_UP: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Console proxy up in " + zoneProxyPublicAndPrivateIp; | ||||||
|                 s_logger.debug("Console proxy is up, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         ", private IP: " + proxy.getPrivateIpAddress()); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxyPodIdToDeployIn, message, "Console proxy up " + zone); | ||||||
|                     "Console proxy up in 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: |             case ConsoleProxyAlertEventArgs.PROXY_DOWN: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Console proxy is down in " + zoneProxyPublicAndPrivateIp; | ||||||
|                 s_logger.debug("Console proxy is down, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxyPodIdToDeployIn, message, "Console proxy down " + zone); | ||||||
|                     "Console proxy down in 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: |             case ConsoleProxyAlertEventArgs.PROXY_REBOOTED: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Console proxy is rebooted in " + zoneProxyPublicAndPrivateIp; | ||||||
|                 s_logger.debug("Console proxy is rebooted, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxy.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxyPodIdToDeployIn, message, "Console proxy rebooted " + zone); | ||||||
|                     "Console proxy rebooted in zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                 break; | ||||||
|                     ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy rebooted (zone " + dc.getName() + |  | ||||||
|                     ")"); |  | ||||||
|             break; |  | ||||||
| 
 | 
 | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE: |             case ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = String.format("Console proxy creation failure. Zone [%s].", dc.getName()); | ||||||
|                 s_logger.debug("Console proxy creation failure, zone: " + dc.getName()); |                 if (s_logger.isDebugEnabled()) { | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), null, |                     s_logger.debug(message); | ||||||
|                     "Console proxy creation failure. zone: " + dc.getName() + ", error details: " + args.getMessage(), |                 } | ||||||
|                     "Console proxy creation failure (zone " + dc.getName() + ")"); |  | ||||||
|             break; |  | ||||||
| 
 | 
 | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE: |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), null, message + errorDetails, "Console proxy creation failure " + zone); | ||||||
|             if (s_logger.isDebugEnabled()) |                 break; | ||||||
|                 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(), |             case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE: | ||||||
|                     "Console proxy startup failure. zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + proxy.getPublicIpAddress() + |                 message = "Console proxy startup failure in " + zoneProxyPublicAndPrivateIp; | ||||||
|                     ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()) + ", error details: " + args.getMessage(), |                 if (s_logger.isDebugEnabled()) { | ||||||
|                     "Console proxy startup failure (zone " + dc.getName() + ")"); |                     s_logger.debug(message); | ||||||
|             break; |                 } | ||||||
| 
 | 
 | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT: |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxyPodIdToDeployIn, message + errorDetails, | ||||||
|             if (s_logger.isDebugEnabled()) |                         "Console proxy startup failure " + zone); | ||||||
|                 s_logger.debug("Console proxy firewall alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + |                 break; | ||||||
|                         proxy.getPublicIpAddress() + ", private IP: " + (proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress())); |  | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert( |             case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT: | ||||||
|                     AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, |                 if (s_logger.isDebugEnabled()) { | ||||||
|                     args.getZoneId(), |                     s_logger.debug("Console proxy firewall alert, " + zoneProxyPublicAndPrivateIp); | ||||||
|                     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; |  | ||||||
| 
 | 
 | ||||||
|         case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT: |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_CONSOLE_PROXY, args.getZoneId(), proxyPodIdToDeployIn, "Failed to open console proxy firewall port. " + | ||||||
|             if (s_logger.isDebugEnabled()) |                         zoneProxyPublicAndPrivateIp, "Console proxy alert " + zone); | ||||||
|                 s_logger.debug("Console proxy storage alert, zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + |                 break; | ||||||
|                         proxy.getPublicIpAddress() + ", private IP: " + proxy.getPrivateIpAddress() + ", message: " + args.getMessage()); |  | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), proxy.getPodIdToDeployIn(), |             case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT: | ||||||
|                     "Console proxy storage issue. zone: " + dc.getName() + ", message: " + args.getMessage(), "Console proxy alert (zone " + dc.getName() + ")"); |                 message = zoneProxyPublicAndPrivateIp + ", message: " + args.getMessage(); | ||||||
|             break; |                 if (s_logger.isDebugEnabled()) { | ||||||
|  |                     s_logger.debug("Console proxy storage alert, " + message); | ||||||
|  |                 } | ||||||
|  |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), proxyPodIdToDeployIn, "Console proxy storage issue. " + message, | ||||||
|  |                         "Console proxy alert " + zone); | ||||||
|  |                 break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ import java.util.Map; | |||||||
| import javax.inject.Inject; | import javax.inject.Inject; | ||||||
| import javax.naming.ConfigurationException; | import javax.naming.ConfigurationException; | ||||||
| 
 | 
 | ||||||
|  | import org.apache.cloudstack.alert.AlertService; | ||||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
| 
 | 
 | ||||||
| @ -59,92 +60,94 @@ public class SecondaryStorageVmAlertAdapter extends AdapterBase implements Alert | |||||||
|             throw new CloudRuntimeException("Invalid alert arguments, secStorageVm must be set"); |             throw new CloudRuntimeException("Invalid alert arguments, secStorageVm must be set"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         String secStorageVmHostName = ""; | ||||||
|  |         String secStorageVmPublicIpAddress = ""; | ||||||
|  |         String secStorageVmPrivateIpAddress = "N/A"; | ||||||
|  |         Long secStorageVmPodIdToDeployIn = null; | ||||||
|  | 
 | ||||||
|  |         if (secStorageVm != null) { | ||||||
|  |             secStorageVmHostName = secStorageVm.getHostName(); | ||||||
|  |             secStorageVmPublicIpAddress = secStorageVm.getPublicIpAddress(); | ||||||
|  |             secStorageVmPrivateIpAddress = secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress(); | ||||||
|  |             secStorageVmPodIdToDeployIn = secStorageVm.getPodIdToDeployIn(); | ||||||
|  |         } | ||||||
|  |         String message = ""; | ||||||
|  |         String zoneSecStorageVmPrivateAndPublicIp = String.format("zone [%s], secStorageVm [%s], public IP [%s], private IP [%s].", dc.getName(), secStorageVmHostName, | ||||||
|  |                 secStorageVmPublicIpAddress, secStorageVmPrivateIpAddress); | ||||||
|  |         String errorDetails = " Error details: " + args.getMessage(); | ||||||
|  |         String zone = String.format("(zone %s)", dc.getName()); | ||||||
|  | 
 | ||||||
|         switch (args.getType()) { |         switch (args.getType()) { | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_CREATED: |             case SecStorageVmAlertEventArgs.SSVM_CREATED: | ||||||
|             if (s_logger.isDebugEnabled()) |                 if (s_logger.isDebugEnabled()) { | ||||||
|                 s_logger.debug("New secondary storage vm created, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                     s_logger.debug("New secondary storage vm created in " + zoneSecStorageVmPrivateAndPublicIp); | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress()); |                 } | ||||||
|             break; |                 break; | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_UP: |             case SecStorageVmAlertEventArgs.SSVM_UP: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Secondary Storage Vm is up in " + zoneSecStorageVmPrivateAndPublicIp; | ||||||
|                 s_logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress()); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm up in zone: " + |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVmPodIdToDeployIn, message, "Secondary Storage Vm up " + zone); | ||||||
|                     dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + |                 break; | ||||||
|                     (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()), "Secondary Storage Vm up (zone " + dc.getName() + ")"); |  | ||||||
|             break; |  | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_DOWN: |             case SecStorageVmAlertEventArgs.SSVM_DOWN: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Secondary Storage Vm is down in " + zoneSecStorageVmPrivateAndPublicIp; | ||||||
|                 s_logger.debug("Secondary Storage Vm is down, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert( |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVmPodIdToDeployIn, message, "Secondary Storage Vm down " + zone); | ||||||
|                     AlertManager.AlertType.ALERT_TYPE_SSVM, |                 break; | ||||||
|                     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; |  | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_REBOOTED: |             case SecStorageVmAlertEventArgs.SSVM_REBOOTED: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Secondary Storage Vm rebooted in " + zoneSecStorageVmPrivateAndPublicIp; | ||||||
|                 s_logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert( |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVmPodIdToDeployIn, message, "Secondary Storage Vm rebooted " + zone); | ||||||
|                     AlertManager.AlertType.ALERT_TYPE_SSVM, |                 break; | ||||||
|                     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; |  | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE: |             case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = String.format("Secondary Storage Vm creation failure in zone [%s].", dc.getName()); | ||||||
|                 s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName()); |                 if (s_logger.isDebugEnabled()) { | ||||||
|  |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), null, |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), null, message + errorDetails, | ||||||
|                     "Secondary Storage Vm creation failure. zone: " + dc.getName() + ", error details: " + args.getMessage(), |                         "Secondary Storage Vm creation failure " + zone); | ||||||
|                     "Secondary Storage Vm creation failure (zone " + dc.getName() + ")"); |                 break; | ||||||
|             break; |  | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_START_FAILURE: |             case SecStorageVmAlertEventArgs.SSVM_START_FAILURE: | ||||||
|             if (s_logger.isDebugEnabled()) |                 message = "Secondary Storage Vm startup failure in " + zoneSecStorageVmPrivateAndPublicIp; | ||||||
|                 s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                 if (s_logger.isDebugEnabled()) { | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); |                     s_logger.debug(message); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVmPodIdToDeployIn, message + errorDetails, | ||||||
|                     "Secondary Storage Vm startup failure. zone: " + |                         "Secondary Storage Vm startup failure " + zone); | ||||||
|                             dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " + |                 break; | ||||||
|                             (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: |             case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT: | ||||||
|             if (s_logger.isDebugEnabled()) |                 if (s_logger.isDebugEnabled()) { | ||||||
|                 s_logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                     s_logger.debug("Secondary Storage Vm firewall alert, " + zoneSecStorageVmPrivateAndPublicIp); | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())); |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), secStorageVmPodIdToDeployIn, "Failed to open secondary storage vm firewall port. " | ||||||
|                     "Failed to open secondary storage vm firewall port. zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                                 + zoneSecStorageVmPrivateAndPublicIp, "Secondary Storage Vm alert " + zone); | ||||||
|                             secStorageVm.getPublicIpAddress() + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()), |                 break; | ||||||
|                             "Secondary Storage Vm alert (zone " + dc.getName() + ")"); |  | ||||||
|             break; |  | ||||||
| 
 | 
 | ||||||
|         case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT: |             case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT: | ||||||
|             if (s_logger.isDebugEnabled()) |                 if (s_logger.isDebugEnabled()) { | ||||||
|                 s_logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + |                     s_logger.debug("Secondary Storage Vm storage alert, " + zoneSecStorageVmPrivateAndPublicIp + ", message: " + args.getMessage()); | ||||||
|                         secStorageVm.getPublicIpAddress() + ", private IP: " + secStorageVm.getPrivateIpAddress() + ", message: " + args.getMessage()); |                 } | ||||||
| 
 | 
 | ||||||
|             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), secStorageVm.getPodIdToDeployIn(), |                 _alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_STORAGE_MISC, args.getZoneId(), secStorageVmPodIdToDeployIn, | ||||||
|                     "Secondary Storage Vm storage issue. zone: " + dc.getName() + ", message: " + args.getMessage(), "Secondary Storage Vm alert (zone " + dc.getName() + |                         "Secondary Storage Vm storage issue. zone: " + dc.getName() + ", message: " + args.getMessage(), "Secondary Storage Vm alert " + zone); | ||||||
|                     ")"); |                 break; | ||||||
|             break; |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -188,6 +188,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer | |||||||
|     private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName()); |     private static final Logger s_logger = Logger.getLogger(ApiServer.class.getName()); | ||||||
|     private static final Logger s_accessLogger = Logger.getLogger("apiserver." + ApiServer.class.getName()); |     private static final Logger s_accessLogger = Logger.getLogger("apiserver." + ApiServer.class.getName()); | ||||||
| 
 | 
 | ||||||
|  |     private static final String SANITIZATION_REGEX = "[\n\r]"; | ||||||
|  | 
 | ||||||
|     private static boolean encodeApiResponse = false; |     private static boolean encodeApiResponse = false; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -919,7 +921,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer | |||||||
|             if ("3".equals(signatureVersion)) { |             if ("3".equals(signatureVersion)) { | ||||||
|                 // New signature authentication. Check for expire parameter and its validity |                 // New signature authentication. Check for expire parameter and its validity | ||||||
|                 if (expires == null) { |                 if (expires == null) { | ||||||
|                     s_logger.debug("Missing Expires parameter -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey); |                     s_logger.debug("Missing Expires parameter -- ignoring request."); | ||||||
|                     return false; |                     return false; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
| @ -932,7 +934,9 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer | |||||||
| 
 | 
 | ||||||
|                 final Date now = new Date(System.currentTimeMillis()); |                 final Date now = new Date(System.currentTimeMillis()); | ||||||
|                 if (expiresTS.before(now)) { |                 if (expiresTS.before(now)) { | ||||||
|                     s_logger.debug("Request expired -- ignoring ...sig: " + signature + ", apiKey: " + apiKey); |                     signature = signature.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                     apiKey = apiKey.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                     s_logger.debug(String.format("Request expired -- ignoring ...sig [%s], apiKey [%s].", signature, apiKey)); | ||||||
|                     return false; |                     return false; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @ -979,7 +983,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer | |||||||
|             final boolean equalSig = ConstantTimeComparator.compareStrings(signature, computedSignature); |             final boolean equalSig = ConstantTimeComparator.compareStrings(signature, computedSignature); | ||||||
| 
 | 
 | ||||||
|             if (!equalSig) { |             if (!equalSig) { | ||||||
|                 s_logger.info("User signature: " + signature + " is not equaled to computed signature: " + computedSignature); |                 signature = signature.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                 s_logger.info(String.format("User signature [%s] is not equaled to computed signature [%s].", signature, computedSignature)); | ||||||
|             } else { |             } else { | ||||||
|                 CallContext.register(user, account); |                 CallContext.register(user, account); | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -720,10 +720,10 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase | |||||||
|                     DestroyLoadBalancerApplianceAnswer answer = null; |                     DestroyLoadBalancerApplianceAnswer answer = null; | ||||||
|                     try { |                     try { | ||||||
|                         answer = (DestroyLoadBalancerApplianceAnswer)_agentMgr.easySend(lbDevice.getParentHostId(), lbDeleteCmd); |                         answer = (DestroyLoadBalancerApplianceAnswer)_agentMgr.easySend(lbDevice.getParentHostId(), lbDeleteCmd); | ||||||
|                         if (answer == null || !answer.getResult()) { |                         if (answer == null) { | ||||||
|                             s_logger.warn("Failed to destoy load balancer appliance used by the network" |                             s_logger.warn(String.format("Failed to destroy load balancer appliance used by the network [%s] due to a communication error with agent.", guestConfig.getId())); | ||||||
|                                     + guestConfig.getId() + " due to " + answer == null ? "communication error with agent" |                         } else if (!answer.getResult()) { | ||||||
|                                     : answer.getDetails()); |                             s_logger.warn(String.format("Failed to destroy load balancer appliance used by the network [%s] due to [%s].", guestConfig.getId(),  answer.getDetails())); | ||||||
|                         } |                         } | ||||||
|                     } catch (Exception e) { |                     } catch (Exception e) { | ||||||
|                         s_logger.warn("Failed to destroy load balancer appliance used by the network" + guestConfig.getId() + " due to " + e.getMessage()); |                         s_logger.warn("Failed to destroy load balancer appliance used by the network" + guestConfig.getId() + " due to " + e.getMessage()); | ||||||
|  | |||||||
| @ -71,6 +71,8 @@ public class ConsoleProxyServlet extends HttpServlet { | |||||||
|     private static final int DEFAULT_THUMBNAIL_WIDTH = 144; |     private static final int DEFAULT_THUMBNAIL_WIDTH = 144; | ||||||
|     private static final int DEFAULT_THUMBNAIL_HEIGHT = 110; |     private static final int DEFAULT_THUMBNAIL_HEIGHT = 110; | ||||||
| 
 | 
 | ||||||
|  |     private static final String SANITIZATION_REGEX = "[\n\r]"; | ||||||
|  | 
 | ||||||
|     @Inject |     @Inject | ||||||
|     AccountManager _accountMgr; |     AccountManager _accountMgr; | ||||||
|     @Inject |     @Inject | ||||||
| @ -154,7 +156,13 @@ public class ConsoleProxyServlet extends HttpServlet { | |||||||
| 
 | 
 | ||||||
|             String cmd = req.getParameter("cmd"); |             String cmd = req.getParameter("cmd"); | ||||||
|             if (cmd == null || !isValidCmd(cmd)) { |             if (cmd == null || !isValidCmd(cmd)) { | ||||||
|                 s_logger.debug("invalid console servlet command: " + cmd); |                 if (cmd != null) { | ||||||
|  |                     cmd = cmd.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                     s_logger.debug(String.format("invalid console servlet command [%s].", cmd)); | ||||||
|  |                 } else { | ||||||
|  |                     s_logger.debug("Null console servlet command."); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 sendResponse(resp, ""); |                 sendResponse(resp, ""); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
| @ -162,7 +170,13 @@ public class ConsoleProxyServlet extends HttpServlet { | |||||||
|             String vmIdString = req.getParameter("vm"); |             String vmIdString = req.getParameter("vm"); | ||||||
|             VirtualMachine vm = _entityMgr.findByUuid(VirtualMachine.class, vmIdString); |             VirtualMachine vm = _entityMgr.findByUuid(VirtualMachine.class, vmIdString); | ||||||
|             if (vm == null) { |             if (vm == null) { | ||||||
|                 s_logger.info("invalid console servlet command parameter: " + vmIdString); |                 if (vmIdString != null) { | ||||||
|  |                     vmIdString = vmIdString.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                     s_logger.info(String.format("invalid console servlet command vm parameter[%s].", vmIdString)); | ||||||
|  |                 } else { | ||||||
|  |                     s_logger.info("Null console servlet command VM parameter."); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 sendResponse(resp, ""); |                 sendResponse(resp, ""); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
| @ -262,7 +276,13 @@ public class ConsoleProxyServlet extends HttpServlet { | |||||||
| 
 | 
 | ||||||
|         String sid = req.getParameter("sid"); |         String sid = req.getParameter("sid"); | ||||||
|         if (sid == null || !sid.equals(vm.getVncPassword())) { |         if (sid == null || !sid.equals(vm.getVncPassword())) { | ||||||
|             s_logger.warn("sid " + sid + " in url does not match stored sid."); |             if(sid != null) { | ||||||
|  |                 sid = sid.replaceAll(SANITIZATION_REGEX, "_"); | ||||||
|  |                 s_logger.warn(String.format("sid [%s] in url does not match stored sid.", sid)); | ||||||
|  |             } else { | ||||||
|  |                 s_logger.warn("Null sid in URL."); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             sendResponse(resp, "failed"); |             sendResponse(resp, "failed"); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -7201,7 +7201,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir | |||||||
| 
 | 
 | ||||||
|             _securityGroupMgr.addInstanceToGroups(vm.getId(), securityGroupIdList); |             _securityGroupMgr.addInstanceToGroups(vm.getId(), securityGroupIdList); | ||||||
| 
 | 
 | ||||||
|             s_logger.debug("AssignVM: Basic zone, adding security groups no " + securityGroupIdList.size() + " to " + vm.getInstanceName()); |             int securityIdList = securityGroupIdList != null ? securityGroupIdList.size() : 0; | ||||||
|  |             s_logger.debug("AssignVM: Basic zone, adding security groups no " + securityIdList + " to " + vm.getInstanceName()); | ||||||
|         } else { |         } else { | ||||||
|             Set<NetworkVO> applicableNetworks = new LinkedHashSet<>(); |             Set<NetworkVO> applicableNetworks = new LinkedHashSet<>(); | ||||||
|             Map<Long, String> requestedIPv4ForNics = new HashMap<>(); |             Map<Long, String> requestedIPv4ForNics = new HashMap<>(); | ||||||
|  | |||||||
| @ -255,7 +255,8 @@ public class OutOfBandManagementServiceImpl extends ManagerBase implements OutOf | |||||||
| 
 | 
 | ||||||
|         Host host = hostDao.findById(hostId); |         Host host = hostDao.findById(hostId); | ||||||
|         if (host == null || host.getResourceState() == ResourceState.Degraded) { |         if (host == null || host.getResourceState() == ResourceState.Degraded) { | ||||||
|             LOG.debug(String.format("Host [id=%s, state=] was removed or placed in Degraded state by the Admin.", hostId, host.getResourceState())); |             String state = host != null ? String.valueOf(host.getResourceState()) : null; | ||||||
|  |             LOG.debug(String.format("Host [id=%s, state=%s] was removed or placed in Degraded state by the Admin.", hostId, state)); | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -865,7 +865,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S | |||||||
| 
 | 
 | ||||||
|             String templateUuid = UUID.randomUUID().toString(); |             String templateUuid = UUID.randomUUID().toString(); | ||||||
|             String templateName = templateUuid + ".vhd"; |             String templateName = templateUuid + ".vhd"; | ||||||
|             Script command = new Script(createTemplateFromSnapshotXenScript, cmd.getWait() * 1000, s_logger); |             Script command = new Script(createTemplateFromSnapshotXenScript, cmd.getWait() * 1000L, s_logger); | ||||||
|             command.add("-p", snapshotPath); |             command.add("-p", snapshotPath); | ||||||
|             command.add("-s", snapshotName); |             command.add("-s", snapshotName); | ||||||
|             command.add("-n", templateName); |             command.add("-n", templateName); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user