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].",
|
||||
currentVmBalloonStatsPeriod, vmId, dm.getName()));
|
||||
} catch (final LibvirtException e) {
|
||||
s_logger.warn("Failed to set up memory balloon stats period." + e.getMessage());
|
||||
} catch (final Exception e) {
|
||||
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 String desc;
|
||||
|
||||
private String name;
|
||||
|
||||
public boolean parseDomainXML(String domXML) {
|
||||
DocumentBuilder builder;
|
||||
try {
|
||||
@ -71,6 +73,7 @@ public class LibvirtDomainXMLParser {
|
||||
Element rootElement = doc.getDocumentElement();
|
||||
|
||||
desc = getTagValue("description", rootElement);
|
||||
name = getTagValue("name", rootElement);
|
||||
|
||||
Element devices = (Element)rootElement.getElementsByTagName("devices").item(0);
|
||||
NodeList disks = devices.getElementsByTagName("disk");
|
||||
@ -303,16 +306,20 @@ public class LibvirtDomainXMLParser {
|
||||
String path = getTagValue("backend", rng);
|
||||
String bytes = getAttrValue("rate", "bytes", rng);
|
||||
String period = getAttrValue("rate", "period", rng);
|
||||
|
||||
if (StringUtils.isAnyEmpty(bytes, period)) {
|
||||
s_logger.debug(String.format("Bytes and period in the rng section should not be null, please check the VM %s", name));
|
||||
} else {
|
||||
if (StringUtils.isEmpty(backendModel)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
NodeList watchDogs = devices.getElementsByTagName("watchdog");
|
||||
for (int i = 0; i < watchDogs.getLength(); i++) {
|
||||
@ -418,4 +425,8 @@ public class LibvirtDomainXMLParser {
|
||||
public String getDescription() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user