Skip to content

Commit d7c5174

Browse files
authored
Merge pull request #9316 from priyawadhwa/preload-disk-full
preload: print solution message when there is no space left on device
2 parents 9cc3201 + d6acf7f commit d7c5174

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

Diff for: cmd/minikube/cmd/start.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func runStart(cmd *cobra.Command, args []string) {
197197
machine.MaybeDisplayAdvice(err, ds.Name)
198198
if specified {
199199
// If the user specified a driver, don't fallback to anything else
200-
exit.Error(reason.GuestProvision, "error provisioning host", err)
200+
exitGuestProvision(err)
201201
} else {
202202
success := false
203203
// Walk down the rest of the options
@@ -224,7 +224,7 @@ func runStart(cmd *cobra.Command, args []string) {
224224
}
225225
}
226226
if !success {
227-
exit.Error(reason.GuestProvision, "error provisioning host", err)
227+
exitGuestProvision(err)
228228
}
229229
}
230230
}
@@ -248,7 +248,7 @@ func runStart(cmd *cobra.Command, args []string) {
248248
stopProfile(existing.Name)
249249
starter, err = provisionWithDriver(cmd, ds, existing)
250250
if err != nil {
251-
exit.Error(reason.GuestProvision, "error provisioning host", err)
251+
exitGuestProvision(err)
252252
}
253253
}
254254
}
@@ -1263,3 +1263,10 @@ func exitIfNotForced(r reason.Kind, message string, v ...out.V) {
12631263
}
12641264
out.Error(r, message, v...)
12651265
}
1266+
1267+
func exitGuestProvision(err error) {
1268+
if errors.Cause(err) == oci.ErrInsufficientDockerStorage {
1269+
exit.Message(reason.RsrcInsufficientDockerStorage, "preload extraction failed: \"No space left on device\"")
1270+
}
1271+
exit.Error(reason.GuestProvision, "error provisioning host", err)
1272+
}

Diff for: pkg/drivers/kic/kic.go

+8
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func (d *Driver) Create() error {
137137

138138
var waitForPreload sync.WaitGroup
139139
waitForPreload.Add(1)
140+
var pErr error
140141
go func() {
141142
defer waitForPreload.Done()
142143
// If preload doesn't exist, don't bother extracting tarball to volume
@@ -147,11 +148,18 @@ func (d *Driver) Create() error {
147148
glog.Infof("Starting extracting preloaded images to volume ...")
148149
// Extract preloaded images to container
149150
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, d.NodeConfig.ImageDigest); err != nil {
151+
if strings.Contains(err.Error(), "No space left on device") {
152+
pErr = oci.ErrInsufficientDockerStorage
153+
return
154+
}
150155
glog.Infof("Unable to extract preloaded tarball to volume: %v", err)
151156
} else {
152157
glog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
153158
}
154159
}()
160+
if pErr == oci.ErrInsufficientDockerStorage {
161+
return pErr
162+
}
155163

156164
if err := oci.CreateContainerNode(params); err != nil {
157165
return errors.Wrap(err, "create kic node")

Diff for: pkg/drivers/kic/oci/errors.go

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ var ErrExitedUnexpectedly = errors.New("container exited unexpectedly")
4848
// ErrDaemonInfo is thrown when docker/podman info is failing or not responding
4949
var ErrDaemonInfo = errors.New("daemon info not responding")
5050

51+
// ErrInsufficientDockerStorage is thrown when there is not more storage for docker
52+
var ErrInsufficientDockerStorage = &FailFastError{errors.New("insufficient docker storage, no space left on device")}
53+
5154
// ErrNetworkSubnetTaken is thrown when a subnet is taken by another network
5255
var ErrNetworkSubnetTaken = errors.New("subnet is taken")
5356

Diff for: pkg/minikube/node/start.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ func startHost(api libmachine.API, cc *config.ClusterConfig, n *config.Node, del
383383
}
384384
}
385385

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

0 commit comments

Comments
 (0)