Fix kvm2 vm driver remove domain

pull/4619/head
Jose Donizetti 2019-06-26 22:36:52 -03:00 committed by Medya Ghazizadeh
parent 0900b2b73b
commit d6a839b20a
1 changed files with 3 additions and 2 deletions

View File

@ -459,12 +459,13 @@ func (d *Driver) Remove() error {
} }
func (d *Driver) destroyRunningDomain(dom *libvirt.Domain) error { func (d *Driver) destroyRunningDomain(dom *libvirt.Domain) error {
state, reason, err := dom.GetState() state, _, err := dom.GetState()
if err != nil { if err != nil {
return errors.Wrap(err, "getting domain state") return errors.Wrap(err, "getting domain state")
} }
if state == libvirt.DOMAIN_SHUTOFF && reason == int(libvirt.DOMAIN_SHUTOFF_DESTROYED) { // if the domain is not running, we don't destroy it
if state != libvirt.DOMAIN_RUNNING {
log.Warnf("Domain %s already destroyed, skipping...", d.MachineName) log.Warnf("Domain %s already destroyed, skipping...", d.MachineName)
return nil return nil
} }