mirror of
https://github.com/rancher/os.git
synced 2025-08-07 01:34:03 +00:00
enhance preload timing issue
This commit is contained in:
parent
c73954fab0
commit
80c99642b2
@ -14,6 +14,8 @@ import (
|
|||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
|
||||||
dockerClient "github.com/docker/engine-api/client"
|
dockerClient "github.com/docker/engine-api/client"
|
||||||
|
"github.com/docker/engine-api/types"
|
||||||
|
"github.com/rancher/os/config"
|
||||||
"github.com/rancher/os/docker"
|
"github.com/rancher/os/docker"
|
||||||
"github.com/rancher/os/log"
|
"github.com/rancher/os/log"
|
||||||
)
|
)
|
||||||
@ -90,10 +92,17 @@ func PreloadImages(clientFactory func() (dockerClient.APIClient, error), imagesD
|
|||||||
clientInitialized = true
|
clientInitialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Loading image %s", filename)
|
var imageLoadResponse types.ImageLoadResponse
|
||||||
if _, err = client.ImageLoad(context.Background(), imageReader, false); err != nil {
|
if imageLoadResponse, err = client.ImageLoad(context.Background(), imageReader, false); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
cfg := config.LoadConfig()
|
||||||
|
if cfg.Rancher.PreloadWait {
|
||||||
|
if _, err := ioutil.ReadAll(imageLoadResponse.Body); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Infof("Finished to load image %s", filename)
|
log.Infof("Finished to load image %s", filename)
|
||||||
|
|
||||||
log.Infof("Creating done stamp file for image %s", filename)
|
log.Infof("Creating done stamp file for image %s", filename)
|
||||||
|
@ -55,7 +55,8 @@ var schema = `{
|
|||||||
"sysctl": {"type": "object"},
|
"sysctl": {"type": "object"},
|
||||||
"restart_services": {"type": "array"},
|
"restart_services": {"type": "array"},
|
||||||
"hypervisor_service": {"type": "boolean"},
|
"hypervisor_service": {"type": "boolean"},
|
||||||
"shutdown_timeout": {"type": "integer"}
|
"shutdown_timeout": {"type": "integer"},
|
||||||
|
"preload_wait": {"type": "boolean"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ type RancherConfig struct {
|
|||||||
RestartServices []string `yaml:"restart_services,omitempty"`
|
RestartServices []string `yaml:"restart_services,omitempty"`
|
||||||
HypervisorService bool `yaml:"hypervisor_service,omitempty"`
|
HypervisorService bool `yaml:"hypervisor_service,omitempty"`
|
||||||
ShutdownTimeout int `yaml:"shutdown_timeout,omitempty"`
|
ShutdownTimeout int `yaml:"shutdown_timeout,omitempty"`
|
||||||
|
PreloadWait bool `yaml:"preload_wait,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpgradeConfig struct {
|
type UpgradeConfig struct {
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
"sysctl": {"type": "object"},
|
"sysctl": {"type": "object"},
|
||||||
"restart_services": {"type": "array"},
|
"restart_services": {"type": "array"},
|
||||||
"hypervisor_service": {"type": "boolean"},
|
"hypervisor_service": {"type": "boolean"},
|
||||||
"shutdown_timeout": {"type": "integer"}
|
"shutdown_timeout": {"type": "integer"},
|
||||||
|
"preload_wait": {"type": "boolean"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user