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

Hooks chardata nesting problem #3996

Closed
7 tasks
treywelsh opened this issue Nov 27, 2019 · 2 comments
Closed
7 tasks

Hooks chardata nesting problem #3996

treywelsh opened this issue Nov 27, 2019 · 2 comments

Comments

@treywelsh
Copy link
Contributor

treywelsh commented Nov 27, 2019

Description

I try to parse XML messages from hooks.
So first, it's a nice feature, thank you for this.

Infortunately, it seems that the content of the VALUE field of CALL_INFO ( see xsd) is not permitted by XML rules:

The XML content that I retrieve (after base64 decoding):

<HOOK_MESSAGE><HOOK_TYPE>API</HOOK_TYPE><CALL>one.vmpool.info</CALL><CALL_INFO><RESULT>1</RESULT><PARAMETERS><PARAMETER><POSITION>1</POSITION><TYPE>IN</TYPE><VALUE>****</VALUE></PARAMETER><PARAMETER><POSITION>2</POSITION><TYPE>IN</TYPE><VALUE>-2</VALUE></PARAMETER><PARAMETER><POSITION>3</POSITION><TYPE>IN</TYPE><VALUE>0</VALUE></PARAMETER><PARAMETER><POSITION>4</POSITION><TYPE>IN</TYPE><VALUE>-200</VALUE></PARAMETER><PARAMETER><POSITION>5</POSITION><TYPE>IN</TYPE><VALUE>-1</VALUE></PARAMETER><PARAMETER><POSITION>1</POSITION><TYPE>OUT</TYPE><VALUE>true</VALUE></PARAMETER><PARAMETER><POSITION>2</POSITION><TYPE>OUT</TYPE><VALUE><![CDATA[<VM_POOL><VM><ID>7</ID><UID>0</UID><GID>0</GID><UNAME>oneadmin</UNAME><GNAME>oneadmin</GNAME><NAME>test-7</NAME><LAST_POLL>1574849972</LAST_POLL><STATE>3</STATE><LCM_STATE>36</LCM_STATE><RESCHED>0</RESCHED><STIME>1574846311</STIME><ETIME>0</ETIME><DEPLOY_ID></DEPLOY_ID><TEMPLATE><CPU>1</CPU><MEMORY>2048</MEMORY><GRAPHICS><LISTEN><![CDATA[0.0.0.0]]></LISTEN><PORT><![CDATA[5907]]></PORT><TYPE><![CDATA[VNC]]></TYPE></GRAPHICS></TEMPLATE><MONITORING><CPU><![CDATA[]]></CPU><MEMORY><![CDATA[]]></MEMORY><STATE><![CDATA[]]></STATE></MONITORING><USER_TEMPLATE></USER_TEMPLATE><HISTORY_RECORDS><HISTORY><OID>7</OID><SEQ>0</SEQ><HOSTNAME><![CDATA[localhost]]></HOSTNAME><HID>0</HID><CID>0</CID><DS_ID>0</DS_ID><ACTION><![CDATA[0]]></ACTION></HISTORY></HISTORY_RECORDS></VM></VM_POOL>]]></VALUE></PARAMETER><PARAMETER><POSITION>3</POSITION><TYPE>OUT</TYPE><VALUE>0</VALUE></PARAMETER></PARAMETERS><EXTRA></EXTRA></CALL_INFO></HOOK_MESSAGE>

The problem:

xmllint --format hook_message_xml 
hook_message_xml:1: parser error : Opening and ending tag mismatch: VALUE line 1 and LISTEN
><CPU>1</CPU><MEMORY>2048</MEMORY><GRAPHICS><LISTEN><![CDATA[0.0.0.0]]></LISTEN>
....

A bit more readable to see where is the problem:

...
<PARAMETER>
<POSITION>2</POSITION>
<TYPE>OUT</TYPE>
<VALUE>
<![CDATA[
  <VM_POOL>
    <VM>
    <ID>7</ID>
    ...
    <TEMPLATE>
    ...
    <GRAPHICS><LISTEN><![CDATA[0.0.0.0]]></LISTEN>  <---- This close the <![CDATA tag
    ...
    </VM>
  </VM_POOL>
]]>
</VALUE>
...

I also tried to unmarshal with xml golang package, same issue happen.

The first ]]> is seen as the end of the first opened chardata section.

I just displayed VM lists in sunstone (in a minione deployed environment).
The ONE version is 5.9, I'll try on 5.10 asap if I can deploy it in minione.

It seems that the problem is: CDATA sections cannot nest.
See: https://www.w3.org/TR/xml/

To Reproduce
Subscribe to API hook events, then try to parse the message.

Expected behavior
We should be able to parse the content via XML tools.

Details

  • Version 5.9

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches
@xorel
Copy link
Member

xorel commented Nov 27, 2019

Just a side note, you can already install 5.10 using minione, but you need to pass --force arg.
Like minione --version 5.10 --force. Update is on the way.

christian7007 pushed a commit to christian7007/one that referenced this issue Nov 27, 2019
christian7007 pushed a commit to christian7007/docs that referenced this issue Nov 27, 2019
christian7007 pushed a commit to christian7007/docs that referenced this issue Nov 27, 2019
@christian7007
Copy link
Contributor

The bug is also present in 5.10. The fix is in #3997.

Thanks for the feedback @treywelsh!

rsmontero pushed a commit to OpenNebula/docs that referenced this issue Nov 29, 2019
rsmontero pushed a commit to OpenNebula/docs that referenced this issue Nov 29, 2019
rsmontero pushed a commit to OpenNebula/docs that referenced this issue Nov 29, 2019
tinova pushed a commit to OpenNebula/docs that referenced this issue Dec 4, 2019
* M #-: Update Docker Machine app. name (#849)
* B OpenNebula/one#3996: Add it to known issues (#847)
* B OpenNebula/one#4005: Add it to known issues
* M #-: Change addon catalog reference
Not hosted in opennebula.org any longer, but rather on
GitHub wiki

* B OpenNebula/one#4002 Update known issues (#854)
* Fixes in intro_release_notes for English, spelling, etc.

Signed-off-by: Dave Love <dave.love@manchester.ac.uk>
tinova pushed a commit to OpenNebula/docs that referenced this issue Dec 4, 2019
* M #-: Update Docker Machine app. name (#849)
* B OpenNebula/one#3996: Add it to known issues (#847)
* B OpenNebula/one#4005: Add it to known issues
* M #-: Change addon catalog reference
Not hosted in opennebula.org any longer, but rather on
GitHub wiki

* B OpenNebula/one#4002 Update known issues (#854)
* Fixes in intro_release_notes for English, spelling, etc.

Signed-off-by: Dave Love <dave.love@manchester.ac.uk>
(cherry picked from commit c5582cc)
tinova pushed a commit to OpenNebula/docs that referenced this issue Dec 4, 2019
* M #-: Update Docker Machine app. name (#849)
* B OpenNebula/one#3996: Add it to known issues (#847)
* B OpenNebula/one#4005: Add it to known issues
* M #-: Change addon catalog reference
Not hosted in opennebula.org any longer, but rather on
GitHub wiki

* B OpenNebula/one#4002 Update known issues (#854)
* Fixes in intro_release_notes for English, spelling, etc.

Signed-off-by: Dave Love <dave.love@manchester.ac.uk>
(cherry picked from commit c5582cc)
(cherry picked from commit 3701353)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants