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

preload: improve solution message when there is no space left on device #9316

Merged
merged 8 commits into from
Oct 7, 2020
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
13 changes: 10 additions & 3 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func runStart(cmd *cobra.Command, args []string) {
machine.MaybeDisplayAdvice(err, ds.Name)
if specified {
// If the user specified a driver, don't fallback to anything else
exit.Error(reason.GuestProvision, "error provisioning host", err)
exitGuestProvision(err)
} else {
success := false
// Walk down the rest of the options
Expand All @@ -224,7 +224,7 @@ func runStart(cmd *cobra.Command, args []string) {
}
}
if !success {
exit.Error(reason.GuestProvision, "error provisioning host", err)
exitGuestProvision(err)
}
}
}
Expand All @@ -248,7 +248,7 @@ func runStart(cmd *cobra.Command, args []string) {
stopProfile(existing.Name)
starter, err = provisionWithDriver(cmd, ds, existing)
if err != nil {
exit.Error(reason.GuestProvision, "error provisioning host", err)
exitGuestProvision(err)
}
}
}
Expand Down Expand Up @@ -1263,3 +1263,10 @@ func exitIfNotForced(r reason.Kind, message string, v ...out.V) {
}
out.Error(r, message, v...)
}

func exitGuestProvision(err error) {
if errors.Cause(err) == oci.ErrInsufficientDockerStorage {
exit.Message(reason.RsrcInsufficientDockerStorage, "preload extraction failed: \"No space left on device\"")
}
exit.Error(reason.GuestProvision, "error provisioning host", err)
}
8 changes: 8 additions & 0 deletions pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (d *Driver) Create() error {

var waitForPreload sync.WaitGroup
waitForPreload.Add(1)
var pErr error
go func() {
defer waitForPreload.Done()
// If preload doesn't exist, don't bother extracting tarball to volume
Expand All @@ -147,11 +148,18 @@ func (d *Driver) Create() error {
glog.Infof("Starting extracting preloaded images to volume ...")
// Extract preloaded images to container
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, d.NodeConfig.ImageDigest); err != nil {
if strings.Contains(err.Error(), "No space left on device") {
pErr = oci.ErrInsufficientDockerStorage
return
}
glog.Infof("Unable to extract preloaded tarball to volume: %v", err)
} else {
glog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
}
}()
if pErr == oci.ErrInsufficientDockerStorage {
return pErr
}

if err := oci.CreateContainerNode(params); err != nil {
return errors.Wrap(err, "create kic node")
Expand Down
3 changes: 3 additions & 0 deletions pkg/drivers/kic/oci/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ var ErrExitedUnexpectedly = errors.New("container exited unexpectedly")
// ErrDaemonInfo is thrown when docker/podman info is failing or not responding
var ErrDaemonInfo = errors.New("daemon info not responding")

// ErrInsufficientDockerStorage is thrown when there is not more storage for docker
var ErrInsufficientDockerStorage = &FailFastError{errors.New("insufficient docker storage, no space left on device")}

// ErrNetworkSubnetTaken is thrown when a subnet is taken by another network
var ErrNetworkSubnetTaken = errors.New("subnet is taken")

Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func startHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node, del
}
}

if _, ff := err.(*oci.FailFastError); ff {
if err, ff := errors.Cause(err).(*oci.FailFastError); ff {
glog.Infof("will skip retrying to create machine because error is not retriable: %v", err)
return host, exists, err
}
Expand Down