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

Cannot create Flavors #573

Closed
starbender opened this issue Feb 14, 2016 · 27 comments
Closed

Cannot create Flavors #573

starbender opened this issue Feb 14, 2016 · 27 comments
Labels

Comments

@starbender
Copy link

Looks like there are two properties being sent to Nova to create a Flavor which it doesn't like.
OS-FLV-DISABLED:disabled and public

Getting the following error:
Additional properties are not allowed (u'OS-FLV-DISABLED:disabled', u'public' were unexpected), status=400, status-code=BAD_REQUEST}
Using the following code.

Flavor flavor = os.compute().flavors()
                .create("name",512,1,10,0,0,0f,true);

Connecting to a v2.0 endpoint.

I can't tell if this is a version problem of API I'm connecting to or not.

@lakersan2015
Copy link

version 2.0.9 / 2.10

Additional properties are not allowed (u'OS-FLV-DISABLED:disabled', u'public' were unexpected)

@GoForce5500
Copy link

I've got the same problem in 2.0.9, could anyone tell me if openstack4j supports OpenStack Liberty?

@elikraja
Copy link

elikraja commented May 2, 2016

Same issue using 2.11 version. I'm using Openstack Liberty.

@vinodborole
Copy link
Contributor

@elikraja Are you getting the OSClient with the perspective as ADMIN?

       OSFactory.builder().endpoint(authURL).credentials(username, password).tenantId(tenantID).useNonStrictSSLClient(true).perspective(Facing.ADMIN).authenticate();

@elikraja
Copy link

elikraja commented May 2, 2016

Hi @vinodborole
I wasn't, but nothing changed using the perspective(Facing.ADMIN). I got the same error

@vinodborole
Copy link
Contributor

@elikraja Did you check if you can create the flavor using openstack CLI with the same user?

@elikraja
Copy link

elikraja commented May 2, 2016

Yep, first thing I tested was the creation from CLI.
I also tried the plugin using admin user. Nothing changes

@vinodborole
Copy link
Contributor

@elikraja i am able to create it with o4j. My openstack version is Juno

My code:

 public static OSClient buildACIClient(){
    return OSFactory.builder().endpoint(authURL).credentials(username, password).tenantId(tenantID).useNonStrictSSLClient(true).perspective(Facing.ADMIN).authenticate();
}

private static void createFlavor(OSClient client) {
    Flavor flavor = client.compute().flavors().create("deleteme",512,1,10,0,0,1.0f,true);
    System.out.println(flavor.getId());
}

INFO: 1 * Sending client request on thread main
1 > POST http://10.193.180.230:8774/v2/8be60cc30edc44978d24d51ce5f8d9da/flavors
1 > Accept: application/json
1 > Content-Type: application/json
1 > User-Agent: OpenStack4j / OpenStack Client
1 > X-Auth-Token: 97115bf8a85f41ddb4a203d8f5268e8b
{
"flavor" : {
"name" : "deleteme",
"ram" : 512,
"vcpus" : 1,
"disk" : 10,
"swap" : 0,
"public" : true,
"OS-FLV-EXT-DATA:ephemeral" : 0,
"rxtx_factor" : 1.0,
"OS-FLV-DISABLED:disabled" : false,
"os-flavor-access:is_public" : true
}
}

May 02, 2016 7:32:12 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 2 * Client response received on thread main
2 < 200
2 < Connection: keep-alive
2 < Content-Length: 533
2 < Content-Type: application/json
2 < Date: Mon, 02 May 2016 14:02:12 GMT
2 < X-Compute-Request-Id: req-345c75fa-e688-4f34-9d1e-d0f15bed9260
{"flavor": {"name": "deleteme", "links": [{"href": "http://10.193.180.230:8774/v2/8be60cc30edc44978d24d51ce5f8d9da/flavors/b2d0e9da-566b-4084-b60f-a3aefc9cf5b7", "rel": "self"}, {"href": "http://10.193.180.230:8774/8be60cc30edc44978d24d51ce5f8d9da/flavors/b2d0e9da-566b-4084-b60f-a3aefc9cf5b7", "rel": "bookmark"}], "ram": 512, "OS-FLV-DISABLED:disabled": false, "vcpus": 1, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 10, "id": "b2d0e9da-566b-4084-b60f-a3aefc9cf5b7"}}

@elikraja
Copy link

elikraja commented May 2, 2016

@vinodborole I'm running Liberty. That's probabily the problem

My code is:
`OSClient os = OSFactory.builder().endpoint("http://10.0.10.128:5000/v2.0").credentials("username","password").perspective(Facing.ADMIN).tenantName("tenant").authenticate();

Flavor flavor = os.compute().flavors().create("m1.test", 1024, 10, 10, 4, 0, 1, true);`

The only way to make it works is to add a @JsonIgnore to both methods (isDisabled and isPublic) on NovaFlavor class

@vinodborole
Copy link
Contributor

@elikraja When you run the command using openstack CLI what does your flavor json look like? Can we compare this with the flavor json generated by o4j?

@elikraja
Copy link

elikraja commented May 2, 2016

@vinodborole This is what I get when I run nova flavor-create (getting json from log file)

{"vcpus": 1, "disk": 5, "name": "m1.test2", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "ram": 1024, "id": "7", "swap": 0}

This is the json I get when trying to create flavor from o4j

{'name': 'm1.prova', 'ram': 1024, 'OS-FLV-DISABLED:disabled': False, 'vcpus': 10, 'swap': 0, 'os-flavor-access:is_public': True, 'rxtx_factor': 1.0, 'OS-FLV-EXT-DATA:ephemeral': 0, 'disk': 10, 'public': True}

As you can see, OS-FLV-DISABLED:disabled parameter doesn't exist anymore and the public parameter now is called os-flavor-access:is_public

@vinodborole
Copy link
Contributor

@elikraja Thanks for the information. It does makes sense to ignore these parameters then.

@huytt1992
Copy link

i used to 2.11 version,
and error code , print exception
here my code :

Flavor flavor = os.compute().flavors().create("deleteme",512,1,10,0,0,1.0f,true);
System.out.println(flavor.getId());

ClientResponseException{message=Invalid input for field/attribute flavor. Value: {u'name': u'deleteme', u'ram': 512, u'OS-FLV-DISABLED:disabled': False, u'vcpus': 1, u'swap': 0, u'os-flavor-access:is_public': True, u'rxtx_factor': 1.0, u'OS-FLV-EXT-DATA:ephemeral': 0, u'disk': 10, u'public': True}. Additional properties are not allowed (u'OS-FLV-DISABLED:disabled', u'public' were unexpected), status=400, status-code=BAD_REQUEST}
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:38)
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
at org.openstack4j.core.transport.HttpEntityHandler.handleLessThan500(HttpEntityHandler.java:100)
at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:46)
at org.openstack4j.connectors.httpclient.HttpResponseImpl.getEntity(HttpResponseImpl.java:69)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:189)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:183)
at org.openstack4j.openstack.compute.internal.FlavorServiceImpl.create(FlavorServiceImpl.java:61)
at org.openstack4j.openstack.compute.internal.FlavorServiceImpl.create(FlavorServiceImpl.java:72)
at com.inet.dms.openstack4j.OpenStackProvisioning.main(OpenStackProvisioning.java:36)

@vinodborole
Copy link
Contributor

@huytt1992
Is this Openstack Liberty?

@huytt1992
Copy link

huytt1992 commented May 6, 2016

@vinodborole
Openstack Liberty? i don't understand.
can you help me fix problem
and explain detail ?

I follow the instructions here and use the library as a guide.
http://www.openstack4j.com/learn/compute
thank you so much.

@vinodborole
Copy link
Contributor

What openstack version are you using?

@huytt1992
Copy link

@vinodborole
hi, oh. i used to version openstack4j-2.11.

@vinodborole
Copy link
Contributor

that's the openstack4j library, that is fine..., i need to know the openstack cloud version that u are using? Is it liberty, mitaka, juno?

@huytt1992
Copy link

@vinodborole
hi, i'm sorry .
openstack cloud version : mitaka

@vinodborole
Copy link
Contributor

vinodborole commented May 6, 2016

It seems the following properties are not allowed for mitaka release. I do not think openstack4j supports some of the API's post kilo..

properties are not allowed (u'OS-FLV-DISABLED:disabled', u'public' were unexpected)

@huytt1992
Copy link

@vinodborole
you can tell me what direction does not solve the problem ?

@huytt1992
Copy link

@vinodborole

I see your instructions, and I follow it, by calling the API directly through tool Insomina.
I'm running mitaka,

INFO: 1 * Sending client request on thread main
1 > POST http://10.60.0.220:8774/v2.1/5fe442be936440c2bba57df3f8c71230/flavors
1 > Accept: application/json
1 > Content-Type: application/json
1 > User-Agent: OpenStack4j / OpenStack Client
1 > X-Auth-Token: 97115bf8a85f41ddb4a203d8f5268e8bxxxxxxx
{
"flavor" : {
"name" : "deleteme4",
"ram" : 512,
"vcpus" : 1,
"disk" : 10,
"swap" : 0,
"public" : true,
"OS-FLV-EXT-DATA:ephemeral" : 0,
"rxtx_factor" : 1.0,
"OS-FLV-DISABLED:disabled" : false,
"os-flavor-access:is_public" : true
}
}

and response :

{
"badRequest": {
"message": "Invalid input for field/attribute flavor. Value: {u'name': u'deleteme3', u'ram': 512, u'OS-FLV-DISABLED:disabled': False, u'vcpus': 1, u'swap': 0, u'os-flavor-access:is_public': True, u'rxtx_factor': 1.0, u'OS-FLV-EXT-DATA:ephemeral': 0, u'disk': 10, u'public': True}. Additional properties are not allowed (u'OS-FLV-DISABLED:disabled', u'public' were unexpected)",
"code": 400
}
}

if i delete 2 line ("public" : true,"OS-FLV-DISABLED:disabled" : false,), response : Ok

{
"flavor" : {
"name" : "deleteme4",
"ram" : 512,
"vcpus" : 1,
"disk" : 10,
"swap" : 0,
"OS-FLV-EXT-DATA:ephemeral" : 0,
"rxtx_factor" : 1.0,
"os-flavor-access:is_public" : true
}
}
response :
{
"flavor": {
"name": "deleteme4",
"links": [
{
"href": "http://10.60.0.220:8774/v2.1/5fe442be936440c2bba57df3f8c71230/flavors/74504e1f-d87f-4297-b7a3-e09427342503",
"rel": "self"
},
{
"href": "http://10.60.0.220:8774/5fe442be936440c2bba57df3f8c71230/flavors/74504e1f-d87f-4297-b7a3-e09427342503",
"rel": "bookmark"
}
],
"ram": 512,
"OS-FLV-DISABLED:disabled": false,
"vcpus": 1,
"swap": "",
"os-flavor-access:is_public": true,
"rxtx_factor": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"disk": 10,
"id": "74504e1f-d87f-4297-b7a3-e09427342503"
}
}

thank you so much !

@vinodborole
Copy link
Contributor

@huytt1992 Will let you know once we get this feature out.

@menihillel
Copy link

What's the plan on fixing this? Kind of blocked when using Mitaka. Seems like an easy fix nulling out these fields on creation. Is there a workaround we can gain access to the POJO before submission?

@vinodborole
Copy link
Contributor

#686

@vvduke89
Copy link

vvduke89 commented Aug 5, 2016

I have the same problem,Openstack:mitaka.Is there any solutions to solove this problem and tell me the reason? Thank you.

@vinodborole
Copy link
Contributor

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants