[GH-ISSUE #174] device tpye='block' returns error 500 #136

Closed
opened 2026-02-27 16:38:06 +03:00 by kerem · 0 comments
Owner

Originally created by @UnvorherSeba on GitHub (Dec 15, 2013).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/174

Hello,
when using block devices (for examples for lvm volumes)

<disk type='block' device='disk'>
  <driver name='qemu' type='raw'/>
  <source dev='/dev/small/web'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>

I get an 500 error

[Sun Dec 15 09:16:07 2013] [error]   File "/var/www/webvirtmgr/vrtManager/instance.py", line 113, in disks
[Sun Dec 15 09:16:07 2013] [error]     file = interface.xpathEval('source/@file')[0].content
[Sun Dec 15 09:16:07 2013] [error] IndexError: list index out of range

I've applied a quick and dirty fix to vrtManager/instance.py

old: (starting line 111)

if device == 'disk':
    dev = interface.xpathEval('target/@dev')[0].content
    file = interface.xpathEval('source/@file')[0].content

new:

if device == 'disk':
    dev = interface.xpathEval('target/@dev')[0].content
    if type == 'file':
        file = interface.xpathEval('source/@file')[0].content     
    elif type == 'block':
        file = interface.xpathEval('source/@dev')[0].content
    else:
        raise "Unknown Disk Device!", type

PS: Nice project ;-)

Originally created by @UnvorherSeba on GitHub (Dec 15, 2013). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/174 Hello, when using block devices (for examples for lvm volumes) ``` <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/small/web'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> ``` I get an 500 error ``` [Sun Dec 15 09:16:07 2013] [error] File "/var/www/webvirtmgr/vrtManager/instance.py", line 113, in disks [Sun Dec 15 09:16:07 2013] [error] file = interface.xpathEval('source/@file')[0].content [Sun Dec 15 09:16:07 2013] [error] IndexError: list index out of range ``` I've applied a quick and dirty fix to vrtManager/instance.py old: (starting line 111) ``` if device == 'disk': dev = interface.xpathEval('target/@dev')[0].content file = interface.xpathEval('source/@file')[0].content ``` new: ``` if device == 'disk': dev = interface.xpathEval('target/@dev')[0].content if type == 'file': file = interface.xpathEval('source/@file')[0].content elif type == 'block': file = interface.xpathEval('source/@dev')[0].content else: raise "Unknown Disk Device!", type ``` PS: Nice project ;-)
kerem closed this issue 2026-02-27 16:38:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#136
No description provided.