We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 873d784 + 6e0d067 commit cab6b87Copy full SHA for cab6b87
pkg/vm/vm_linux.go
@@ -131,6 +131,24 @@ func (v *BootcVMLinux) Run(params RunVMParameters) (err error) {
131
}
132
133
134
+ if v.domain != nil {
135
+ isRunning, err := v.IsRunning()
136
+ if err != nil {
137
+ return fmt.Errorf("unable to check if VM is running: %w", err)
138
+ }
139
+
140
+ if !isRunning {
141
+ logrus.Debugf("Deleting stopped VM %s\n", v.imageID)
142
+ err = v.Delete()
143
144
+ return fmt.Errorf("unable to delete stopped VM: %w", err)
145
146
+ } else {
147
+ return errors.New("VM is already running")
148
149
150
151
+ //domain doesn't exist, create it
152
logrus.Debugf("Creating VM %s\n", v.imageID)
153
154
domainXML, err := v.parseDomainTemplate()
0 commit comments