Bug 1045350 - REST error during VM creation via API
Summary: REST error during VM creation via API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-api
Version: 3.3
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
: 3.4.0
Assignee: Juan Hernández
QA Contact: Ondra Machacek
URL:
Whiteboard: infra
Depends On:
Blocks: 1024889
TreeView+ depends on / blocked
 
Reported: 2013-12-20 08:46 UTC by Sven Kieske
Modified: 2014-03-31 12:32 UTC (History)
7 users (show)

Fixed In Version: ovirt-3.4.0-alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-31 12:32:38 UTC
oVirt Team: ---
Embargoed:


Attachments (Terms of Use)
engine.log (12.21 KB, text/plain)
2013-12-20 08:46 UTC, Sven Kieske
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 20704 0 None None None Never

Description Sven Kieske 2013-12-20 08:46:12 UTC
Created attachment 839449 [details]
engine.log

Description of problem:
When you create a VM via REST-API

Version-Release number of selected component (if applicable):

ovirt-engine 3.3.2-1.el6

How reproducible:
POST request on https://virt-mgmt-01.internal/api/vms/:
{"name":"vr00001","cluster":{"id":"2ad11b5e-9e74-499a-b317-5a9a3027cfca","name":"localcluster1"},"template":{"id":"10080414-d017-490b-b212-e02cee6a7b6e","name":"ubuntu-server-12.04"},"console":{"enabled":true}}


Steps to Reproduce:
1.
2.
3.

Actual results:

<h1>HTTP Status 500 - org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.ovirt.engine.api.model.VM[&quot;console&quot;])</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.ovirt.engine.api.model.VM[&quot;console&quot;])</u></p><p><b>description</b> <u>The server encountered an internal error (org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.ovirt.engine.api.model.VM[&quot;console&quot;])) that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.13.Final</h3>

Expected results:

HTTP 201 OK with the vm data

Additional info:


the error code is wrong, the vm gets actually created (see attached engine.log)

Comment 1 Sven Kieske 2013-12-20 08:49:26 UTC
Sorry, the Description of the problem was incomplete:

Description of problem:
When you create a VM via REST-API, it get's successfully created, but you
get a Java Exception as answer and no expected HTTP 201 OK with the VM
Data you just submitted.

Comment 2 Sven Kieske 2014-01-02 13:04:14 UTC
This is an error in the API Implementation of 3.3. why is the target release
of the fix 3.4. ?

Comment 3 Juan Hernández 2014-01-02 13:29:01 UTC
Sven, this is a side effect of a known problem with RESTEasy JSON serialization. JSON serialization support is experimental at the moment (including 3.3.2) and will be fully supported starting with 3.4. The changes done for 3.4 will fix this particular problem. However they will also introduce changes to the names of many properties: all those that contain more than one word separated by underscores in the XML representation. For example if you are creating a VM using the "deleteProtected" property you will have to change your code to use
"delete_protected" instead.

Comment 4 Sandro Bonazzola 2014-01-13 13:56:50 UTC
oVirt 3.4.0 alpha has been released including the fix for this issue.

Comment 5 Ondra Machacek 2014-02-17 17:00:29 UTC
curl -k -X POST -H "Accept: application/json" -H "Content-Type: 
application/json" -d "@json_vm" -u $ADMIN $URL/vms

json_vm:
{"name":"test_vm2","cluster":{"id":"4200f114-f2d7-4711-994b-d29e525fc4fc", "name": "cl34"},"template":{"id":"00000000-0000-0000-0000-000000000000", "name": "Blank"},"console":{"enabled":true}}

output:
{
  "type" : "desktop",
  "status" : {
    "state" : "down"
  },
  "memory" : 1073741824,
  "cpu" : {
    "topology" : {
      "sockets" : "1",
      "cores" : "1"
    },
    "architecture" : "X86_64"
  },
  "cpu_shares" : "0",
  "os" : {
    "boot" : [ {
      "dev" : "hd"
    } ],
    "type" : "other"
  },
  "high_availability" : {
    "enabled" : false,
    "priority" : "0"
  },
  "display" : {
    "type" : "vnc",
    "monitors" : "1",
    "single_qxl_pci" : false,
    "allow_override" : false,
    "smartcard_enabled" : false
  },
  "cluster" : {
    "href" : "/ovirt-engine/api/clusters/4200f114-f2d7-4711-994b-d29e525fc4fc",
    "id" : "4200f114-f2d7-4711-994b-d29e525fc4fc"
  },
  "template" : {
    "href" : "/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000",
    "id" : "00000000-0000-0000-0000-000000000000"
  },
  "stop_time" : 1392656267945,
  "creation_time" : 1392656267943,
  "origin" : "ovirt",
  "stateless" : false,
  "delete_protected" : false,
  "sso" : {
    "methods" : {
      "method" : [ {
        "id" : "GUEST_AGENT"
      } ]
    }
  },
  "console" : {
    "enabled" : true
  },
  "initialization" : {
    "domain" : "",
    "regenerate_ssh_keys" : false,
    "nic_configurations" : { }
  },
  "placement_policy" : {
    "affinity" : "migratable"
  },
  "memory_policy" : {
    "guaranteed" : 1073741824,
    "ballooning" : true
  },
  "usb" : {
    "enabled" : false
  },
  "migration_downtime" : "-1",
  "virtio_scsi" : {
    "enabled" : true
  },
  "actions" : {
    "link" : [ {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/ticket",
      "rel" : "ticket"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/migrate",
      "rel" : "migrate"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/reboot",
      "rel" : "reboot"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/cancelmigration",
      "rel" : "cancelmigration"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/shutdown",
      "rel" : "shutdown"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/start",
      "rel" : "start"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/suspend",
      "rel" : "suspend"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/stop",
      "rel" : "stop"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/detach",
      "rel" : "detach"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/export",
      "rel" : "export"
    }, {
      "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/move",
      "rel" : "move"
    } ]
  },
  "name" : "test_vm2",
  "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8",
  "id" : "f23baac6-e916-47d1-84ab-da0d373cd7a8",
  "link" : [ {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/applications",
    "rel" : "applications"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/disks",
    "rel" : "disks"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/nics",
    "rel" : "nics"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/cdroms",
    "rel" : "cdroms"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/snapshots",
    "rel" : "snapshots"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/tags",
    "rel" : "tags"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/permissions",
    "rel" : "permissions"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/statistics",
    "rel" : "statistics"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/reporteddevices",
    "rel" : "reporteddevices"
  }, {
    "href" : "/ovirt-engine/api/vms/f23baac6-e916-47d1-84ab-da0d373cd7a8/watchdogs",
    "rel" : "watchdogs"
  } ]
}

Comment 6 Sandro Bonazzola 2014-03-31 12:32:38 UTC
this is an automated message: moving to Closed CURRENT RELEASE since oVirt 3.4.0 has been released


Note You need to log in before you can comment on or make changes to this bug.