ContainX / openstack4j

A Fluent OpenStack SDK / Client Library for Java
http://openstack4j.com
Other
290 stars 367 forks source link

cannot create HostAggregate #823

Open Cherry522 opened 8 years ago

Cherry522 commented 8 years ago

I cannot create new HostAggregate.......

openstack version M. openstack4j version 3.0.2

my code: HostAggregate hostAggregate = osClient.compute().hostAggregates() .create(name,availabilityZone);

Getting the following error: 10:57:26.177 [main] DEBUG org.apache.http.headers - >> POST /v2.1/os-aggregates HTTP/1.1 10:57:26.177 [main] DEBUG org.apache.http.headers - >> X-Auth-Token: gAAAAABX4fcV9Mvx0GaslH6iO0RNjGl6u_llrpTGrYpLfVdGNg3nOOkPBVzscFhIW7aXNx5gUSacS6Sokj5hP4gAQXF8BkaoAP-lmvwmriTnvSSG1I_k8HB_jmXpIjepXWviTtdfx9mzEqBTMcmC3WRtgXW8yPaU8A 10:57:26.177 [main] DEBUG org.apache.http.headers - >> User-Agent: OpenStack4j / OpenStack Client 10:57:26.177 [main] DEBUG org.apache.http.headers - >> Content-Length: 130 10:57:26.177 [main] DEBUG org.apache.http.headers - >> Content-Type: application/json 10:57:26.177 [main] DEBUG org.apache.http.headers - >> Host: 10.42.23.22:8774 10:57:26.177 [main] DEBUG org.apache.http.headers - >> Connection: Keep-Alive 10:57:26.177 [main] DEBUG org.apache.http.wire - >> "{[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " "aggregate" : {[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " "deleted" : false,[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " "name" : "aaa",[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " "avaiablityZone" : "bbb",[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " "availability_zone" : "bbb"[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> " }[\n]" 10:57:26.177 [main] DEBUG org.apache.http.wire - >> "}" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "HTTP/1.1 400 Bad Request[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "X-Openstack-Nova-Api-Version: 2.1[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "Vary: X-OpenStack-Nova-API-Version[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "Content-Type: application/json; charset=UTF-8[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "Content-Length: 276[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "X-Compute-Request-Id: req-222980bf-40a8-4205-a627-6cdd03a029ef[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "Date: Wed, 21 Sep 2016 02:57:26 GMT[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "Connection: close[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.wire - << "[\r][\n]" 10:57:26.229 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Receiving response: HTTP/1.1 400 Bad Request 10:57:26.229 [main] DEBUG org.apache.http.headers - << HTTP/1.1 400 Bad Request 10:57:26.229 [main] DEBUG org.apache.http.headers - << X-Openstack-Nova-Api-Version: 2.1 10:57:26.229 [main] DEBUG org.apache.http.headers - << Vary: X-OpenStack-Nova-API-Version 10:57:26.229 [main] DEBUG org.apache.http.headers - << Content-Type: application/json; charset=UTF-8 10:57:26.229 [main] DEBUG org.apache.http.headers - << Content-Length: 276 10:57:26.229 [main] DEBUG org.apache.http.headers - << X-Compute-Request-Id: req-222980bf-40a8-4205-a627-6cdd03a029ef 10:57:26.229 [main] DEBUG org.apache.http.headers - << Date: Wed, 21 Sep 2016 02:57:26 GMT 10:57:26.229 [main] DEBUG org.apache.http.headers - << Connection: close 10:57:26.233 [main] DEBUG org.apache.http.wire - << "{"badRequest": {"message": "Invalid input for field/attribute aggregate. Value: {u'deleted': False, u'name': u'aaa', u'avaiablityZone': u'bbb', u'availability_zone': u'bbb'}. Additional properties are not allowed (u'deleted', u'avaiablityZone' were unexpected)", "code": 400}}"

liangxianlong commented 7 years ago

hello, I got the same error,can you solve the problem??and how??

vinodborole commented 7 years ago

@Cherry522 Can you try the latest snapshot version; the model class does not have the parameters that are seen in your debug log.

https://github.com/ContainX/openstack4j/blob/ac15d6cbc3a4c2d927c91ed3691a9c60262f9b45/core/src/main/java/org/openstack4j/openstack/compute/domain/NovaHostAggregateCreate.java

liangxianlong commented 7 years ago

@vinodborole ,we use the old version

vinodborole commented 7 years ago

As you are using Mitaka, i would suggest you to upgrade o4j version as well, this would make it compatible.