Skip to content

koan should wait for a VM to be in VIR_DOMAIN_SHUTOFF state before recreating the domain #26

@pieterlauwers

Description

@pieterlauwers

When the VM is halted at the end of the installation, koan can restart the VM.
In this case, koan waits until the vm is shutdown and then performs a virsh create for the VM.

I noticed in several occasions that the creation failed with error
`

  • polling for virt completion
  • install is still running, sleeping for 1 minute (0)
  • install is still running, sleeping for 1 minute (1)
  • install is still running, sleeping for 1 minute (2)
  • install is still running, sleeping for 1 minute (3)
  • install is still running, sleeping for 1 minute (4)
  • shutdown VM detected, is the install done? Restarting!
    <class 'libvirt.libvirtError'>
    Requested operation is not valid: domain is already running
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 274, in main
    k.run()
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 424, in run
    self.virt()
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 844, in virt
    return self.net_install(after_download)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 671, in net_install
    after_download(self, profile_data)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 842, in after_download
    self.virt_net_install(profile_data)
    File "/usr/lib/python2.6/site-packages/koan/app.py", line 1562, in virt_net_install
    utils.find_vm(conn, virtname).create()
    File "/usr/lib64/python2.6/site-packages/libvirt.py", line 686, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
    `

i think this is caused by the status polling that interprets the domain status VIR_DOMAIN_SHUTDOWN the same as VIR_DOMAIN_SHUTOFF. But VIR_DOMAIN_SHUTDOWN means

the domain is being shut down

And in this state the VM can't be recreated (yet).
This error happens only now and again because the VIR_DOMAIN_SHUTDOWN state is short lived (less than a second in my tests) and the polling interval is 60 seconds.

CentOS release 6.9 (Final)
koan-2.6.11-1.el6.noarch
libvirt-0.10.2-62.el6.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Bug Reports

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions