|
17 | 17 | package main
|
18 | 18 |
|
19 | 19 | import (
|
| 20 | + "context" |
20 | 21 | "flag"
|
21 | 22 | "fmt"
|
22 | 23 | "log"
|
23 | 24 | "math"
|
24 | 25 | "os"
|
25 | 26 | "os/signal"
|
26 | 27 | "path"
|
| 28 | + "runtime/debug" |
27 | 29 | "sync"
|
28 | 30 | "syscall"
|
29 | 31 | "time"
|
30 | 32 |
|
31 |
| - "context" |
32 |
| - |
33 | 33 | "github.com/01org/ciao/osprepare"
|
34 | 34 | "github.com/01org/ciao/payloads"
|
35 | 35 | "github.com/01org/ciao/ssntp"
|
@@ -389,50 +389,52 @@ func connectToServer(doneCh chan struct{}, statusCh chan struct{}) {
|
389 | 389 | dialCh <- err
|
390 | 390 | }()
|
391 | 391 |
|
392 |
| - dialing := true |
| 392 | + select { |
| 393 | + case err := <-dialCh: |
| 394 | + if err != nil { |
| 395 | + break |
| 396 | + } |
| 397 | + clusterConfig, err := client.conn.ClusterConfiguration() |
| 398 | + if err != nil { |
| 399 | + glog.Errorf("Unable to get Cluster Configuration %v", err) |
| 400 | + client.conn.Close() |
| 401 | + break |
| 402 | + } |
| 403 | + computeNet = clusterConfig.Configure.Launcher.ComputeNetwork |
| 404 | + mgmtNet = clusterConfig.Configure.Launcher.ManagementNetwork |
| 405 | + diskLimit = clusterConfig.Configure.Launcher.DiskLimit |
| 406 | + memLimit = clusterConfig.Configure.Launcher.MemoryLimit |
| 407 | + if secretPath == "" { |
| 408 | + secretPath = clusterConfig.Configure.Storage.SecretPath |
| 409 | + } |
| 410 | + if cephID == "" { |
| 411 | + cephID = clusterConfig.Configure.Storage.CephID |
| 412 | + } |
| 413 | + printClusterConfig() |
393 | 414 |
|
394 |
| -DONE: |
395 |
| - for { |
396 |
| - select { |
397 |
| - case err := <-dialCh: |
398 |
| - dialing = false |
399 |
| - if err != nil { |
400 |
| - break DONE |
401 |
| - } |
402 |
| - clusterConfig, err := client.conn.ClusterConfiguration() |
403 |
| - if err != nil { |
404 |
| - glog.Errorf("Unable to get Cluster Configuration %v", err) |
405 |
| - client.conn.Close() |
406 |
| - break DONE |
407 |
| - } |
408 |
| - computeNet = clusterConfig.Configure.Launcher.ComputeNetwork |
409 |
| - mgmtNet = clusterConfig.Configure.Launcher.ManagementNetwork |
410 |
| - diskLimit = clusterConfig.Configure.Launcher.DiskLimit |
411 |
| - memLimit = clusterConfig.Configure.Launcher.MemoryLimit |
412 |
| - if secretPath == "" { |
413 |
| - secretPath = clusterConfig.Configure.Storage.SecretPath |
414 |
| - } |
415 |
| - if cephID == "" { |
416 |
| - cephID = clusterConfig.Configure.Storage.CephID |
417 |
| - } |
418 |
| - printClusterConfig() |
| 415 | + client.installLauncherDeps() |
419 | 416 |
|
420 |
| - client.installLauncherDeps() |
| 417 | + err = startNetwork(doneCh) |
| 418 | + if err != nil { |
| 419 | + glog.Errorf("Failed to start network: %v\n", err) |
| 420 | + client.conn.Close() |
| 421 | + break |
| 422 | + } |
| 423 | + defer shutdownNetwork() |
421 | 424 |
|
422 |
| - err = startNetwork(doneCh) |
423 |
| - if err != nil { |
424 |
| - glog.Errorf("Failed to start network: %v\n", err) |
425 |
| - client.conn.Close() |
426 |
| - break DONE |
427 |
| - } |
428 |
| - defer shutdownNetwork() |
| 425 | + ovsCh = startOverseer(&wg, client) |
| 426 | + case <-doneCh: |
| 427 | + client.conn.Close() |
| 428 | + <-dialCh |
| 429 | + return |
| 430 | + } |
429 | 431 |
|
430 |
| - ovsCh = startOverseer(&wg, client) |
| 432 | +DONE: |
| 433 | + for { |
| 434 | + select { |
431 | 435 | case <-doneCh:
|
432 | 436 | client.conn.Close()
|
433 |
| - if !dialing { |
434 |
| - break DONE |
435 |
| - } |
| 437 | + break DONE |
436 | 438 | case cmd := <-client.cmdCh:
|
437 | 439 | /*
|
438 | 440 | Double check we're not quitting here. Otherwise a flood of commands
|
@@ -563,7 +565,7 @@ DONE:
|
563 | 565 | glog.Flush()
|
564 | 566 |
|
565 | 567 | /* We panic here to see which naughty go routines are still running. */
|
566 |
| - |
| 568 | + debug.SetTraceback("all") |
567 | 569 | panic("Server Loop did not exit within 1 second quitting")
|
568 | 570 | }
|
569 | 571 | }
|
|
0 commit comments