[GH-ISSUE #307] IndexError: list index out of range #240

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

Originally created by @AlexH-HankIT on GitHub (May 13, 2014).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/307

ERROR:django.request:Internal Server Error: /instance/1/EXTest01/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/var/www/webvirtmgr/instance/views.py", line 472, in instance
    networks = conn.get_net_device()
  File "/var/www/webvirtmgr/vrtManager/instance.py", line 177, in get_net_device
    return util.get_xml_path(self._XMLDesc(0), func=networks)
  File "/var/www/webvirtmgr/vrtManager/util.py", line 104, in get_xml_path
    result = func(ctx)
  File "/var/www/webvirtmgr/vrtManager/instance.py", line 169, in networks
    nic_host = net.xpathEval('source/@network|source/@bridge|source/@dev')[0].content
IndexError: list index out of range

I get this error if i click on a running virtual machine. Once the machine is shutdown i can normal access the menu. My webvirtmgr is configured with two bridges.

Originally created by @AlexH-HankIT on GitHub (May 13, 2014). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/307 <pre>ERROR:django.request:Internal Server Error: /instance/1/EXTest01/ Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/var/www/webvirtmgr/instance/views.py", line 472, in instance networks = conn.get_net_device() File "/var/www/webvirtmgr/vrtManager/instance.py", line 177, in get_net_device return util.get_xml_path(self._XMLDesc(0), func=networks) File "/var/www/webvirtmgr/vrtManager/util.py", line 104, in get_xml_path result = func(ctx) File "/var/www/webvirtmgr/vrtManager/instance.py", line 169, in networks nic_host = net.xpathEval('source/@network|source/@bridge|source/@dev')[0].content IndexError: list index out of range</pre> I get this error if i click on a running virtual machine. Once the machine is shutdown i can normal access the menu. My webvirtmgr is configured with two bridges.
kerem closed this issue 2026-02-27 16:38:32 +03:00
Author
Owner

@retspen commented on GitHub (May 13, 2014):

Could you show your VM xml?

<!-- gh-comment-id:42976035 --> @retspen commented on GitHub (May 13, 2014): Could you show your VM xml?
Author
Owner

@AlexH-HankIT commented on GitHub (May 13, 2014):

Of course:
http://pastebin.com/nLjzCCMW

It isn't working on any running virtual machine. If i shut it down i can access the menu normaly. If i start it everything is working fine, until i restart the libvirt-bin service (I'm using debian wheezy x64). Then i get the error.

<!-- gh-comment-id:42993404 --> @AlexH-HankIT commented on GitHub (May 13, 2014): Of course: http://pastebin.com/nLjzCCMW It isn't working on any running virtual machine. If i shut it down i can access the menu normaly. If i start it everything is working fine, until i restart the libvirt-bin service (I'm using debian wheezy x64). Then i get the error.
Author
Owner

@retspen commented on GitHub (May 13, 2014):

Change in file settings.py:
DEBUG = False to DEBUG = True

restart supervisor and show debug error.

<!-- gh-comment-id:42994260 --> @retspen commented on GitHub (May 13, 2014): Change in file settings.py: DEBUG = False to DEBUG = True restart supervisor and show debug error.
Author
Owner

@AlexH-HankIT commented on GitHub (May 14, 2014):

It's nearly the same error again:
http://pastebin.com/aaE10nMt

I think I will try to reinstall webvirtmgr.

Edit: I reinstalled webvirtmgr and libvirt-bin, i deleted every VM and added it again, but still the same error :/

<!-- gh-comment-id:43048655 --> @AlexH-HankIT commented on GitHub (May 14, 2014): It's nearly the same error again: http://pastebin.com/aaE10nMt I think I will try to reinstall webvirtmgr. Edit: I reinstalled webvirtmgr and libvirt-bin, i deleted every VM and added it again, but still the same error :/
Author
Owner

@retspen commented on GitHub (May 14, 2014):

Do you add VM through WebVirtMgr?

<!-- gh-comment-id:43058088 --> @retspen commented on GitHub (May 14, 2014): Do you add VM through WebVirtMgr?
Author
Owner

@AlexH-HankIT commented on GitHub (May 14, 2014):

yes, it's the only managment tool i've installed.

<!-- gh-comment-id:43061171 --> @AlexH-HankIT commented on GitHub (May 14, 2014): yes, it's the only managment tool i've installed.
Author
Owner

@retspen commented on GitHub (May 14, 2014):

Could you create simple VM without bridge and check error?

<!-- gh-comment-id:43080812 --> @retspen commented on GitHub (May 14, 2014): Could you create simple VM without bridge and check error?
Author
Owner

@AlexH-HankIT commented on GitHub (May 14, 2014):

I've created an VM with an "isolated" network and it's working. So the bridges must cause this error. I deleted them and now i can't add them again. I get the error: "Das folgende Format muss verwendet werden: ". I normally write my bridges in uppercases. Are there any new restrictions?

<!-- gh-comment-id:43084451 --> @AlexH-HankIT commented on GitHub (May 14, 2014): I've created an VM with an "isolated" network and it's working. So the bridges must cause this error. I deleted them and now i can't add them again. I get the error: "Das folgende Format muss verwendet werden: ". I normally write my bridges in uppercases. Are there any new restrictions?
Author
Owner

@retspen commented on GitHub (May 14, 2014):

Create Network Pool - put name 'bridge' and device 'your_device' and choose type forwarding: 'BRIDGE' and then add next line to VM xml:

    <interface type='network'>
      <mac address='52:54:00:11:11:10'/>
      <source network='bridge'/>
      <model type='virtio'/>
     </interface>
<!-- gh-comment-id:43085534 --> @retspen commented on GitHub (May 14, 2014): Create Network Pool - put name 'bridge' and device 'your_device' and choose type forwarding: 'BRIDGE' and then add next line to VM xml: ``` <interface type='network'> <mac address='52:54:00:11:11:10'/> <source network='bridge'/> <model type='virtio'/> </interface> ```
Author
Owner

@AlexH-HankIT commented on GitHub (May 14, 2014):

It's working until i add the line for the bridge, then i get the error again. This is my bridge.xml config file:

http://pastebin.com/RiuFznxQ

I renamed my bridge from "LAN" to "lan" without any success...

<!-- gh-comment-id:43087603 --> @AlexH-HankIT commented on GitHub (May 14, 2014): It's working until i add the line for the bridge, then i get the error again. This is my bridge.xml config file: http://pastebin.com/RiuFznxQ I renamed my bridge from "LAN" to "lan" without any success...
Author
Owner

@retspen commented on GitHub (May 15, 2014):

I will try to create environment like you have and I will be testing.

<!-- gh-comment-id:43199087 --> @retspen commented on GitHub (May 15, 2014): I will try to create environment like you have and I will be testing.
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

I've created a Guest with the following command:

virt-install -n dings -r 1024 --vcpus=1 -f /images02/test02.qcow2 --vnc --noautoconsole --os-type linux --accelerate --network=bridge:lan,model=virtio -m 00:00:00:00:00:07 -k de --boot hd

I can normally manage this VM in webvirtmgr without any errors.

XML File of the working machine:
http://pastebin.com/0TAURJmX

XML File of the non-working VM created through webvirtmgr:
http://pastebin.com/ieNfW9w4

There is a difference between the network parts. Maybe thats what causes this error?

<!-- gh-comment-id:43202581 --> @AlexH-HankIT commented on GitHub (May 15, 2014): I've created a Guest with the following command: <pre>virt-install -n dings -r 1024 --vcpus=1 -f /images02/test02.qcow2 --vnc --noautoconsole --os-type linux --accelerate --network=bridge:lan,model=virtio -m 00:00:00:00:00:07 -k de --boot hd</pre> I can normally manage this VM in webvirtmgr without any errors. XML File of the working machine: http://pastebin.com/0TAURJmX XML File of the non-working VM created through webvirtmgr: http://pastebin.com/ieNfW9w4 There is a difference between the network parts. Maybe thats what causes this error?
Author
Owner

@retspen commented on GitHub (May 15, 2014):

Remove next line and test:

  <cpu mode='host-model'>
    <model fallback='allow'/>
  </cpu>
<!-- gh-comment-id:43203454 --> @retspen commented on GitHub (May 15, 2014): Remove next line and test: ``` <cpu mode='host-model'> <model fallback='allow'/> </cpu> ```
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

I deleted it, but i still get the error...

<!-- gh-comment-id:43205252 --> @AlexH-HankIT commented on GitHub (May 15, 2014): I deleted it, but i still get the error...
Author
Owner

@retspen commented on GitHub (May 15, 2014):

Ok, change network device:

<interface type='bridge'>
      <mac address='00:00:00:00:00:07'/>
      <source bridge='lan'/>
      <model type='virtio'/>
    </interface>
<!-- gh-comment-id:43205863 --> @retspen commented on GitHub (May 15, 2014): Ok, change network device: ``` <interface type='bridge'> <mac address='00:00:00:00:00:07'/> <source bridge='lan'/> <model type='virtio'/> </interface> ```
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

It's working.

<!-- gh-comment-id:43206887 --> @AlexH-HankIT commented on GitHub (May 15, 2014): It's working.
Author
Owner

@retspen commented on GitHub (May 15, 2014):

Ok, add this:

 <cpu mode='host-model'>
    <model fallback='allow'/>
  </cpu>

test this if is it ok show your xml

<!-- gh-comment-id:43207081 --> @retspen commented on GitHub (May 15, 2014): Ok, add this: ``` <cpu mode='host-model'> <model fallback='allow'/> </cpu> ``` test this if is it ok show your xml
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

Still working.

<!-- gh-comment-id:43207986 --> @AlexH-HankIT commented on GitHub (May 15, 2014): Still working.
Author
Owner

@retspen commented on GitHub (May 15, 2014):

What has change with the first xml - http://pastebin.com/nLjzCCMW ?

<!-- gh-comment-id:43209027 --> @retspen commented on GitHub (May 15, 2014): What has change with the first xml - http://pastebin.com/nLjzCCMW ?
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

Good question. As far as I can see, only the mac address and some normal differences. I will compare this files with another webvirtmgr installation.

<!-- gh-comment-id:43212735 --> @AlexH-HankIT commented on GitHub (May 15, 2014): Good question. As far as I can see, only the mac address and some normal differences. I will compare this files with another webvirtmgr installation.
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

Maybe i got something:
If the machine is running, the network config in the xml file looks like this:
http://pastebin.com/TF4B9rPa

If the machine is shutdown it looks like this:
http://pastebin.com/hPYkhtB5

Why is the interface type "bridge" while the machine is running and "network" if it's shutdown?

I checked on another installation of webvirtmgr and the type is always "network". Even if the VM is running. It seems like my Webvirtmgr is change the type from "network" to "bridge". Maybe this causes trouble when libvirt-bin is restarted?

<!-- gh-comment-id:43213879 --> @AlexH-HankIT commented on GitHub (May 15, 2014): Maybe i got something: If the machine is running, the network config in the xml file looks like this: http://pastebin.com/TF4B9rPa If the machine is shutdown it looks like this: http://pastebin.com/hPYkhtB5 Why is the interface type "bridge" while the machine is running and "network" if it's shutdown? I checked on another installation of webvirtmgr and the type is always "network". Even if the VM is running. It seems like my Webvirtmgr is change the type from "network" to "bridge". Maybe this causes trouble when libvirt-bin is restarted?
Author
Owner

@retspen commented on GitHub (May 15, 2014):

You can use network type: network or bridge. When you use type: network you need to choose 'Network Pool', for type: bridge need to choose interface device like br0 (bridge configuration).

Maybe you have wrong bridge settings. http://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29

<!-- gh-comment-id:43215008 --> @retspen commented on GitHub (May 15, 2014): You can use network type: network or bridge. When you use type: network you need to choose 'Network Pool', for type: bridge need to choose interface device like br0 (bridge configuration). Maybe you have wrong bridge settings. http://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29
Author
Owner

@AlexH-HankIT commented on GitHub (May 15, 2014):

Hm, thats weird. I'm always using a bridged configuration and yet the other system says "network" as interface type. Something like this:
http://pastebin.com/0ZY5mmAC

The interface type is always "network" even if it's bridged. Only my webvirtmgr is changing from network to bridge. I think I will just reinstall the KVM Host and Webvirtmgr and hope for the best.

Many thanks for your help. Just send you a donation :)

<!-- gh-comment-id:43218199 --> @AlexH-HankIT commented on GitHub (May 15, 2014): Hm, thats weird. I'm always using a bridged configuration and yet the other system says "network" as interface type. Something like this: http://pastebin.com/0ZY5mmAC The interface type is always "network" even if it's bridged. Only my webvirtmgr is changing from network to bridge. I think I will just reinstall the KVM Host and Webvirtmgr and hope for the best. Many thanks for your help. Just send you a donation :)
Author
Owner

@retspen commented on GitHub (May 16, 2014):

Thanks! WebVirtMgr can't change xml automatically this do libvirt.

<!-- gh-comment-id:43298980 --> @retspen commented on GitHub (May 16, 2014): Thanks! WebVirtMgr can't change xml automatically this do libvirt.
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#240
No description provided.