Skip to content

daemon: Log reason when isDesiredMachineState() is false - #235

Closed
cgwalters wants to merge 1 commit into
openshift:masterfrom
cgwalters:daemon-log-osimageurl-target
Closed

cgwalters wants to merge 1 commit into
openshift:masterfrom
cgwalters:daemon-log-osimageurl-target

Conversation

@cgwalters

@cgwalters cgwalters commented Dec 14, 2018 •

Copy link
Copy Markdown
Member

While we do rather quickly drop down into actually trying
to perform an update, which will also e.g. log reconcilable
messages, let's be very clear about exactly which part
didn't match.

A machineconfig change could include one or both of (config, osImageURL)
and we want to know when each is different.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cgwalters
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: ashcrow

If they are not already assigned, you can assign the PR to them by writing /assign @ashcrow in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 14, 2018
@kikisdeliveryservice

kikisdeliveryservice commented Dec 14, 2018 •

Copy link
Copy Markdown
Contributor

I dont know that we need this since MCD already logs the targetted OS image here:

glog.Infof("Updating OS to %s", newConfig.Spec.OSImageURL)

If you want to add logging perhaps something else more specific related to the == being done there would be better? Or move it to lvl 2 logs?

@cgwalters

Copy link
Copy Markdown
Member Author

Hmm. I already destroyed my cluster that had the reboot-looping worker...those logs would have been useful. Trying to recreate the situation now.

(The reason I destroyed is I only had one worker, and clearly my MC was broken in some way, and that meant I no longer had a registry which broke my development flow)

@kikisdeliveryservice

kikisdeliveryservice commented Dec 14, 2018 •

Copy link
Copy Markdown
Contributor

To be clear I'm not against adding logging there I just think it should be more specifically phrased to not be redundant with the logging from update.go

Something like "osImageURL %s does not match current booted osImage..." or something, so that it is clear to other people reading the logs what is actually going on there.

@jlebon

jlebon commented Dec 14, 2018

Copy link
Copy Markdown
Member

Yeah, agreed the msg should be about the check finding a match or not. This is similar to what's in checkFileContentsAndMode (which... we should change those Errorf to Infof or something), where we print e.g. "expected" vs "received".

While we do rather quickly drop down into actually trying
to perform an update, which will also e.g. log reconcilable
messages, let's be very clear about exactly which part
didn't match.

A machineconfig change could include one or both of (config, osImageURL)
and we want to know when each is different.
@cgwalters
cgwalters force-pushed the daemon-log-osimageurl-target branch from 2dc101c to db0dc77 Compare December 14, 2018 23:09
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 14, 2018
@cgwalters cgwalters changed the title mcd: Log target osImageURL too daemon: Log reason when isDesiredMachineState() is false Dec 14, 2018
@cgwalters

Copy link
Copy Markdown
Member Author

OK, this PR is now different. I'd actually like to change this whole stack to return a string just like reconcilable() but let's be incremental.

@ashcrow

ashcrow commented Dec 17, 2018

Copy link
Copy Markdown
Member

/test e2e-aws

@cgwalters

cgwalters commented Dec 17, 2018 •

Copy link
Copy Markdown
Member Author

Also...I don't understand why we try to do a full reconcile here, can't we just do:

diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go
index e47449c..b9f7e47 100644
--- a/pkg/daemon/daemon.go
+++ b/pkg/daemon/daemon.go
@@ -522,14 +522,9 @@ func (dn *Daemon) isDesiredMachineState() (bool, string, error) {
 		return false, "", err
 	}
 
-	// if we can't reconcile the changes between the old config and the new
-	// config, the machine is definitely not in its desired state. this function
-	// will return true (meaning they are reconcilable) if there aren't actually
-	// changes.
-	reconcilableError := dn.reconcilable(currentConfig, desiredConfig)
-	if reconcilableError != nil {
-		glog.Infof("Not in desired state: can't reconcile current=%s with desired=%s: %s",
-			currentConfig.GetName(), desiredConfig.GetName(), *reconcilableError)
+	if currentConfig != desiredConfig {
+		glog.Infof("Not in desired state: config current=%s desired=%s",
+			currentConfig.GetName(), desiredConfig.GetName())
 		return false, "", nil
 	}
 

?

@cgwalters

Copy link
Copy Markdown
Member Author

/assign kikisdeliveryservice

@cgwalters

Copy link
Copy Markdown
Member Author

Also...I don't understand why we try to do a full reconcile here, can't we just do:

The answer to that is that machineconfigs don't compare pointer-equal of course 😄 But testing a patch that compares via deepequal.

@kikisdeliveryservice kikisdeliveryservice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dn.reconcilable() isn't explicitly checking to see whether or not two configs are the same, it's checking to see if a proposed config only contains changes that we can make. if a config contains changes that we arent allowed to make, then it's game over and unnecessary to check the configs further.

@jlebon

jlebon commented Dec 17, 2018

Copy link
Copy Markdown
Member

This patch looks good to me! Will let @kikisdeliveryservice do the honours. :)

@cgwalters

Copy link
Copy Markdown
Member Author

I decided to rewrite this. New PR incoming.

@cgwalters cgwalters closed this Dec 17, 2018
@cgwalters

Copy link
Copy Markdown
Member Author

Successor PR #245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants