[et-mgmt-tools] virt-manager unknown status normalization problems

Tóth István stoty at tvnet.hu
Sun Mar 9 05:51:11 UTC 2008


Hello!

I think I've found a major problem in virt-manager when handling xen
managed domains.

The symptom is, that once I stop a xen domain, I can-not start it again.

Steps to reproduce:
- Install clean Fedora 8 with latest patches
- create HVM guest with virt-inst
- shut it down
- virt-manager still shows it as running
- try to start it in virt-manager -> Run is greyed out in the popup

I've tried the same with libvirt-4.1, and the results are the same.

I've done some debugging:

# xm list
Name                                        ID   Mem VCPUs      State
Time(s)
Domain-0                                     0  3487     4     r-----
2565.6
windows-xen                                  3   512     0
------     44.9

# virsh list --all
<warnings cut>
   Id Name                 State
----------------------------------
    0 Domain-0             running
    - windows-xen          no state

It seems that for stopped HVM domains (may be the same for PV, I have
not checked) xend sets no flags, which libvirt translates as
VIR_DOMAIN_NOSTATE.

The code below is from domain.py:

      def _normalize_status(self, status):
          if status == libvirt.VIR_DOMAIN_NOSTATE:
              return libvirt.VIR_DOMAIN_RUNNING
          elif status == libvirt.VIR_DOMAIN_BLOCKED:
              return libvirt.VIR_DOMAIN_RUNNING
          return status

      def _update_status(self, status=None):
          if status == None:
              info = self.vm.info()
              status = info[0]
          status = self._normalize_status(status)

          if status != self.lastStatus:
              self.lastStatus = status
              self.emit("status-changed", status)


and it shows that virt-manager decided not expose the NOSTATE status to
the UI, and instead translates it to running.
This has the effect of showing false information (Running) in the domain
list window, as well as making it impossible to start the domain, as the
popup_vm_menu
function offers the actions based on the normalized status.

The net result of this problem, is that virt-manager is not really able
to show or change the status of xen managed domains.

I can see three solutions:

- The problem could be solved in libvirt by mapping the no flags set
'------' state to say,  VIR_DOMAIN_SHUTOFF.
It would change the etablished semantics, plus would  require a libvirt
upgrade to fix, so this does not seem ideal.

- Change the  _normalize_status function to map  VIR_DOMAIN_NOSTATE to
VIR_DOMAIN_SHUTOFF

- Expose the NO_STATE state through the GUI, and treat it like SHUTOFF.


I've attached a one-liner patch that implements the second solutin, and
fixes the problem for me.

regards

István Tóth


-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_state.patch
Type: text/x-patch
Size: 622 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/et-mgmt-tools/attachments/20080309/189105d6/attachment.bin>


More information about the et-mgmt-tools mailing list