You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/11/12 12:10:32 UTC

[GitHub] [cloudstack] nlindblo opened a new issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

nlindblo opened a new issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468


   This issue was already reported 5 years ago in https://issues.apache.org/jira/browse/CLOUDSTACK-8680 , but appears to not have been addressed. RabbitMQ message still comes through as json that is not correctly formatted
   
   ##### ISSUE TYPE
   
    * Bug Report
   
   
   ##### COMPONENT NAME
   <!--
   Events
   -->
   
   ##### CLOUDSTACK VERSION
   <!--
   4.14
   -->
   
   ~~~
   
   ~~~
   
   ##### CONFIGURATION
   Cloudstack 4.14 on Ubuntu 16.04, RabbitMQ 3.8.7
   
   
   ##### OS / ENVIRONMENT
   N/A
   
   
   ##### SUMMARY
   RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly. Below is an example:
   
   
   ##### STEPS TO REPRODUCE
   
   Sample message in RabbbitMQ:
   
     "cmdInfo": "{\"response\":\"json\",\"id\":\"b780c229-7064-47e5-97d0-a8b4590b36b8\",\"sessionkey\":\"WY6E5WuM8SbqMw4bCumnVgGsgEQ\\u003d\",\"ctxDetails\":\"{\\\"com.cloud.vm.VirtualMachine\\\":\\\"b780c229-7064-47e5-97d0-a8b4590b36b8\\\"}\",\"cmdEventType\":\"VM.DESTROY\",\"ctxUserId\":\"2\",\"httpmethod\":\"GET\",\"_\":\"1438027779033\",\"uuid\":\"b780c229-7064-47e5-97d0-a8b4590b36b8\",\"ctxAccountId\":\"2\",\"ctxStartEventId\":\"6282\"}",
   
     "instanceType": "VirtualMachine",
   
     "instanceUuid": "b780c229-7064-47e5-97d0-a8b4590b36b8",
   
     "jobId": "61a62e5d-61ee-41eb-b947-0f8ef5d857c3",
   
     "status": "SUCCEEDED",
   
     "processStatus": "0",
   
     "commandEventType": "VM.DESTROY",
   
     "resultCode": "0",
   
     "command": "org.apache.cloudstack.api.command.admin.vm.DestroyVMCmdByAdmin",
   
     "jobResult": "org.apache.cloudstack.api.response.UserVmResponse/virtualmachine/{\"id\":\"b780c229-7064-47e5-97d0-a8b4590b36b8\",\"name\":\"yz-x1\",\"displayname\":\"yz-x1\",\"account\":\"admin\",\"domainid\":\"994ff03e-bb8f-11e4-b7d5-36d1d14da5e9\",\"domain\":\"ROOT\",\"created\":\"2015-07-27T12:01:12-0500\",\"state\":\"Destroyed\",\"haenable\":false,\"zoneid\":\"1b0b4859-7b8a-41dd-8522-4dbf24345509\",\"zonename\":\"sjlab\",\"templateid\":\"e6fa410f-4bf0-4b3c-9982-9d60e7ffc07e\",\"templatename\":\"Base\",\"templatedisplaytext\":\"Base with 32 GB root and cloud-init\",\"passwordenabled\":false,\"serviceofferingid\":\"11a5e901-bc78-45c6-8b81-a2a9e3530164\",\"serviceofferingname\":\"1CPU@1.0Ghz@1.5GB\",\"cpunumber\":1,\"cpuspeed\":1000,\"memory\":1536,\"cpuused\":\"0.56%\",\"networkkbsread\":0,\"networkkbswrite\":2,\"diskkbsread\":2670,\"diskkbswrite\":163,\"diskioread\":0,\"diskiowrite\":0,\"guestosid\":\"a0c75a5b-bb8f-11e4-b7d5-36d1d14da5e9\",\"rootdeviceid\":0,\"rootdevicetype\"
 :\"ROOT\",\"securitygroup\":[{\"id\":\"ad13aa78-bb8f-11e4-b7d5-36d1d14da5e9\",\"name\":\"default\",\"description\":\"Default Security Group\",\"account\":\"admin\",\"ingressrule\":[],\"egressrule\":[],\"tags\":[]}],\"nic\":[{\"id\":\"1c87d7e1-f8c9-425e-809d-7edd1a30c3a6\",\"networkid\":\"abe603fe-1d8b-4b23-9aa2-0234f18de686\",\"networkname\":\"vlan106\",\"netmask\":\"255.255.255.0\",\"gateway\":\"10.0.106.1\",\"ipaddress\":\"10.0.106.170\",\"isolationuri\":\"vlan://106\",\"broadcasturi\":\"vlan://106\",\"traffictype\":\"Guest\",\"type\":\"Shared\",\"isdefault\":true,\"macaddress\":\"06:d9:2e:00:03:f6\"}],\"hypervisor\":\"XenServer\",\"instancename\":\"i-2-346-VM\",\"tags\":[],\"details\":{\"hypervisortoolsversion\":\"xenserver56\"},\"affinitygroup\":[],\"displayvm\":true,\"isdynamicallyscalable\":true,\"ostypeid\":206,\"jobid\":\"61a62e5d-61ee-41eb-b947-0f8ef5d857c3\",\"jobstatus\":0}",
   
     "account": "ad11bb05-bb8f-11e4-b7d5-36d1d14da5e9",
   
     "user": "ad129c91-bb8f-11e4-b7d5-36d1d14da5e9"
   
   }
   
   
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   
   There are two problems for above example:
   1. The nested data structures are not parsed properly. As you can see, values for both “cmdInfo” and “jobResult” are strings instead of nested hash. I have to make additional calls to JSON parser on those values to parse them.
   2. The string "org.apache.cloudstack.api.response.UserVmResponse/virtualmachine/“ at the beginning of the value for “jobResult” makes this value invalid to be parsed as JSON object at all.
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   
   ~~~
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nlindblo commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
nlindblo commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-730022330


   No, the issue refers to the message being received from RabbitMQ when configuring CS to publish events to AMQP. I have worked around it for the time being by fixing the json string in code before its parsed by my consumer (Stackstorm Sensor).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-726057309


   I'm not sure what a fix will be (yet), so cannot tell when it'll be merged. As for fixing the output, that would be extracting the "jobResult" value and fixing it. so checking if it starts with an unterminated string and inserting a double quote at the right spot.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland edited a comment on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
DaanHoogland edited a comment on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-726048846


   ad 1) in the above the escapes of the '"' are lost
   ad 2) the string for the url is actually not closed with a '\"', which might be the root cause of this issue.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland edited a comment on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
DaanHoogland edited a comment on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-726048846


   ad 1) in the above the escapes of the '"' are lost
   ad 2) the string for the url is actually not closed with a '\\"', which might be the root cause of this issue.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] ravening commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
ravening commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-729787297


   @nlindblo I am reading the VM.CREATE response using `listEvents` api from an external application and able to parse it fine. Are you directly parsing it from log file?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd closed issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
rhtyd closed issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-919901305


   > Ping @sureshanaparti are you looking into it?
   
   yes @rhtyd , raised the PR.
   
   The nested data structures for “cmdInfo” and “jobResult” can be  parsed properly. The string value at the beginning of “jobResult” (example: "org.apache.cloudstack.api.response.UserVmResponse/virtualmachine/“) is moved to jobResult under parameters class and object. (in case of example mentioned => class : org.apache.cloudstack.api.response.UserVmResponse and object: virtualmachine).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
rhtyd commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-918867051


   Ping @sureshanaparti are you looking into it? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-726048846


   ad 1) in the above the escapes of the '"' are lost
   ad 2) the string for the url is actually not closed with a '"', which might be the root cause of this issue.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nlindblo commented on issue #4468: RabbitMQ event message for VM.CREATE and VM.DESTROY events can't be parsed cleanly.

Posted by GitBox <gi...@apache.org>.
nlindblo commented on issue #4468:
URL: https://github.com/apache/cloudstack/issues/4468#issuecomment-726055516


   Is there anywhere I can fix the output on the Cloudstack side as a workaround, or do I need to wait for the bug to be fixed and released ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org