Bug #2773

XML to JSON conversion has some problems with empty elements

Added by Carlos Martín over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:03/11/2014
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

0%

Category:Client API & Library
Target version:Release 4.6
Resolution:fixed Pull request:
Affected Versions:Development

Description

This xml has an empty HISTORY_ELEMENTS, but the json contains a string. It is the last string found, copied from user template / sched message.

This seems to cause some problems in the sunstone JS.

  <VM>
    <ID>0</ID>
    <UID>0</UID>
    <GID>0</GID>
    <UNAME>oneadmin</UNAME>
    <GNAME>oneadmin</GNAME>
    <NAME>ttylinux-0</NAME>
    <PERMISSIONS>
      <OWNER_U>1</OWNER_U>
      <OWNER_M>1</OWNER_M>
      <OWNER_A>0</OWNER_A>
      <GROUP_U>0</GROUP_U>
      <GROUP_M>0</GROUP_M>
      <GROUP_A>0</GROUP_A>
      <OTHER_U>0</OTHER_U>
      <OTHER_M>0</OTHER_M>
      <OTHER_A>0</OTHER_A>
    </PERMISSIONS>
    <LAST_POLL>0</LAST_POLL>
    <STATE>1</STATE>
    <LCM_STATE>0</LCM_STATE>
    <RESCHED>0</RESCHED>
    <STIME>1394534173</STIME>
    <ETIME>0</ETIME>
    <DEPLOY_ID/>
    <MEMORY>0</MEMORY>
    <CPU>0</CPU>
    <NET_TX>0</NET_TX>
    <NET_RX>0</NET_RX>
    <TEMPLATE>
      <AUTOMATIC_REQUIREMENTS><![CDATA[!(PUBLIC_CLOUD = YES)]]></AUTOMATIC_REQUIREMENTS>
      <CPU><![CDATA[0.1]]></CPU>
      <DISK>
        <CLONE><![CDATA[YES]]></CLONE>
        <CLONE_TARGET><![CDATA[SYSTEM]]></CLONE_TARGET>
        <DATASTORE><![CDATA[default]]></DATASTORE>
        <DATASTORE_ID><![CDATA[1]]></DATASTORE_ID>
        <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
        <DISK_ID><![CDATA[0]]></DISK_ID>
        <DRIVER><![CDATA[raw]]></DRIVER>
        <IMAGE><![CDATA[ttylinux]]></IMAGE>
        <IMAGE_ID><![CDATA[12]]></IMAGE_ID>
        <IMAGE_UNAME><![CDATA[oneadmin]]></IMAGE_UNAME>
        <LN_TARGET><![CDATA[NONE]]></LN_TARGET>
        <READONLY><![CDATA[NO]]></READONLY>
        <SAVE><![CDATA[NO]]></SAVE>
        <SIZE><![CDATA[40]]></SIZE>
        <SOURCE><![CDATA[/var/lib/one//datastores/1/490701a470c4f6a4ea464ac604c577d3]]></SOURCE>
        <TARGET><![CDATA[hda]]></TARGET>
        <TM_MAD><![CDATA[shared]]></TM_MAD>
        <TYPE><![CDATA[FILE]]></TYPE>
      </DISK>
      <GRAPHICS>
        <LISTEN><![CDATA[0.0.0.0]]></LISTEN>
        <PORT><![CDATA[5900]]></PORT>
        <TYPE><![CDATA[vnc]]></TYPE>
      </GRAPHICS>
      <MEMORY><![CDATA[128]]></MEMORY>
      <NIC>
        <BRIDGE><![CDATA[virbr0]]></BRIDGE>
        <IP><![CDATA[192.168.122.2]]></IP>
        <IP6_LINK><![CDATA[fe80::400:c0ff:fea8:7a02]]></IP6_LINK>
        <MAC><![CDATA[02:00:c0:a8:7a:02]]></MAC>
        <NETWORK><![CDATA[ranged]]></NETWORK>
        <NETWORK_ID><![CDATA[0]]></NETWORK_ID>
        <NIC0BLACK_TCP_TYPE><![CDATA[BLACK_PORTS_TCP]]></NIC0BLACK_TCP_TYPE>
        <NIC0BLACK_UDP_TYPE><![CDATA[BLACK_PORTS_UDP]]></NIC0BLACK_UDP_TYPE>
        <NIC0ICMP_TYPE><![CDATA[ICMP]]></NIC0ICMP_TYPE>
        <NIC0WHITE_TCP_TYPE><![CDATA[WHITE_PORTS_TCP]]></NIC0WHITE_TCP_TYPE>
        <NIC0WHITE_UDP_TYPE><![CDATA[WHITE_PORTS_UDP]]></NIC0WHITE_UDP_TYPE>
        <NIC_ID><![CDATA[0]]></NIC_ID>
        <VLAN><![CDATA[NO]]></VLAN>
      </NIC>
      <TEMPLATE_ID><![CDATA[0]]></TEMPLATE_ID>
      <VMID><![CDATA[0]]></VMID>
    </TEMPLATE>
    <USER_TEMPLATE>
      <SCHED_MESSAGE><![CDATA[Tue Mar 11 11:45:37 2014 : No hosts enabled to run VMs]]></SCHED_MESSAGE>
    </USER_TEMPLATE>
    <HISTORY_RECORDS/>
  </VM>
      "VM":[
         {
            "ID":"0",
            "UID":"0",
            "GID":"0",
            "UNAME":"oneadmin",
            "GNAME":"oneadmin",
            "NAME":"ttylinux-0",
            "PERMISSIONS":{
               "OWNER_U":"1",
               "OWNER_M":"1",
               "OWNER_A":"0",
               "GROUP_U":"0",
               "GROUP_M":"0",
               "GROUP_A":"0",
               "OTHER_U":"0",
               "OTHER_M":"0",
               "OTHER_A":"0" 
            },
            "LAST_POLL":"0",
            "STATE":"1",
            "LCM_STATE":"0",
            "RESCHED":"0",
            "STIME":"1394534173",
            "ETIME":"0",
            "DEPLOY_ID":"0",
            "MEMORY":"0",
            "CPU":"0",
            "NET_TX":"0",
            "NET_RX":"0",
            "TEMPLATE":{
               "AUTOMATIC_REQUIREMENTS":"!(PUBLIC_CLOUD = YES)",
               "CPU":"0.1",
               "DISK":{
                  "CLONE":"YES",
                  "CLONE_TARGET":"SYSTEM",
                  "DATASTORE":"default",
                  "DATASTORE_ID":"1",
                  "DEV_PREFIX":"hd",
                  "DISK_ID":"0",
                  "DRIVER":"raw",
                  "IMAGE":"ttylinux",
                  "IMAGE_ID":"12",
                  "IMAGE_UNAME":"oneadmin",
                  "LN_TARGET":"NONE",
                  "READONLY":"NO",
                  "SAVE":"NO",
                  "SIZE":"40",
                  "SOURCE":"/var/lib/one//datastores/1/490701a470c4f6a4ea464ac604c577d3",
                  "TARGET":"hda",
                  "TM_MAD":"shared",
                  "TYPE":"FILE" 
               },
               "GRAPHICS":{
                  "LISTEN":"0.0.0.0",
                  "PORT":"5900",
                  "TYPE":"vnc" 
               },
               "MEMORY":"128",
               "NIC":{
                  "BRIDGE":"virbr0",
                  "IP":"192.168.122.2",
                  "IP6_LINK":"fe80::400:c0ff:fea8:7a02",
                  "MAC":"02:00:c0:a8:7a:02",
                  "NETWORK":"ranged",
                  "NETWORK_ID":"0",
                  "NIC0BLACK_TCP_TYPE":"BLACK_PORTS_TCP",
                  "NIC0BLACK_UDP_TYPE":"BLACK_PORTS_UDP",
                  "NIC0ICMP_TYPE":"ICMP",
                  "NIC0WHITE_TCP_TYPE":"WHITE_PORTS_TCP",
                  "NIC0WHITE_UDP_TYPE":"WHITE_PORTS_UDP",
                  "NIC_ID":"0",
                  "VLAN":"NO" 
               },
               "TEMPLATE_ID":"0",
               "VMID":"0" 
            },
            "USER_TEMPLATE":{
               "SCHED_MESSAGE":"Tue Mar 11 11:42:37 2014 : No hosts enabled to run VMs" 
            },
            "HISTORY_RECORDS":"Tue Mar 11 11:42:37 2014 : No hosts enabled to run VMs" 
         }]

History

#1 Updated by Ruben S. Montero over 7 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF