Repository navigation
Closed
Labels
bugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
Given
# salt --versions-report
Salt: 2014.7.1
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.4.5
msgpack-pure: 0.1.3
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: 0.9.1
When I try to get more info with virt.full_info
# salt x01 virt.full_info
x01:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1022, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 1076, in full_info
'vm_info': vm_info()}
File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 720, in vm_info
info[vm_] = _info(vm_)
File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 710, in _info
'graphics': get_graphics(vm_),
File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 860, in get_graphics
for key in g_node.attributes:
File "/usr/lib/python2.7/xml/dom/minidom.py", line 522, in __getitem__
return self._attrs[attname_or_tuple]
KeyError: 0
And...
root@x01:/srv/scripts# salt x01 virt.get_graphics wheezy
x01:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1022, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 860, in get_graphics
for key in g_node.attributes:
File "/usr/lib/python2.7/xml/dom/minidom.py", line 522, in __getitem__
return self._attrs[attname_or_tuple]
KeyError: 0
Metadata
Metadata
Assignees
Labels
bugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
jcftang commentedon Jan 29, 2015
Looking at https://github.com/saltstack/salt/blob/v2014.7.1/salt/modules/virt.py#L858, as I understand it, the idea was to set the video card or grab information about it.
In my case the tag should be
jfindlay commentedon Jan 30, 2015
@jcftang, thanks for reporting this.
jcftang commentedon Jan 30, 2015
I may be wrong about the intended behaviour but something is surely subtley broken somewhere.
Galser commentedon Feb 24, 2015
Just a small note, for me this parsing function failing on 2 Hypervisors out of 24, running KVM, when graphics defined is not VNC but spice.
E.g. this is okay , hypervisor 1:
<graphics type='vnc' port='-1' autoport='yes'/>And this is failing , hypervisor 2:
<graphics type='spice' autoport='yes'/>Both are absolutely identical machines in the terms of everything.
Versions :
thequailman commentedon Feb 24, 2015
This is affecting me as well, I can't run any virt commands because of the get_graphics bug. Can I comment it out temporarily? Any workarounds?
jfindlay commentedon Feb 24, 2015
@thequailman, I haven't tested this but you could do
cachedout commentedon Feb 24, 2015
That looks like it is missing a comma. :]
On Tue, Feb 24, 2015 at 11:41 AM, jfindlay [email protected] wrote:
jfindlay commentedon Feb 24, 2015
@cachedout, tests my code for me.
thequailman commentedon Feb 24, 2015
That partially fixed it, I receive a new error now:
If I follow the same suggestion for the get_nics function, the virt the commands work again.
3 remaining items
jfindlay commentedon Feb 24, 2015
@Galser, no prob. I'm glad this haxor workaround is working.
tjstansell commentedon Mar 9, 2015
I ran into this today and cranked up the python debugger and walked through this. It seems to be a type issue:
Notice how the code is trying to loop through the elements, but it needs to use the
keys()oritem()oritems()methods to properly loop through the attributes.This is why we're getting
KeyError: 0since g_node.attributes is not a list, but a minidom object.The following code change fixed it for me:
This was hacked in place on my box running 2014.7.2.
jfindlay commentedon Mar 9, 2015
@tjstansell, awesome, thanks. I will be glad to merge a pull request with these changes against the 2014.7 branch. If you don't have time to get back to this, I can make the changes.
tjstansell commentedon Mar 10, 2015
rallytime commentedon Mar 10, 2015
Awesome! Thanks for pulling that together @vdesjardins!
Merge pull request #21469 from vdesjardins/develop
fixes saltstack#20198: virt.get_graphics and virt.get_nics calls in m…
rallytime commentedon Mar 10, 2015
I've backported this fix in #21487 to the 2014.7 branch, so the fix will be available in the next release of salt.
dsanader commentedon May 16, 2015
The virtualport section of the get_nics function is still broken, the fix is missing the matching part of @tjstansell's suggestion :
For example, the following xml block, still generates the same "KeyError: 0" in salt as mentioned above (looping over v_node.attributes is not possible).
rallytime commentedon May 16, 2015
Good catch @dsanader. I've fixed the virtualport loop in the pull request above.