[
https://issues.apache.org/jira/browse/JCLOUDS-515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13948531#comment-13948531
]
Jasdeep Hundal edited comment on JCLOUDS-515 at 3/26/14 9:57 PM:
-----------------------------------------------------------------
This was a fix because I did run into this, and probably should have pasted
that in the ticket... :P
Code:
{code:title=CinderVolumeCreate.java|borderStyle=solid}
Properties properties = new Properties();
// Assume properties set properly
CinderApi cinderApi = builder.overrides(properties).buildApi(CinderApi.class);
VolumeApi cinderVolumeApi = cinderApi.getVolumeApiForZone("RegionOne");
CreateVolumeOptions volumeOptions = new CreateVolumeOptions();
volumeOptions.name("test");
volumeOptions.volumeType("type");
cinderVolumeApi.create(size, volumeOptions);
{code}
Traceback:
{code}
java.lang.NullPointerException: zone
at
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
at org.jclouds.openstack.cinder.v1.domain.Volume.<init>(Volume.java:244)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
com.google.common.reflect.Invokable$ConstructorInvokable.invokeInternal(Invokable.java:242)
at com.google.common.reflect.Invokable.invoke(Invokable.java:102)
at
org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.newInstance(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:215)
at
org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:195)
at com.google.gson.Gson.fromJson(Gson.java:803)
at
org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:83)
at
org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:47)
at
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:93)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:76)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:47)
at
org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
at
com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
at com.sun.proxy.$Proxy89.create(Unknown Source)
...
{code}
was (Author: jasdeep):
This was a fix because I did run into this, and probably should have pasted
that in the ticket... :P
Code:
{code:title=CinderVolumeCreate.java|borderStyle=solid}
Properties properties = new Properties();
// Assume properties set properly
CinderApi cinderApi = builder.overrides(properties).buildApi(CinderApi.class);
VolumeApi cinderVolumeApi = cinderApi.getVolumeApiForZone("RegionOne");
CreateVolumeOptions volumeOptions = new CreateVolumeOptions();
volumeOptions.name(name);
volumeOptions.volumeType("nebula");
cinderVolumeApi.create(size, volumeOptions);
{code}
Traceback:
{code}
java.lang.NullPointerException: zone
at
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
at org.jclouds.openstack.cinder.v1.domain.Volume.<init>(Volume.java:244)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
com.google.common.reflect.Invokable$ConstructorInvokable.invokeInternal(Invokable.java:242)
at com.google.common.reflect.Invokable.invoke(Invokable.java:102)
at
org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.newInstance(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:215)
at
org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:195)
at com.google.gson.Gson.fromJson(Gson.java:803)
at
org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:83)
at
org.jclouds.http.functions.ParseFirstJsonValueNamed.apply(ParseFirstJsonValueNamed.java:47)
at
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:93)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:76)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:47)
at
org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
at
com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
at com.sun.proxy.$Proxy89.create(Unknown Source)
...
{code}
> Cinder volume create does not require availability zone
> -------------------------------------------------------
>
> Key: JCLOUDS-515
> URL: https://issues.apache.org/jira/browse/JCLOUDS-515
> Project: jclouds
> Issue Type: Bug
> Components: jclouds-core
> Affects Versions: 1.7.1
> Reporter: Jasdeep Hundal
> Assignee: Jasdeep Hundal
> Fix For: 1.8.0
>
>
> Openstack Cinder does not require specifying an availability zone for volume
> creation, but the Cinder API as implemented in JClouds does. We should change
> the check in the constructor of org.jclouds.openstack.cinder.v1.domain to
> allow a null value for availability zone.
> The docs on the v1 API are not readily available but tracing through the
> Cinder source code, we find this line that gets executed if we specify no
> availability zone in either the v1 or v2 block storage APIs:
> https://github.com/openstack/cinder/blob/master/cinder/volume/flows/api/create_volume.py#L247
> It can also be noted the the Block Storage v2 request here does not require
> an availability zone:
> http://docs.openstack.org/api/openstack-block-storage/2.0/content/POST_createVolume_v2__tenant_id__volumes_Volumes.html
--
This message was sent by Atlassian JIRA
(v6.2#6252)