mirror of https://github.com/containers/podman.git
Merge pull request #12090 from afbjorklund/image-stream
Record the image stream along with the path
This commit is contained in:
commit
09efcd48a8
|
@ -48,6 +48,7 @@ type machineReporter struct {
|
||||||
Created string
|
Created string
|
||||||
Running bool
|
Running bool
|
||||||
LastUp string
|
LastUp string
|
||||||
|
Stream string
|
||||||
VMType string
|
VMType string
|
||||||
CPUs uint64
|
CPUs uint64
|
||||||
Memory string
|
Memory string
|
||||||
|
@ -153,6 +154,13 @@ func strUint(u uint64) string {
|
||||||
return strconv.FormatUint(u, 10)
|
return strconv.FormatUint(u, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func streamName(imageStream string) string {
|
||||||
|
if imageStream == "" {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
return imageStream
|
||||||
|
}
|
||||||
|
|
||||||
func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
|
func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
|
||||||
cfg, err := config.ReadCustomConfig()
|
cfg, err := config.ReadCustomConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -167,6 +175,7 @@ func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
|
||||||
response.Running = vm.Running
|
response.Running = vm.Running
|
||||||
response.LastUp = strTime(vm.LastUp)
|
response.LastUp = strTime(vm.LastUp)
|
||||||
response.Created = strTime(vm.CreatedAt)
|
response.Created = strTime(vm.CreatedAt)
|
||||||
|
response.Stream = streamName(vm.Stream)
|
||||||
response.VMType = vm.VMType
|
response.VMType = vm.VMType
|
||||||
response.CPUs = vm.CPUs
|
response.CPUs = vm.CPUs
|
||||||
response.Memory = strUint(vm.Memory * units.MiB)
|
response.Memory = strUint(vm.Memory * units.MiB)
|
||||||
|
|
|
@ -57,6 +57,7 @@ type ListResponse struct {
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
LastUp time.Time
|
LastUp time.Time
|
||||||
Running bool
|
Running bool
|
||||||
|
Stream string
|
||||||
VMType string
|
VMType string
|
||||||
CPUs uint64
|
CPUs uint64
|
||||||
Memory uint64
|
Memory uint64
|
||||||
|
|
|
@ -13,6 +13,8 @@ type MachineVM struct {
|
||||||
IdentityPath string
|
IdentityPath string
|
||||||
// IgnitionFilePath is the fq path to the .ign file
|
// IgnitionFilePath is the fq path to the .ign file
|
||||||
IgnitionFilePath string
|
IgnitionFilePath string
|
||||||
|
// ImageStream is the update stream for the image
|
||||||
|
ImageStream string
|
||||||
// ImagePath is the fq path to
|
// ImagePath is the fq path to
|
||||||
ImagePath string
|
ImagePath string
|
||||||
// Memory in megabytes assigned to the vm
|
// Memory in megabytes assigned to the vm
|
||||||
|
|
|
@ -143,6 +143,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
|
||||||
switch opts.ImagePath {
|
switch opts.ImagePath {
|
||||||
case "testing", "next", "stable", "":
|
case "testing", "next", "stable", "":
|
||||||
// Get image as usual
|
// Get image as usual
|
||||||
|
v.ImageStream = opts.ImagePath
|
||||||
dd, err := machine.NewFcosDownloader(vmtype, v.Name, opts.ImagePath)
|
dd, err := machine.NewFcosDownloader(vmtype, v.Name, opts.ImagePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -154,6 +155,7 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
|
||||||
default:
|
default:
|
||||||
// The user has provided an alternate image which can be a file path
|
// The user has provided an alternate image which can be a file path
|
||||||
// or URL.
|
// or URL.
|
||||||
|
v.ImageStream = "custom"
|
||||||
g, err := machine.NewGenericDownloader(vmtype, v.Name, opts.ImagePath)
|
g, err := machine.NewGenericDownloader(vmtype, v.Name, opts.ImagePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -595,6 +597,7 @@ func GetVMInfos() ([]*machine.ListResponse, error) {
|
||||||
listEntry := new(machine.ListResponse)
|
listEntry := new(machine.ListResponse)
|
||||||
|
|
||||||
listEntry.Name = vm.Name
|
listEntry.Name = vm.Name
|
||||||
|
listEntry.Stream = vm.ImageStream
|
||||||
listEntry.VMType = "qemu"
|
listEntry.VMType = "qemu"
|
||||||
listEntry.CPUs = vm.CPUs
|
listEntry.CPUs = vm.CPUs
|
||||||
listEntry.Memory = vm.Memory
|
listEntry.Memory = vm.Memory
|
||||||
|
|
Loading…
Reference in New Issue