ソースを参照

use timeout instead of die for ip address assignment timeout

tags/v0.12.9
Jonathan Cobb 4年前
コミット
18f3748d0e
2個のファイルの変更9行の追加3行の削除
  1. +3
    -2
      bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java
  2. +6
    -1
      bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java

+ 3
- 2
bubble-server/src/main/java/bubble/model/cloud/BubbleNode.java ファイルの表示

@@ -31,6 +31,7 @@ import javax.persistence.*;
import java.io.File;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import static bubble.ApiConstants.EP_NODES;
import static bubble.model.cloud.BubbleNodeState.*;
@@ -246,11 +247,11 @@ public class BubbleNode extends IdentifiableBase implements HasNetwork, HasBubbl
return new BubbleNodeQuickClient(this, configuration);
}

public void waitForIpAddresses() {
public void waitForIpAddresses() throws TimeoutException {
final long start = now();
while ((!hasIp4() || !hasIp6()) && now() - start < IP_ADDR_TIMEOUT) {
sleep(TimeUnit.SECONDS.toMillis(2), "waiting for node to have IP addresses");
}
if (!hasIp4() || !hasIp6()) die("waitForIpAddresses: timeout");
if (!hasIp4() || !hasIp6()) throw new TimeoutException("waitForIpAddresses: timeout");
}
}

+ 6
- 1
bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java ファイルの表示

@@ -65,6 +65,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import static bubble.ApiConstants.*;
@@ -252,7 +253,11 @@ public class StandardNetworkService implements NetworkService {

// Prepare ansible roles
// We must wait until after server is started, because some roles require ip4 in vars
node.waitForIpAddresses();
try {
node.waitForIpAddresses();
} catch (TimeoutException e) {
launchFailureCanRetry(node, e, "waitForIpAddresses error");
}
progressMeter.write(METER_TICK_PREPARING_ROLES);
final Map<String, Object> ctx = ansiblePrep.prepAnsible(
automation, bubbleFilesDir, account, network, node, computeDriver,


読み込み中…
キャンセル
保存