mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
[KVM] Add watchdog model none to disable use of watchdogs on KVM agent (#10203)
This commit is contained in:
parent
96b757c35b
commit
7e295ec4e1
@ -286,6 +286,7 @@ hypervisor.type=kvm
|
||||
|
||||
# The model of Watchdog timer to present to the Guest.
|
||||
# For all models refer to the libvirt documentation.
|
||||
# PLEASE NOTE: to disable the watchdogs definitions, use value: none
|
||||
#vm.watchdog.model=i6300esb
|
||||
|
||||
# Action to take when the Guest/Instance is no longer notifying the Watchdog timer.
|
||||
|
||||
@ -516,6 +516,7 @@ public class AgentProperties{
|
||||
/**
|
||||
* The model of Watchdog timer to present to the Guest.<br>
|
||||
* For all models refer to the libvirt documentation.<br>
|
||||
* PLEASE NOTE: to disable the watchdogs definitions, use value: none
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>i6300esb</code>
|
||||
*/
|
||||
|
||||
@ -2293,7 +2293,7 @@ public class LibvirtVMDef {
|
||||
|
||||
public static class WatchDogDef {
|
||||
enum WatchDogModel {
|
||||
I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288"), ITCO("itco");
|
||||
I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288"), ITCO("itco"), NONE("none");
|
||||
String model;
|
||||
|
||||
WatchDogModel(String model) {
|
||||
@ -2346,6 +2346,10 @@ public class LibvirtVMDef {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (WatchDogModel.NONE == model) {
|
||||
// Do not add watchodogs when the model is set to none
|
||||
return "";
|
||||
}
|
||||
StringBuilder wacthDogBuilder = new StringBuilder();
|
||||
wacthDogBuilder.append("<watchdog model='" + model + "' action='" + action + "'/>\n");
|
||||
return wacthDogBuilder.toString();
|
||||
|
||||
@ -31,6 +31,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.MemBalloonDef;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SCSIDef;
|
||||
import org.apache.cloudstack.utils.qemu.QemuObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
@ -537,6 +538,16 @@ public class LibvirtVMDefTest extends TestCase {
|
||||
assertEquals(action, def.getAction());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWatchDofDefNone() {
|
||||
LibvirtVMDef.WatchDogDef.WatchDogModel model = LibvirtVMDef.WatchDogDef.WatchDogModel.NONE;
|
||||
LibvirtVMDef.WatchDogDef.WatchDogAction action = LibvirtVMDef.WatchDogDef.WatchDogAction.RESET;
|
||||
LibvirtVMDef.WatchDogDef def = new LibvirtVMDef.WatchDogDef(action, model);
|
||||
String result = def.toString();
|
||||
assertNotNull(result);
|
||||
assertTrue(StringUtils.isBlank(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSCSIDef() {
|
||||
SCSIDef def = new SCSIDef((short)0, 0, 0, 9, 0, 4);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user