summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index fd22f465b..269a2a2da 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -519,3 +519,17 @@ func IsValidVMName(name string) (bool, error) {
}
return false, nil
}
+
+// CheckActiveVM checks if there is a VM already running
+func CheckActiveVM() (bool, string, error) {
+ vms, err := GetVMInfos()
+ if err != nil {
+ return false, "", errors.Wrap(err, "error checking VM active")
+ }
+ for _, vm := range vms {
+ if vm.Running {
+ return true, vm.Name, nil
+ }
+ }
+ return false, "", nil
+}