Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"guest" gadget failure #23

Open
AdUser opened this issue Sep 11, 2012 · 6 comments
Open

"guest" gadget failure #23

AdUser opened this issue Sep 11, 2012 · 6 comments

Comments

@AdUser
Copy link
Contributor

AdUser commented Sep 11, 2012

karesansui/application.log:

[ERROR] [22164] [karesansui.rest] [295] "gadget" execution error - karesansui.gadget.guest.Guest
[DEBUG] [22164] [karesansui.processor.pysilhouette] [244] Pysilhouette database session scope [rollback] : HTTP Status= - 500 Internal Server Error
[DEBUG] [22164] [karesansui.processor.karesansui] [192] Karesansui database session scope [rollback] : HTTP Status= - 500 Internal Server Error

daemon stderr:

INFO sqlalchemy.engine.base.Engine SELECT machine.id AS machine_id, machine.parent_id AS machine_parent_id, machine.notebook_id AS machine_notebook_id, machine.created_user_id AS machine_created_user_id, machine.modified_user_id AS machine_modified_user_id, machine.uniq_key AS machine_uniq_key, machine.name AS machine_name, machine.attribute AS machine_attribute, machine.hypervisor AS machine_hypervisor, machine.hostname AS machine_hostname, machine.icon AS machine_icon, machine.is_deleted AS machine_is_deleted, machine.created AS machine_created, machine.modified AS machine_modified 
FROM machine 
WHERE machine.id = ? AND (machine.attribute = ? OR machine.attribute = ?) AND machine.is_deleted = ?
 LIMIT ? OFFSET ?
INFO sqlalchemy.engine.base.Engine (3, 0, 2, 0, 1, 0)
INFO sqlalchemy.engine.base.Engine SELECT machine.id AS machine_id, machine.parent_id AS machine_parent_id, machine.notebook_id AS machine_notebook_id, machine.created_user_id AS machine_created_user_id, machine.modified_user_id AS machine_modified_user_id, machine.uniq_key AS machine_uniq_key, machine.name AS machine_name, machine.attribute AS machine_attribute, machine.hypervisor AS machine_hypervisor, machine.hostname AS machine_hostname, machine.icon AS machine_icon, machine.is_deleted AS machine_is_deleted, machine.created AS machine_created, machine.modified AS machine_modified 
FROM machine 
WHERE machine.parent_id = ? AND machine.attribute = ? AND machine.is_deleted = ?
INFO sqlalchemy.engine.base.Engine (3, 1, 0)
INFO sqlalchemy.engine.base.Engine ROLLBACK
"HTTP/1.1 GET /karesansui/v3/host/3/guest.part" - 500 Internal Server Error

output in browser:

Illegal error. Execution errors.

Error origin are near this line: karesansui/lib/rest.py:296

libvirt has one test domain, defined via virsh.

How to debug this?

P.S. Now i use latest git version. System is the same: Debian 7.0.

@taizo
Copy link
Contributor

taizo commented Sep 12, 2012

Hi,

it is definitely the bug of PyXML.
'as' is a reserved keyword in Python 2.6.

Could you try the patch below?

--- PyXML-0.8.4/xml/xpath/ParsedAbbreviatedRelativeLocationPath.py.orig 2010-04-15 22:09:02.000000000 +0900
+++ PyXML-0.8.4/xml/xpath/ParsedAbbreviatedRelativeLocationPath.py  2010-04-15 22:09:26.000000000 +0900
@@ -28,8 +28,8 @@
         self._right = right
         nt = ParsedNodeTest.ParsedNodeTest('node','')
         ppl = ParsedPredicateList.ParsedPredicateList([])
-        as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
-        self._middle = ParsedStep.ParsedStep(as, nt, ppl)
+        _as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
+        self._middle = ParsedStep.ParsedStep(_as, nt, ppl)
 
     def evaluate(self, context):
         res = []
--- PyXML-0.8.4/xml/xpath/ParsedAbbreviatedAbsoluteLocationPath.py.orig 2010-04-15 22:14:57.000000000 +0900
+++ PyXML-0.8.4/xml/xpath/ParsedAbbreviatedAbsoluteLocationPath.py  2010-04-15 22:14:39.000000000 +0900
@@ -24,8 +24,8 @@
         self._rel = rel
         nt = ParsedNodeTest.ParsedNodeTest('node', '')
         ppl = ParsedPredicateList.ParsedPredicateList([])
-        as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
-        self._step = ParsedStep.ParsedStep(as, nt, ppl)
+        _as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
+        self._step = ParsedStep.ParsedStep(_as, nt, ppl)
         return
 
     def evaluate(self, context):

@AdUser
Copy link
Contributor Author

AdUser commented Sep 12, 2012

Similar patch was already applied. Taken from here: https://github.com/karesansui/karesansui/tree/master/sample/patches . Also, i removed all compiled bytecode in package's directory, but the problem still persists.

@taizo
Copy link
Contributor

taizo commented Sep 13, 2012

Then, try to debug the problem by following instructions below.

  1. Insert a line to enable trace (debug) statements into the relevant gadget script.

    In your case, the script must be 'karesansui/gadget/guest.py'. So, you need to insert the following line for debug into _GET() method of Guest class.

    import pdb; pdb.set_trace();
    
  2. Start Karesansui service in web.py's built-in web server mode.

    # su -s /bin/bash kss -c "KARESANSUI_CONF=/etc/karesansui/application.conf SEARCH_PATH= /usr/share/karesansui/bin/karesansui.fcgi"
    
  3. Debug on the terminal in gdb style.
    Head to http://[your_fqdn|your_ipaddr]:8080 in your web browser and attempt to launch the Karesansui console again. Then, it allows you to start debugging.

@AdUser
Copy link
Contributor Author

AdUser commented Sep 13, 2012

Hmm, looks like this is some strange xpath issue.

Error occured at this line:

guest.py:625         path = pool[0].get_info()["target"]["path"]

Error message is:

ImportError: 'cannot import name ExpandedNameWrapper'

But! If i simply launch python console and say "from xml.xpath import ExpandedNameWrapper" it processes without error.

Google says, that this is may be caused by either missing include dir in path, but all looks like normal:

(pdb) import sys
(pdb) print sys.path
['/usr/share/pyshared/site-packages', '/usr/share/pyshared/',
 '/usr/share/karesansui/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '
(Both pyxml and karesansui locates in '/usr/share/pyshared/')

or it may be some name conflict.

`grep -r -n ExpandedNameWrapper karesansui.git/` gives nothing
(debugger stopped at buggy line)
(pdb) import xml # works
(pdb) import xml.xpath # causes error

@taizo
Copy link
Contributor

taizo commented Sep 13, 2012

Hi,

I've installed PyXML by using easy_install command, and then PyXML-0.8.4 has been located in '/usr/local/lib/python2.7/dist-packages'. And Karesansui works well.

It seems that ExpandedNameWrapper is imported from 'PyXML-X.X.X/_xmlplus/xpath/CoreFunctions.py'.

@AdUser
Copy link
Contributor Author

AdUser commented Sep 13, 2012

Good question is half of the answer.

Change in config: application.search.path=/usr/lib/python2.7 and remove SEARCH_PATH from command line solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants