Skip to content

Commit

Permalink
Fixing storage.filesystem syncrhonization (#413)
Browse files Browse the repository at this point in the history
The Storage.Filesystem synchronization is failing for AIO-DX because
the 'ceph' host filesystem is created during the first unlock of the
controllers. The host profile must not have the 'ceph' filesystem, but
the current config will have it after the unlock, because the sysinv
will create that automatically to support the 3 Ceph monitors.

This fix will ignore the 'ceph' filesystem synchronization when this
is an AIO-DX deployment.

Test-Plan
  PASS: Deploy an AIO-DX and check both controllers are InSync and
        Reconciled
  PASS: Deploy a Standard and check all the hosts are InSync and
        Reconciled

Signed-off-by: Felipe Sanches Zanoni <[email protected]>
  • Loading branch information
fsanches-wr authored Nov 8, 2024
1 parent 8759552 commit 024e3ef
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions controllers/host/host_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,13 @@ func (r *HostReconciler) CompareOSDs(in *starlingxv1.HostProfileSpec, other *sta
// CompareAttributes determines if two profiles are identical for the
// purpose of reconciling a current host configuration to its desired host
// profile.
func (r *HostReconciler) CompareAttributes(in *starlingxv1.HostProfileSpec, other *starlingxv1.HostProfileSpec, instance *starlingxv1.Host, personality string) bool {
func (r *HostReconciler) CompareAttributes(in *starlingxv1.HostProfileSpec, other *starlingxv1.HostProfileSpec, instance *starlingxv1.Host, personality string, system_info *cloudManager.SystemInfo) bool {
// This could be replaced with in.DeepEqual(other) but it is coded this way
// (and tested this way) to ensure that if both the "enabled" and "disabled"
// comparisons are true then no reconciliation is missed. The intent is
// that CompareEnabledAttributes && CompareDisabledAttributes will always
// be equivalent to DeepEqual.
return r.CompareEnabledAttributes(in, other, instance, personality) &&
return r.CompareEnabledAttributes(in, other, instance, personality, system_info) &&
r.CompareDisabledAttributes(in, other, instance.Namespace, personality, false)
}

Expand All @@ -953,7 +953,7 @@ func (r *HostReconciler) CompareAttributes(in *starlingxv1.HostProfileSpec, othe
// is enabled. The only attributes that we can reconcile while enabled are the
// storage OSD resources therefore return false if there are any differences
// in the storage OSD list.
func (r *HostReconciler) CompareEnabledAttributes(in *starlingxv1.HostProfileSpec, other *starlingxv1.HostProfileSpec, instance *starlingxv1.Host, personality string) bool {
func (r *HostReconciler) CompareEnabledAttributes(in *starlingxv1.HostProfileSpec, other *starlingxv1.HostProfileSpec, instance *starlingxv1.Host, personality string, system_info *cloudManager.SystemInfo) bool {
if other == nil {
return false
}
Expand All @@ -979,12 +979,41 @@ func (r *HostReconciler) CompareEnabledAttributes(in *starlingxv1.HostProfileSpe

if utils.IsReconcilerEnabled(utils.FileSystemSizes) {
if in.Storage != nil && in.Storage.FileSystems != nil {
if other.Storage == nil {
if other.Storage == nil || other.Storage.FileSystems == nil {
return false
}

if !in.Storage.FileSystems.DeepEqual(other.Storage.FileSystems) {
return false
// Special case: 'ceph' filesystem must be ignored for All-in-one Duplex.
if system_info.SystemType == cloudManager.SystemTypeAllInOne && system_info.SystemMode != cloudManager.SystemModeSimplex {
for _, fsInfo := range *other.Storage.FileSystems {
// Skip ceph filesystem
if fsInfo.Name == "ceph" {
continue
}

// Compare 'in' and 'other' fileystems
found := false
for _, fs := range *in.Storage.FileSystems {
if fs.Name != fsInfo.Name {
continue
}

found = true
if fsInfo.Size != fs.Size {
return false
}
}

// If not found, return false
if !found {
return false
}
}
} else {
// Do a deep compare when this is not an All-in-one Duplex
if !in.Storage.FileSystems.DeepEqual(other.Storage.FileSystems) {
return false
}
}
}
}
Expand Down Expand Up @@ -1096,6 +1125,7 @@ func (r *HostReconciler) ReconcileHostByState(
current *starlingxv1.HostProfileSpec,
profile *starlingxv1.HostProfileSpec,
host *v1info.HostInfo,
system_info *cloudManager.SystemInfo,
) error {

principal := false
Expand All @@ -1113,7 +1143,7 @@ func (r *HostReconciler) ReconcileHostByState(
}

if host.IsUnlockedEnabled() {
if !r.CompareEnabledAttributes(profile, current, instance, host.Personality) {
if !r.CompareEnabledAttributes(profile, current, instance, host.Personality, system_info) {
err := r.ReconcileEnabledHost(client, instance, profile, host)
if err != nil {
return err
Expand Down Expand Up @@ -1728,7 +1758,12 @@ func (r *HostReconciler) ReconcileExistingHost(client *gophercloud.ServiceClient
}
}

inSync := r.CompareAttributes(profile, current, instance, host.Personality)
system_info, err := r.CloudManager.GetSystemInfo(reqNs, client)
if err != nil {
msg := "failed to get system info"
return common.NewUserDataError(msg)
}
inSync := r.CompareAttributes(profile, current, instance, host.Personality, system_info)

// Continue the following steps even inSync:
// strategy not finished
Expand Down Expand Up @@ -1780,7 +1815,7 @@ func (r *HostReconciler) ReconcileExistingHost(client *gophercloud.ServiceClient
}
}

err = r.ReconcileHostByState(client, instance, current, profile, &hostInfo)
err = r.ReconcileHostByState(client, instance, current, profile, &hostInfo, system_info)
if err != nil {
return err
}
Expand Down

0 comments on commit 024e3ef

Please sign in to comment.