Hi Imesh,

There are three scenarios. I will explain them

1) You have a volume snapshot and you want to created volumes from that
snapshot. In this case you have to specify the snapshotId

  {

"snapshotId":"5659ad7b-2eab-4b1a-8738-40df2b32bfcb",
                                        "device": "/dev/vdc",
 "mappingPath": "/home/ubuntu/sdc",
                                        "size": "5",
                                        "removeOnTermination": "true"
                                }

Here Statos will create a volume from the given snaphost with the given
size. Here user has to be carefull to give a size equal or larger than the
snapshot size, otherwise volume creation is falied since you can not create
volumes smaller than the snaphost.

2) You have a precreated volume which you want to attach for the instance.

{

"volumeId":"5659ad7b-2eab-4b1a-8738-40df2b32bfcb",
                                        "device": "/dev/vdc",
 "mappingPath": "/home/ubuntu/sdc",
                                        "removeOnTermination": "true"
                                }

Here Stratos will not create any volume, rather it attach the given volume.
Here you don't need to provide the size.

3) User want to create a raw volume

{

                                        "device": "/dev/vdc",
 "mappingPath": "/home/ubuntu/sdc",
"size": "5",
                                        "removeOnTermination": "true"
                                }

In this scenario a raw volume will be created with the given size.


@Imesh this was the same implementation which was coming from 400.

On Wed, Mar 25, 2015 at 11:36 AM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Shaheed,
>
> I think the "size" parameter was there in 4.0.0 release, please see [1].
> However I agree that it should not raise a NPE if it was not given rather a
> validation should be done.
>
> Udara: Can you please confirm whether we have done any changes to the
> persistence definition in 4.1.0?
>
> [1]
> https://cwiki.apache.org/confluence/display/STRATOS/4.0.0+Persistence+Volume+Mapping
>
> Thanks
>
> On Wed, Mar 25, 2015 at 12:10 AM, Shaheedur Haque (shahhaqu) <
> shahh...@cisco.com> wrote:
>
>>  Hi,
>>
>>
>>
>> I finally progressed our other infrastructure to the point where I can
>> usefully test the persistence support. At first, I was confused as to why
>> the volume was not being attached, then I realized I had put the
>> “persistence” JSON in the wrong place. However, when I fixed **that**, I
>> start getting 500/Server Internal Error on Application setup.
>>
>>
>>
>> The JSON structure I have looks like this:
>>
>>
>>
>>         "application": {
>>
>>             "applicationId": "di-000-001",
>>
>>             "application_template_id": "cisco-qvpc-cf-01-0",
>>
>>             "multiTenant": false,
>>
>>             "components": {
>>
>>                 "cartridges": [
>>
>>                     {
>>
>>                         "cartridgeMin": 1,
>>
>>                         "cartridgeMax": 10000000,
>>
>>                         "type": "cisco-qvpc-cf-01-0",
>>
>>                         "subscribableInfo": {
>>
>>                             "deploymentPolicy": "static-1",
>>
>>                             "artifactRepository": {
>>
>>                                 "repoUrl": "
>> http://octl.qmog.cisco.com:10080/git/default.git";,
>>
>>                                 "repoUsername": "user",
>>
>>                                 "privateRepo": true,
>>
>>                                 "repoPassword": "password"
>>
>>                             },
>>
>>                             "autoscalingPolicy": "economyPolicy",
>>
>>                             "alias": "cisco-qvpc-cf-01-0",
>>
>>                             "property": [
>>
>>                                 {
>>
>>                                     "name":
>> "payload_parameter.VOLUME_INFO",
>>
>>                                     "value":
>> "di-000-001:fcd8bc58-844b-4370-816e-7dd6b78ed22a"
>>
>>                                 }
>>
>>                             ],
>>
>>                             "persistence": [
>>
>>                                 {
>>
>>                                     "volume": [
>>
>>                                         {
>>
>>                                             "device": "/dev/vdb",
>>
>>                                             "removeOnTermination":
>> "false",
>>
>>                                             "volumeId":
>> "fcd8bc58-844b-4370-816e-7dd6b78ed22a"
>>
>>                                         }
>>
>>                                     ],
>>
>>                                     "isRequired": "true"
>>
>>                                 }
>>
>>                             ]
>>
>>                         }
>>
>>                     }
>>
>>                 ]
>>
>>             },
>>
>>             "alias": "di-000-001"
>>
>>         },
>>
>>
>>
>> Where the “property” list and “persistence” list in red are the new
>> additions. The actual exception is this:
>>
>>
>>
>> TID: [0] [STRATOS] [2015-03-24 18:30:02,497] ERROR
>> {org.apache.stratos.rest.endpoint.handlers.CustomThrowableExceptionMapper}
>> -  Internal server error
>>
>> java.lang.NumberFormatException: null
>>
>>         at java.lang.Integer.parseInt(Integer.java:454)
>>
>>         at java.lang.Integer.parseInt(Integer.java:527)
>>
>>         at
>> org.apache.stratos.rest.endpoint.util.converter.ObjectConverter.convertVolumeToStubVolume(ObjectConverter.java:1480)
>>
>>         at
>> org.apache.stratos.rest.endpoint.util.converter.ObjectConverter.convertSubscribableInfo(ObjectConverter.java:1458)
>>
>>         at
>> org.apache.stratos.rest.endpoint.util.converter.ObjectConverter.convertCartridgeReferenceBeansToStubCartridgeContexts(ObjectConverter.java:1420)
>>
>>         at
>> org.apache.stratos.rest.endpoint.util.converter.ObjectConverter.convertApplicationDefinitionToStubApplicationContext(ObjectConverter.java:1226)
>>
>>         at
>> org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.addApplication(StratosApiV41Utils.java:1074)
>>
>>         at
>> org.apache.stratos.rest.endpoint.api.StratosApiV41.addApplication(StratosApiV41.java:600)
>>
>>
>>
>> And that turns out to be this line:
>>
>>
>>
>>             volumeContext.setSize(Integer.parseInt(volumeBean.getSize()));
>>
>>
>>
>> which is maybe not surprising since I have not specified a size. But then
>> again, I never used to specify a size. So why has this now become seemingly
>> a required value? Please can you fix this, and otherwise revert any changes
>> to the programming model that are not strictly required.
>>
>>
>>
>> If any changes **are** required, please explain them as reverse
>> engineering this stuff is just painful.
>>
>>
>>
>> While we are on this subject, please can somebody confirm that the
>> “property” list as well as the “persistence” list is supported? I’d prefer
>> to get this stuff sorted in one pass if at all possible J.
>>
>>
>>
>> Thanks, Shaheed
>>
>>
>>
>>
>>
>> *From:* Udara Liyanage [mailto:ud...@wso2.com]
>> *Sent:* Tuesday, March 24, 2015 3:35 PM
>> *To:* dev
>> *Subject:* Re: Persistence Volume Mapping support
>>
>>
>>
>> Hi,
>>
>>
>>
>> I tested below scenarios and they are working
>>
>>
>>
>> Create a volume with a given snapshot
>>
>> Create a raw volume
>>
>> Attach an existing volume without creating a new volume
>>
>> Multiple volumes with above three combinations
>>
>>
>>
>> Then I will test the mounting extension script
>>
>>
>>
>> On Tue, Mar 24, 2015 at 11:47 AM, Lahiru Sandaruwan <lahi...@wso2.com>
>> wrote:
>>
>>  Great.
>>
>>
>>
>> Thanks.
>>
>>
>>
>> On Tue, Mar 24, 2015 at 10:16 AM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>>  Hi,
>>
>>
>>
>> I think I found the cause for the error. Region value is appended for the
>> instance ID at the time of attaching
>>
>> RegionOne/1a264759-a7b4-4ab8-b6f6-a6b0624cea79
>>
>>
>>
>> When I remove the region from the instance ID at debugging. It worked for
>> me.
>>
>> I will fix it.
>>
>>
>>
>> On Tue, Mar 24, 2015 at 10:00 AM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>>  Hi,
>>
>>
>>
>> I just added a main class inside cc component and start locally. It
>> should pick the current jclouds version ?
>>
>> However I faced the same issue when I tried with stratos at volume
>> attachment. I will have a look.
>>
>>
>>
>> On Tue, Mar 24, 2015 at 9:00 AM, Lahiru Sandaruwan <lahi...@wso2.com>
>> wrote:
>>
>>  Your client is using the same Jclouds version, that we do?
>>
>>
>>
>>
>>
>> On Tue, Mar 24, 2015 at 8:27 AM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>> Hi Lahiru,
>>
>> I didn't try with Stratos. I wrote a client to create and attach volumes.
>>
>> On 24 Mar 2015 07:31, "Lahiru Sandaruwan" <lahi...@wso2.com> wrote:
>>
>>
>>
>>
>>
>> On Tue, Mar 24, 2015 at 7:01 AM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>> Hi Lahiru,
>>
>> I could create a new volume and create a new volume from a snapshot and
>> attach the volume.
>>
>>
>>
>> Great. So the attaching the volume was successful?  Can you share the
>> json you used?
>>
>>
>>
>> Thanks.
>>
>> I will do further testing today and keep the thread updated.
>>
>>
>>
>>
>>
>> --
>>
>> --
>> Lahiru Sandaruwan
>>
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>>
>> lean.enterprise.middleware
>>
>> phone: +94773325954
>> email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>> --
>> Lahiru Sandaruwan
>>
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>>
>> lean.enterprise.middleware
>>
>> phone: +94773325954
>> email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> Udara Liyanage
>>
>> Software Engineer
>>
>> WSO2, Inc.: http://wso2.com
>>
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>>
>> phone: +94 71 443 6897
>>
>>
>>
>>
>>
>> --
>>
>>
>> Udara Liyanage
>>
>> Software Engineer
>>
>> WSO2, Inc.: http://wso2.com
>>
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>>
>> phone: +94 71 443 6897
>>
>>
>>
>>
>>
>> --
>>
>> --
>> Lahiru Sandaruwan
>>
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>>
>> lean.enterprise.middleware
>>
>> phone: +94773325954
>> email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> Udara Liyanage
>>
>> Software Engineer
>>
>> WSO2, Inc.: http://wso2.com
>>
>> lean. enterprise. middleware
>>
>> web: http://udaraliyanage.wordpress.com
>>
>> phone: +94 71 443 6897
>>
>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Reply via email to