Skip to content

Commit

Permalink
Mitigate ovn alarm clock errors (#448)
Browse files Browse the repository at this point in the history
Couple changes to reduce the frequency of the MicroOVN alarm clock
errors.

* Ensure LXD is always bootstrapped last, so MicroOVN has time to
breathe.
* Ensure we try to create storage pools before networks, so MicroOVN has
even more time to breathe.
  • Loading branch information
masnax authored Oct 23, 2024
2 parents 43636f6 + 27bbf53 commit db7e8f5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func (c *initConfig) setupCluster(s *service.Handler) error {

fmt.Println("Initializing new services")
mu := sync.Mutex{}
err = s.RunConcurrent(types.MicroCloud, "", func(s service.Service) error {
err = s.RunConcurrent(types.MicroCloud, types.LXD, func(s service.Service) error {
// If there's already an initialized system for this service, we don't need to bootstrap it.
if initializedServices[s.Type()] != "" {
return nil
Expand Down Expand Up @@ -909,28 +909,21 @@ func (c *initConfig) setupCluster(s *service.Handler) error {

targetClient := lxdClient.UseTarget(name)

for _, network := range system.TargetNetworks {
err = targetClient.CreateNetwork(network)
for _, pool := range system.TargetStoragePools {
err = targetClient.CreateStoragePool(pool)
if err != nil {
return err
}
}

for _, pool := range system.TargetStoragePools {
err = targetClient.CreateStoragePool(pool)
for _, network := range system.TargetNetworks {
err = targetClient.CreateNetwork(network)
if err != nil {
return err
}
}
}

for _, network := range system.Networks {
err = lxdClient.CreateNetwork(network)
if err != nil {
return err
}
}

cephFSPool := lxdAPI.StoragePoolsPost{}
for _, pool := range system.StoragePools {
if pool.Driver == "ceph" || profile.Devices["root"] == nil {
Expand All @@ -956,6 +949,13 @@ func (c *initConfig) setupCluster(s *service.Handler) error {
}
}

for _, network := range system.Networks {
err = lxdClient.CreateNetwork(network)
if err != nil {
return err
}
}

if !shared.ValueInSlice(profile.Name, profiles) {
err = lxdClient.CreateProfile(profile)
if err != nil {
Expand Down

0 comments on commit db7e8f5

Please sign in to comment.