Skip to content

Commit 09802e0

Browse files
committed
Merge pull request #1861 from sateesh-chodapuneedi/pr-cloudstack-9698
CLOUDSTACK-9698 [VMware] Make hardcorded wait timeout for NIC adapter hotplug as configurableJira === CLOUDSTACK-9698 [VMware] Make hardcoded wait timeout for NIC adapter hotplug as configurable Description ========= Currently ACS waits for 15 seconds (hard coded) for hot-plugged NIC in VR running on VMware to get detected by guest OS. The time taken to detect hot plugged NIC in guest OS depends on type of VMware NIC adapter like (E1000, VMXNET3, E1000e etc.) and guest OS itself. In uncommon scenarios the NIC detection may take longer time than 15 seconds, in such cases NIC hotplug would be treated as failure which results in VPC tier configuration failure. Alternatively making the wait timeout for NIC adapter hotplug as configurable will be helpful for admins in such scenarios. This is specific to VR running over VMware hypervisor. Also in future if VMware introduces new NIC adapter types which may take time to get detected by guest OS, it is good to have flexibility of configuring the wait timeout as fallback mechanism in such scenarios. Fix === Introduce new configuration parameter (via ConfigKey) "vmware.nic.hotplug.wait.timeout" which is "Wait timeout (milli seconds) for hot plugged NIC of VM to be detected by guest OS." as fallback instead of hard coded timeout, to ensure flexibility for admins given the listed scenarios above. Signed-off-by: Sateesh Chodapuneedi <sateesh.chodapuneedi@accelerite.com> * pr/1861: CLOUDSTACK-9698 Make the wait timeout for NIC adapter hotplug as configurable Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
2 parents 56e851c + d171bb7 commit 09802e0

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
import com.vmware.vim25.ManagedObjectReference;
2424

25+
import org.apache.cloudstack.framework.config.ConfigKey;
26+
2527
import com.cloud.hypervisor.Hypervisor.HypervisorType;
2628
import com.cloud.hypervisor.vmware.mo.HostMO;
2729
import com.cloud.hypervisor.vmware.util.VmwareContext;
@@ -30,6 +32,9 @@
3032
public interface VmwareManager {
3133
public final String CONTEXT_STOCK_NAME = "vmwareMgr";
3234

35+
public static final ConfigKey<Long> s_vmwareNicHotplugWaitTimeout = new ConfigKey<Long>("Advanced", Long.class, "vmware.nic.hotplug.wait.timeout", "15000",
36+
"Wait timeout (milli seconds) for hot plugged NIC of VM to be detected by guest OS.", false, ConfigKey.Scope.Global);
37+
3338
String composeWorkerName();
3439

3540
String getSystemVMIsoFileNameOnDatastore();

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
4646
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
4747
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
48+
import org.apache.cloudstack.framework.config.ConfigKey;
49+
import org.apache.cloudstack.framework.config.Configurable;
4850
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
4951
import org.apache.cloudstack.utils.identity.ManagementServerNode;
5052

@@ -123,12 +125,11 @@
123125
import com.cloud.utils.ssh.SshHelper;
124126
import com.cloud.vm.DomainRouterVO;
125127

126-
public class VmwareManagerImpl extends ManagerBase implements VmwareManager, VmwareStorageMount, Listener, VmwareDatacenterService {
128+
public class VmwareManagerImpl extends ManagerBase implements VmwareManager, VmwareStorageMount, Listener, VmwareDatacenterService, Configurable {
127129
private static final Logger s_logger = Logger.getLogger(VmwareManagerImpl.class);
128130

129131
private static final int STARTUP_DELAY = 60000; // 60 seconds
130132
private static final long DEFAULT_HOST_SCAN_INTERVAL = 600000; // every 10 minutes
131-
132133
private long _hostScanInterval = DEFAULT_HOST_SCAN_INTERVAL;
133134
private int _timeout;
134135

@@ -189,7 +190,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
189190

190191
private String _rootDiskController = DiskControllerType.ide.toString();
191192

192-
private String _dataDiskController = DiskControllerType.osdefault.toString();
193+
private final String _dataDiskController = DiskControllerType.osdefault.toString();
193194

194195
private final Map<String, String> _storageMounts = new HashMap<String, String>();
195196

@@ -204,6 +205,16 @@ public VmwareManagerImpl() {
204205
_storageMgr = new VmwareStorageManagerImpl(this);
205206
}
206207

208+
@Override
209+
public String getConfigComponentName() {
210+
return VmwareManagerImpl.class.getSimpleName();
211+
}
212+
213+
@Override
214+
public ConfigKey<?>[] getConfigKeys() {
215+
return new ConfigKey<?>[] {s_vmwareNicHotplugWaitTimeout};
216+
}
217+
207218
@Override
208219
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
209220
s_logger.info("Configure VmwareManagerImpl, manager name: " + name);

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ private int findRouterEthDeviceIndex(String domrName, String routerIp, String ma
867867
// when we dynamically plug in a new NIC into virtual router, it may take time to show up in guest OS
868868
// we use a waiting loop here as a workaround to synchronize activities in systems
869869
long startTick = System.currentTimeMillis();
870-
while (System.currentTimeMillis() - startTick < 15000) {
870+
long waitTimeoutMillis = VmwareManager.s_vmwareNicHotplugWaitTimeout.value();
871+
while (System.currentTimeMillis() - startTick < waitTimeoutMillis) {
871872

872873
// TODO : this is a temporary very inefficient solution, will refactor it later
873874
Pair<Boolean, String> result = SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "ls /proc/sys/net/ipv4/conf");

0 commit comments

Comments
 (0)