Show starting state when machine is starting

Currently podman machine list never shows the starting state.

Fixes: https://github.com/containers/podman/issues/14738

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2022-06-27 09:27:44 -04:00
parent 1022ea36dd
commit 386ea49cf5
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
1 changed files with 2 additions and 6 deletions

View File

@ -1074,6 +1074,7 @@ func getVMInfos() ([]*machine.ListResponse, error) {
listEntry.RemoteUsername = vm.RemoteUsername listEntry.RemoteUsername = vm.RemoteUsername
listEntry.IdentityPath = vm.IdentityPath listEntry.IdentityPath = vm.IdentityPath
listEntry.CreatedAt = vm.Created listEntry.CreatedAt = vm.Created
listEntry.Starting = vm.Starting
if listEntry.CreatedAt.IsZero() { if listEntry.CreatedAt.IsZero() {
listEntry.CreatedAt = time.Now() listEntry.CreatedAt = time.Now()
@ -1087,6 +1088,7 @@ func getVMInfos() ([]*machine.ListResponse, error) {
if err != nil { if err != nil {
return err return err
} }
listEntry.Running = state == machine.Running
if !vm.LastUp.IsZero() { // this means we have already written a time to the config if !vm.LastUp.IsZero() { // this means we have already written a time to the config
listEntry.LastUp = vm.LastUp listEntry.LastUp = vm.LastUp
@ -1097,12 +1099,6 @@ func getVMInfos() ([]*machine.ListResponse, error) {
return err return err
} }
} }
switch state {
case machine.Running:
listEntry.Running = true
case machine.Starting:
listEntry.Starting = true
}
listed = append(listed, listEntry) listed = append(listed, listEntry)
} }