mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	kvm: Handle the failures when setting up memory balloon stats period for KVM VMs (#8049)
This commit is contained in:
		
							parent
							
								
									3b11663d87
								
							
						
					
					
						commit
						1e133d05c7
					
				| @ -1313,8 +1313,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv | |||||||
|                 } |                 } | ||||||
|                 s_logger.debug(String.format("The memory balloon stats period [%s] has been set successfully for the VM (Libvirt Domain) with ID [%s] and name [%s].", |                 s_logger.debug(String.format("The memory balloon stats period [%s] has been set successfully for the VM (Libvirt Domain) with ID [%s] and name [%s].", | ||||||
|                         currentVmBalloonStatsPeriod, vmId, dm.getName())); |                         currentVmBalloonStatsPeriod, vmId, dm.getName())); | ||||||
|             } catch (final LibvirtException e) { |             } catch (final Exception e) { | ||||||
|                 s_logger.warn("Failed to set up memory balloon stats period." + e.getMessage()); |                 s_logger.warn(String.format("Failed to set up memory balloon stats period for the VM %s with exception %s", parser.getName(), e.getMessage())); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -59,6 +59,8 @@ public class LibvirtDomainXMLParser { | |||||||
|     private Integer vncPort; |     private Integer vncPort; | ||||||
|     private String desc; |     private String desc; | ||||||
| 
 | 
 | ||||||
|  |     private String name; | ||||||
|  | 
 | ||||||
|     public boolean parseDomainXML(String domXML) { |     public boolean parseDomainXML(String domXML) { | ||||||
|         DocumentBuilder builder; |         DocumentBuilder builder; | ||||||
|         try { |         try { | ||||||
| @ -71,6 +73,7 @@ public class LibvirtDomainXMLParser { | |||||||
|             Element rootElement = doc.getDocumentElement(); |             Element rootElement = doc.getDocumentElement(); | ||||||
| 
 | 
 | ||||||
|             desc = getTagValue("description", rootElement); |             desc = getTagValue("description", rootElement); | ||||||
|  |             name = getTagValue("name", rootElement); | ||||||
| 
 | 
 | ||||||
|             Element devices = (Element)rootElement.getElementsByTagName("devices").item(0); |             Element devices = (Element)rootElement.getElementsByTagName("devices").item(0); | ||||||
|             NodeList disks = devices.getElementsByTagName("disk"); |             NodeList disks = devices.getElementsByTagName("disk"); | ||||||
| @ -303,15 +306,19 @@ public class LibvirtDomainXMLParser { | |||||||
|                 String path = getTagValue("backend", rng); |                 String path = getTagValue("backend", rng); | ||||||
|                 String bytes = getAttrValue("rate", "bytes", rng); |                 String bytes = getAttrValue("rate", "bytes", rng); | ||||||
|                 String period = getAttrValue("rate", "period", rng); |                 String period = getAttrValue("rate", "period", rng); | ||||||
| 
 |                 if (StringUtils.isAnyEmpty(bytes, period)) { | ||||||
|                 if (StringUtils.isEmpty(backendModel)) { |                     s_logger.debug(String.format("Bytes and period in the rng section should not be null, please check the VM %s", name)); | ||||||
|                     def = new RngDef(path, Integer.parseInt(bytes), Integer.parseInt(period)); |  | ||||||
|                 } else { |                 } else { | ||||||
|                     def = new RngDef(path, RngBackendModel.valueOf(backendModel.toUpperCase()), |                     if (StringUtils.isEmpty(backendModel)) { | ||||||
|                                      Integer.parseInt(bytes), Integer.parseInt(period)); |                         def = new RngDef(path, Integer.parseInt(bytes), Integer.parseInt(period)); | ||||||
|  |                     } else { | ||||||
|  |                         def = new RngDef(path, RngBackendModel.valueOf(backendModel.toUpperCase()), | ||||||
|  |                                 Integer.parseInt(bytes), Integer.parseInt(period)); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 if (def != null) { | ||||||
|  |                     rngDefs.add(def); | ||||||
|                 } |                 } | ||||||
| 
 |  | ||||||
|                 rngDefs.add(def); |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             NodeList watchDogs = devices.getElementsByTagName("watchdog"); |             NodeList watchDogs = devices.getElementsByTagName("watchdog"); | ||||||
| @ -418,4 +425,8 @@ public class LibvirtDomainXMLParser { | |||||||
|     public String getDescription() { |     public String getDescription() { | ||||||
|         return desc; |         return desc; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public String getName() { | ||||||
|  |         return name; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user