Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon: Adapt to OS being pre-pivoted #151

Merged
merged 1 commit into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ func (dn *Daemon) isDesiredMachineState() (bool, string, error) {

// checkOS validates the OS image URL and returns true if they match.
func (dn *Daemon) checkOS(osImageURL string) (bool, error) {
// XXX: The installer doesn't pivot yet so for now, just make "://dummy"
// match anything. See also: https://github.com/openshift/installer/issues/281
if osImageURL == "://dummy" {
glog.Warningf(`Working around "://dummy" OS image URL until installer ➰ pivots`)
return true, nil
}
return dn.bootedOSImageURL == osImageURL, nil
}

Expand Down
12 changes: 1 addition & 11 deletions pkg/daemon/rpm-ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"encoding/json"
"fmt"
"strings"

"github.com/golang/glog"
)

// RpmOstreeState houses zero or more RpmOstreeDeployments
Expand Down Expand Up @@ -73,21 +71,13 @@ func (r *RpmOstreeClient) GetBootedOSImageURL(rootMount string) (string, string,
}

// the canonical image URL is stored in the custom origin field by the pivot tool
osImageURL := ""
osImageURL := "<not pivoted>"
if len(bootedDeployment.CustomOrigin) > 0 {
if strings.HasPrefix(bootedDeployment.CustomOrigin[0], "pivot://") {
osImageURL = bootedDeployment.CustomOrigin[0][len("pivot://"):]
}
}

// XXX: the installer doesn't pivot yet so for now, just make "" equivalent
// to "://dummy" so that we don't immediately try to pivot to this dummy
// URL. See also: https://github.com/openshift/installer/issues/281
if osImageURL == "" {
osImageURL = "://dummy"
glog.Warningf(`Working around "://dummy" OS image URL until installer ➰ pivots`)
}

return osImageURL, bootedDeployment.Version, nil
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ func getFileOwnership(file ignv2_2types.File) (int, int, error) {

// updateOS updates the system OS to the one specified in newConfig
func (dn *Daemon) updateOS(oldConfig, newConfig *mcfgv1.MachineConfig) error {
// see similar logic in checkOS()
if newConfig.Spec.OSImageURL == "://dummy" {
glog.Warningf(`Working around "://dummy" OS image URL until installer ➰ pivots`)
return nil
}

if newConfig.Spec.OSImageURL == dn.bootedOSImageURL {
return nil
}
Expand Down