[openstack-dev] [Openstack] problem fetching volume details in snapshot creation

Swapnil Kulkarni swapnilkulkarni2608 at gmail.com
Wed Oct 16 05:32:18 UTC 2013


Correcting the typo, snapshot_ref['volume_name'] in your case.


On Wed, Oct 16, 2013 at 10:59 AM, Swapnil Kulkarni <
swapnilkulkarni2608 at gmail.com> wrote:

> I think snapshot[volume_name] is what you are looking for, pls see below
> link for ref.
>
>
> https://github.com/openstack/cinder/blob/stable/grizzly/cinder/volume/drivers/lvm.py#L233
>
> Best Regards,
> Swapnil
>
> On Wed, Oct 16, 2013 at 10:57 AM, Dinakar Gorti Maruti <
> dinakar.gm at cloudbyte.co> wrote:
>
>> display_name parameter  of volume
>>
>>
>> On Wed, Oct 16, 2013 at 10:55 AM, Swapnil Kulkarni <
>> swapnilkulkarni2608 at gmail.com> wrote:
>>
>>> What exact parameters are you looking for?
>>>
>>>
>>>
>>> On Wed, Oct 16, 2013 at 10:48 AM, Dinakar Gorti Maruti <
>>> dinakar.gm at cloudbyte.co> wrote:
>>>
>>>> Hi Swapnil,
>>>>
>>>>                 I had tried it before , it is returning a string
>>>> "volume" followed by volume id
>>>>
>>>> Thanks
>>>> Dinakar
>>>>
>>>>
>>>> On Wed, Oct 16, 2013 at 10:31 AM, Swapnil Kulkarni <
>>>> swapnilkulkarni2608 at gmail.com> wrote:
>>>>
>>>>> Hi DInakar,
>>>>>
>>>>> Please use volume_name, volume_size,etc. These are volume related
>>>>> parameters frequently used in snapshots. You can always do *dir* to
>>>>> get any specific values you need.
>>>>>
>>>>> Best Regards,
>>>>> Swapnil
>>>>>
>>>>>
>>>>> On Wed, Oct 16, 2013 at 10:11 AM, Dinakar Gorti Maruti <
>>>>> dinakar.gm at cloudbyte.co> wrote:
>>>>>
>>>>>> hi,
>>>>>>    I am implementing a driver for cinder services and I am stuck with
>>>>>> a problem in creation of snapshot , I have a need to fetch the volume
>>>>>> details in snapshot creation.
>>>>>> I am using Openstack-Grizzly
>>>>>>
>>>>>> I am trying to use this line of code
>>>>>>
>>>>>> def create_snapshot(self, snapshot_ref):
>>>>>>       ..........
>>>>>>
>>>>>>       volume = snapshot_ref['volume']
>>>>>>
>>>>>>       ...........
>>>>>>
>>>>>>
>>>>>> Error :
>>>>>>
>>>>>> Traceback (most recent call last):
>>>>>>   File
>>>>>> "/usr/lib/python2.6/site-packages/cinder/openstack/common/rpc/amqp.py",
>>>>>> line 430, in _process_data
>>>>>>     rval = self.proxy.dispatch(ctxt, version, method, **args)
>>>>>>   File
>>>>>> "/usr/lib/python2.6/site-packages/cinder/openstack/common/rpc/dispatcher.py",
>>>>>> line 133, in dispatch
>>>>>>     return getattr(proxyobj, method)(ctxt, **kwargs)
>>>>>>   File "/usr/lib/python2.6/site-packages/cinder/volume/manager.py",
>>>>>> line 564, in create_snapshot
>>>>>>     {'status': 'error'})
>>>>>>   File "/usr/lib64/python2.6/contextlib.py", line 23, in __exit__
>>>>>>     self.gen.next()
>>>>>>   File "/usr/lib/python2.6/site-packages/cinder/volume/manager.py",
>>>>>> line 554, in create_snapshot
>>>>>>     model_update =
>>>>>> self.driver.create_snapshot(snapshot_ref,volume_name)
>>>>>>   File
>>>>>> "/usr/lib/python2.6/site-packages/cinder/volume/drivers/cloudbyte.py", line
>>>>>> 195, in create_snapshot
>>>>>>     LOG.debug(_("phani volume object in snapshot :
>>>>>> %s"),snapshot_ref['volume'])
>>>>>>   File
>>>>>> "/usr/lib/python2.6/site-packages/cinder/db/sqlalchemy/models.py", line 74,
>>>>>> in __getitem__
>>>>>>     return getattr(self, key)
>>>>>>   File
>>>>>> "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/attributes.py",
>>>>>> line 168, in __get__
>>>>>>     return self.impl.get(instance_state(instance),dict_)
>>>>>>   File
>>>>>> "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/attributes.py",
>>>>>> line 453, in get
>>>>>>     value = self.callable_(state, passive)
>>>>>>   File
>>>>>> "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/orm/strategies.py",
>>>>>> line 481, in _load_for_state
>>>>>>     (mapperutil.state_str(state), self.key)
>>>>>>
>>>>>>
>>>>>>  DetachedInstanceError: Parent instance <Snapshot at 0x30a0cd0> is
>>>>>> not bound to a Session; lazy load operation of attribute 'volume' cannot
>>>>>> proceed
>>>>>>
>>>>>> hoping for a solution
>>>>>>
>>>>>> Thanks
>>>>>> Dinakar
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mailing list:
>>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>>> Post to     : openstack at lists.openstack.org
>>>>>> Unsubscribe :
>>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131016/c5fe926c/attachment.html>


More information about the OpenStack-dev mailing list