Bug 50580 - uvmm/query: IndexError: tuple index out of range if virshDomainState is VIR_DOMAIN_PMSUSPENDED
uvmm/query: IndexError: tuple index out of range if virshDomainState is VIR_D...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Virtualization - UVMM
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-3-errata
Assigned To: Philipp Hahn
Julia Bremer
:
: 46853 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-29 22:08 CET by Florian Best
Modified: 2020-01-22 14:47 CET (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.229
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
hahn: Patch_Available+


Attachments
Screenshot (124.90 KB, image/png)
2019-11-29 22:08 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-11-29 22:08:28 CET
Created attachment 10242 [details]
Screenshot

I somehow got into a state where I get a pop up (see attachment) which is always poping up in a loop every 5 seconds:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/univention/uvmm/unix.py", line 148, in handle_command
    res = cmd(self, command)
  File "/usr/lib/python2.7/dist-packages/univention/uvmm/commands.py", line 366, in DOMAIN_LIST
    domains = node.domain_list(request.uri, request.pattern)
  File "/usr/lib/python2.7/dist-packages/univention/uvmm/node.py", line 1928, in domain_list
    domains[node.pd.uri] = node.domain_list(pattern)
  File "/usr/lib/python2.7/dist-packages/univention/uvmm/node.py", line 1258, in domain_list
    'state': STATES[pd.state],
IndexError: tuple index out of range


curl 'https://laiva.knut.univention.de/univention/command/uvmm/query' -H 'Pragma: no-cache' -H 'Cookie: UMCSessionId=XXX' -H 'Origin: https://laiva.knut.univention.de' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: de-DE' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json; q=1.0, text/html; q=0.3; */*; q=0.1' -H 'Cache-Control: no-cache' -H 'X-Requested-With: XMLHttpRequest' -H 'X-XSRF-Protection: XXX' -H 'Connection: keep-alive' -H 'Referer: https://laiva.knut.univention.de/univention/management/' --data-binary '{"options":{"type":"domain","domainPattern":"","nodePattern":""}}' --compressed --insecure
Comment 1 Florian Best univentionstaff 2019-11-29 22:13:31 CET
pd.state is 7
Comment 3 Jürn Brodersen univentionstaff 2019-12-02 12:03:06 CET
The state "VIR_DOMAIN_PMSUSPENDED" is missing:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainState
Comment 4 Florian Best univentionstaff 2019-12-02 12:04:46 CET
We should add the 2 missing domain states:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainState

VIR_DOMAIN_PMSUSPENDED 	= 	7 (0x7) 	
the domain is suspended by guest power management
VIR_DOMAIN_LAST 	= 	8 (0x8) 	
NB: this enum value will increase over time as new events are added to the libvirt API. It reflects the last state supported by this version of the libvirt API.
Comment 5 Philipp Hahn univentionstaff 2019-12-02 12:07:45 CET
(In reply to Florian Best from comment #4)
> We should add the 2 missing domain states:
> https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainState
> 
> VIR_DOMAIN_PMSUSPENDED 	= 	7 (0x7) 	
> the domain is suspended by guest power management
> VIR_DOMAIN_LAST 	= 	8 (0x8) 	

Do NOT add *_LAST!
Comment 6 Florian Best univentionstaff 2019-12-02 12:23:45 CET
(In reply to Philipp Hahn from comment #5)
> Do NOT add *_LAST!
Ok, why not?
Comment 7 Florian Best univentionstaff 2019-12-02 12:25:00 CET
(In reply to Florian Best from comment #6)
> (In reply to Philipp Hahn from comment #5)
> > Do NOT add *_LAST!
> Ok, why not?

Probably as it is only a marker for the last possible value.
Comment 8 Jürn Brodersen univentionstaff 2019-12-11 16:14:34 CET
I used "Win10_1909_English_x64.iso" and installed the WindowsGuestDrivers:
https://www.linux-kvm.org/page/WindowsGuestDrivers

Drive and network are set to use virtio, graphics are set to qxl and cpu capabilities are set to be passed through.


VMs can be found with: "virsh list --all  | grep pmsuspended" and woken up with "virsh dompmwakeup $VM" or just destroyed.
Comment 9 Jannik Ahlers univentionstaff 2019-12-13 10:28:39 CET

*** This bug has been marked as a duplicate of bug 46853 ***
Comment 10 Florian Best univentionstaff 2019-12-13 12:42:01 CET
*** Bug 46853 has been marked as a duplicate of this bug. ***
Comment 11 Florian Best univentionstaff 2019-12-13 12:43:05 CET
(In reply to Florian Best from comment #10)
> *** Bug 46853 has been marked as a duplicate of this bug. ***

(In reply to Jannik Ahlers from comment #0)
> Created attachment 9508 [details]
> uvmm
> 
> after using the suspend function of a ubuntu 16.04 vm all query requests of
> uvmm fail. This results in the error message in the screenshot. As the
> request gets sent every few seconds, this bug makes uvmm pretty much
> unusable. Restarting uvmm daemon or umc server doesn't help either, but
> rebooting fixes it.
Comment 12 Florian Best univentionstaff 2019-12-16 10:25:35 CET
This bug (or a clone of it) should also fix that those exceptions are passed as str(exc) to the frontend instead of displaying a traceback-feedback dialogue.
Comment 14 Philipp Hahn univentionstaff 2020-01-15 14:28:47 CET
[4.4-3] b457de00d7 Bug #50580 UVMM: Add STATE VIR_DOMAIN_PMSUSPENDED
 .../univention-virtual-machine-manager-daemon/debian/changelog      | 6 ++++++
 .../src/univention/uvmm/node.py                                     | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
[4.4-3] 8fec82f85e Bug #50580 UVMM: Add state  VIR_DOMAIN_PMSUSPENDED to UMC
 .../src/univention/uvmm/node.py                                        | 3 +++
 .../univention-virtual-machine-manager-daemon/umc/js/uvmm.js           | 2 +-
 .../univention-virtual-machine-manager-daemon/umc/js/uvmm/types.js     | 3 ++-
 .../umc/python/uvmm/domains.py                                         | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

Package: univention-virtual-machine-manager-daemon
Version: 8.0.1-15A~4.4.0.202001151425
Branch: ucs_4.4-0
Scope: errata4.4-3

[4.4-3] c01ec716f6 Bug #50580: univention-virtual-machine-manager-daemon 8.0.1-15A~4.4.0.202001151334
 .../staging/univention-virtual-machine-manager-daemon.yaml     | 10 ++++++++++
 1 file changed, 10 insertions(+)
[4.4-3] 77edc25414 Bug #50580: univention-virtual-machine-manager-daemon 8.0.1-15A~4.4.0.202001151425
 doc/errata/staging/univention-virtual-machine-manager-daemon.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

QA:
1. Install UCS-4 VM
2. Install Qemu guest agent <https://hutten.knut.univention.de/mediawiki/index.php/Philipp_memo/Virtualisierung#Guest_agent>
2.1 virsh edit $VM
<domain...>
  <devices>
...
<channel type='unix'>
    <source mode='bind'/>
    <target type='virtio' name='org.qemu.guest_agent.0'/>
  </channel>
...
</devices>
</domain>

2.2 apt install qemu-guest-agent
2.3 shutdown and restart VM
3. Suspend VM: virsh dompmsuspend --domain $VM --target mem
4. Verify state:
4.1 virsh list --all  # State=pmsuspended
4.2 UVMM -> `tuple index out of range`
5. Upgrade UVMM: apt -t apt install univention-virtual-machine-manager-daemon python-univention-virtual-machine-manager
6. Repeat verify:
- UVMM no longer crashes
- uvmm domains "qemu://$(hostname f)/system" # 'state': 'PMSUSPENDED'
Comment 15 Julia Bremer univentionstaff 2020-01-15 17:28:57 CET
I could replicate the problem by following the steps described above, 
after updating the problem didn't occur anymore. 
Code review: OK
Yaml: OK

Verified
Comment 16 Erik Damrose univentionstaff 2020-01-22 14:47:55 CET
<http://errata.software-univention.de/ucs/4.4/427.html>