Merge branch '4.9'

This commit is contained in:
Rohit Yadav 2016-11-23 14:28:31 +05:30
commit 35803805c7
No known key found for this signature in database
GPG Key ID: 484248210EE3D884

View File

@ -861,18 +861,19 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
s_logger.info("findRouterEthDeviceIndex. mac: " + mac);
// TODO : this is a temporary very inefficient solution, will refactor it later
Pair<Boolean, String> result = SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "ls /proc/sys/net/ipv4/conf");
ArrayList<String> skipInterfaces = new ArrayList<String>(Arrays.asList("all", "default", "lo"));
// when we dynamically plug in a new NIC into virtual router, it may take time to show up in guest OS
// we use a waiting loop here as a workaround to synchronize activities in systems
long startTick = System.currentTimeMillis();
while (System.currentTimeMillis() - startTick < 15000) {
// TODO : this is a temporary very inefficient solution, will refactor it later
Pair<Boolean, String> result = SshHelper.sshExecute(routerIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "ls /proc/sys/net/ipv4/conf");
if (result.first()) {
String[] tokens = result.second().split("\\s+");
for (String token : tokens) {
if (!("all".equalsIgnoreCase(token) || "default".equalsIgnoreCase(token) || "lo".equalsIgnoreCase(token))) {
if (!(skipInterfaces.contains(token))) {
String cmd = String.format("ip address show %s | grep link/ether | sed -e 's/^[ \t]*//' | cut -d' ' -f2", token);
if (s_logger.isDebugEnabled())
@ -883,8 +884,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
if (s_logger.isDebugEnabled())
s_logger.debug("result: " + result2.first() + ", output: " + result2.second());
if (result2.first() && result2.second().trim().equalsIgnoreCase(mac.trim()))
if (result2.first() && result2.second().trim().equalsIgnoreCase(mac.trim())) {
return Integer.parseInt(token.substring(3));
} else {
skipInterfaces.add(token);
}
}
}
}