From 159c72fa970e8ea42094c30dedfb0fd9eb7b207d Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com> Date: Thu, 26 Aug 2021 08:18:17 -0300 Subject: [PATCH] Externalize KVM Agent's option to change migration thread timeout (#4570) * Externalize KVM Agent's option to change migration thread timeout * Update javadoc Co-authored-by: GutoVeronezi --- agent/conf/agent.properties | 3 +++ .../java/com/cloud/agent/properties/AgentProperties.java | 9 ++++++++- .../resource/wrapper/LibvirtMigrateCommandWrapper.java | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index 784abf799d1..f4ffd4b1d7f 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -271,6 +271,9 @@ iscsi.session.cleanup.enabled=false # Depending on the use case, this timeout might need increasing/decreasing. # heartbeat.update.timeout=60000 +# This parameter specifies the timeout in seconds to retrieve the target's domain id when migrating a VM with KVM. +# vm.migrate.domain.retrieve.timeout=10 + # This parameter specifies if the host must be rebooted when something goes wrong with the heartbeat. # reboot.host.and.alert.management.on.heartbeat.timeout=true diff --git a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java index 9e5f167cc4e..657876c13ac 100644 --- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java +++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java @@ -29,9 +29,16 @@ public class AgentProperties{ * Heartbeat update timeout.
* Data type: int.
* Default value: 60000 (ms). - */ + */ public static final Property HEARTBEAT_UPDATE_TIMEOUT = new Property("heartbeat.update.timeout", 60000); + /** + * The timeout in seconds to retrieve the target's domain id when migrating a VM with KVM.
+ * Data type: int.
+ * Default value: 10 (sec). + */ + public static final Property VM_MIGRATE_DOMAIN_RETRIEVE_TIMEOUT = new Property("vm.migrate.domain.retrieve.timeout", 10); + /** * Reboot host and alert management on heartbeat timeout.
* Data type: boolean.
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java index 1d5bf1dea28..a72d58430fb 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java @@ -66,6 +66,8 @@ import com.cloud.agent.api.MigrateAnswer; import com.cloud.agent.api.MigrateCommand; import com.cloud.agent.api.MigrateCommand.MigrateDiskInfo; import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.agent.properties.AgentProperties; +import com.cloud.agent.properties.AgentPropertiesFileHandler; import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource; import com.cloud.hypervisor.kvm.resource.LibvirtConnection; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef; @@ -239,7 +241,7 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper