You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2021/08/26 11:18:37 UTC

[cloudstack] branch main updated: Externalize KVM Agent's option to change migration thread timeout (#4570)

This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 159c72f  Externalize KVM Agent's option to change migration thread timeout (#4570)
159c72f is described below

commit 159c72fa970e8ea42094c30dedfb0fd9eb7b207d
Author: Daniel Augusto Veronezi Salvador <38...@users.noreply.github.com>
AuthorDate: Thu Aug 26 08:18:17 2021 -0300

    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 <da...@scclouds.com.br>
---
 agent/conf/agent.properties                                      | 3 +++
 .../main/java/com/cloud/agent/properties/AgentProperties.java    | 9 ++++++++-
 .../kvm/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 784abf7..f4ffd4b 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 9e5f167..657876c 100644
--- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java
+++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java
@@ -29,10 +29,17 @@ public class AgentProperties{
      * Heartbeat update timeout. <br>
      * Data type: int. <br>
      * Default value: 60000 (ms).
-    */
+     */
     public static final Property<Integer> HEARTBEAT_UPDATE_TIMEOUT = new Property<Integer>("heartbeat.update.timeout", 60000);
 
     /**
+     * The timeout in seconds to retrieve the target's domain id when migrating a VM with KVM. <br>
+     * Data type: int. <br>
+     * Default value: 10 (sec).
+     */
+    public static final Property<Integer> VM_MIGRATE_DOMAIN_RETRIEVE_TIMEOUT = new Property<Integer>("vm.migrate.domain.retrieve.timeout", 10);
+
+    /**
      * Reboot host and alert management on heartbeat timeout. <br>
      * Data type: boolean.<br>
      * Default value: true.
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 1d5bf1d..a72d584 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<MigrateCo
             }
             s_logger.info("Migration thread for " + vmName + " is done");
 
-            destDomain = migrateThread.get(10, TimeUnit.SECONDS);
+            destDomain = migrateThread.get(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.VM_MIGRATE_DOMAIN_RETRIEVE_TIMEOUT), TimeUnit.SECONDS);
 
             if (destDomain != null) {
                 deleteOrDisconnectDisksOnSourcePool(libvirtComputingResource, migrateDiskInfoList, disks);