aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-11-13 12:40:21 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-14 21:14:13 +0000
commit5cfd7a313fcae7c748b5bae84de779b28d4ea01b (patch)
tree310b7b4d63f989415d5dcf1696a127c2f3d0ce0a /cmd
parent7df322123290ee600812312421b98cfb97031e9f (diff)
downloadpodman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.tar.gz
podman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.tar.bz2
podman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.zip
Address run/create performance issues
Fixed the logic where we observed different performance results when running an image by its fqname vs a shortname. In the case of the latter, we resolve the name without using the network. Signed-off-by: baude <bbaude@redhat.com> Closes: #37 Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r--cmd/kpod/create.go10
-rw-r--r--cmd/kpod/run.go11
2 files changed, 16 insertions, 5 deletions
diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go
index 55f02e8e6..bbfeaebae 100644
--- a/cmd/kpod/create.go
+++ b/cmd/kpod/create.go
@@ -135,6 +135,7 @@ var createCommand = cli.Command{
func createCmd(c *cli.Context) error {
// TODO should allow user to create based off a directory on the host not just image
// Need CLI support for this
+ var imageName string
if err := validateFlags(c, createFlags); err != nil {
return err
}
@@ -151,7 +152,8 @@ func createCmd(c *cli.Context) error {
// Deal with the image after all the args have been checked
createImage := runtime.NewImage(createConfig.image)
- if !createImage.HasImageLocal() {
+ createImage.LocalName, _ = createImage.GetLocalImageName()
+ if createImage.LocalName == "" {
// The image wasnt found by the user input'd name or its fqname
// Pull the image
fmt.Printf("Trying to pull %s...", createImage.PullName)
@@ -163,7 +165,11 @@ func createCmd(c *cli.Context) error {
return err
}
defer runtime.Shutdown(false)
- imageName, err := createImage.GetFQName()
+ if createImage.LocalName != "" {
+ imageName = createImage.LocalName
+ } else {
+ imageName, err = createImage.GetFQName()
+ }
if err != nil {
return err
}
diff --git a/cmd/kpod/run.go b/cmd/kpod/run.go
index 6b67b55cd..84da12e6a 100644
--- a/cmd/kpod/run.go
+++ b/cmd/kpod/run.go
@@ -22,6 +22,7 @@ var runCommand = cli.Command{
}
func runCmd(c *cli.Context) error {
+ var imageName string
if err := validateFlags(c, createFlags); err != nil {
return err
}
@@ -37,8 +38,8 @@ func runCmd(c *cli.Context) error {
}
createImage := runtime.NewImage(createConfig.image)
-
- if !createImage.HasImageLocal() {
+ createImage.LocalName, _ = createImage.GetLocalImageName()
+ if createImage.LocalName == "" {
// The image wasnt found by the user input'd name or its fqname
// Pull the image
fmt.Printf("Trying to pull %s...", createImage.PullName)
@@ -52,7 +53,11 @@ func runCmd(c *cli.Context) error {
defer runtime.Shutdown(false)
logrus.Debug("spec is ", runtimeSpec)
- imageName, err := createImage.GetFQName()
+ if createImage.LocalName != "" {
+ imageName = createImage.LocalName
+ } else {
+ imageName, err = createImage.GetFQName()
+ }
if err != nil {
return err
}