diff options
author | Ashley Cui <acui@redhat.com> | 2021-08-12 10:31:17 -0400 |
---|---|---|
committer | Ashley Cui <acui@redhat.com> | 2021-08-24 14:18:55 -0400 |
commit | 3f22e529644aad8e4b763564c9ef98a3cbdae4fc (patch) | |
tree | 0cd4b9b69d955bb5e726417f0c31879784290a5b /pkg/machine/qemu | |
parent | 23f9565547ae2a6b0154e6913abf7f1232f0ece0 (diff) | |
download | podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.tar.gz podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.tar.bz2 podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.zip |
Allow setting of machine stream and image path from containers.conf
Default is "testing"
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'pkg/machine/qemu')
-rw-r--r-- | pkg/machine/qemu/machine.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index a92892957..871436618 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -138,29 +138,29 @@ func (v *MachineVM) Init(opts machine.InitOptions) error { jsonFile := filepath.Join(vmConfigDir, v.Name) + ".json" v.IdentityPath = filepath.Join(sshDir, v.Name) - // The user has provided an alternate image which can be a file path - // or URL. - if len(opts.ImagePath) > 0 { - g, err := machine.NewGenericDownloader(vmtype, v.Name, opts.ImagePath) + switch opts.ImagePath { + case "testing", "stable", "": + // Get image as usual + dd, err := machine.NewFcosDownloader(vmtype, v.Name, opts.ImagePath) if err != nil { return err } - v.ImagePath = g.Get().LocalUncompressedFile - if err := g.DownloadImage(); err != nil { + v.ImagePath = dd.Get().LocalUncompressedFile + if err := dd.DownloadImage(); err != nil { return err } - } else { - // Get the image as usual - dd, err := machine.NewFcosDownloader(vmtype, v.Name) + default: + // The user has provided an alternate image which can be a file path + // or URL. + g, err := machine.NewGenericDownloader(vmtype, v.Name, opts.ImagePath) if err != nil { return err } - v.ImagePath = dd.Get().LocalUncompressedFile - if err := dd.DownloadImage(); err != nil { + v.ImagePath = g.Get().LocalUncompressedFile + if err := g.DownloadImage(); err != nil { return err } } - // Add arch specific options including image location v.CmdLine = append(v.CmdLine, v.addArchOptions()...) |