summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-06-09 16:23:25 -0400
committerGitHub <noreply@github.com>2022-06-09 16:23:25 -0400
commitf808907d85204a2a5606067eb31400aa12233635 (patch)
tree87aff4de960c2e760d021018d0ae7e3e6b53744b /pkg/machine/qemu/machine.go
parent6a2c0e96011d36e5b459a010d472facd26c67389 (diff)
parent81153ffa21c5d29abb8ebadffaa19b4e02e4bc60 (diff)
downloadpodman-f808907d85204a2a5606067eb31400aa12233635.tar.gz
podman-f808907d85204a2a5606067eb31400aa12233635.tar.bz2
podman-f808907d85204a2a5606067eb31400aa12233635.zip
Merge pull request #14469 from shanesmith/prevent-simultaneous-machine-starts
Prevent simultaneous machine starts
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 0a85ff5ce..1b0d63986 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -910,7 +910,7 @@ func (v *MachineVM) State(bypass bool) (machine.Status, error) {
}
// Check if we can dial it
if v.Starting && !bypass {
- return "", nil
+ return machine.Starting, nil
}
monitor, err := qmp.NewSocketMonitor(v.QMPMonitor.Network, v.QMPMonitor.Address.GetPath(), v.QMPMonitor.Timeout)
if err != nil {
@@ -1081,8 +1081,11 @@ func getVMInfos() ([]*machine.ListResponse, error) {
return err
}
}
- if state == machine.Running {
+ switch state {
+ case machine.Running:
listEntry.Running = true
+ case machine.Starting:
+ listEntry.Starting = true
}
listed = append(listed, listEntry)
@@ -1115,7 +1118,7 @@ func (p *Provider) CheckExclusiveActiveVM() (bool, string, error) {
return false, "", errors.Wrap(err, "error checking VM active")
}
for _, vm := range vms {
- if vm.Running {
+ if vm.Running || vm.Starting {
return true, vm.Name, nil
}
}