[openstack-dev] [cinder] Attaching extra-spec to vol-type using Cinder py-client

Vipin Balachandran vbalachandran at vmware.com
Tue Mar 31 06:36:24 UTC 2015


cinder.volume_types.create returns an instance of VolumeType.
https://github.com/openstack/python-cinderclient/blob/master/cinderclient/v2/volume_types.py#L118

Thanks,
Vipin

From: Pradip Mukhopadhyay [mailto:pradip.interra at gmail.com]
Sent: Tuesday, March 31, 2015 10:07 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: [openstack-dev] [cinder] Attaching extra-spec to vol-type using Cinder py-client


Hello,

I am trying to create and type-set some parameters to a volume-type as follows:

cinder type-create nfs

cinder type-key nfs set volume_backend_name=myNFSBackend

The same thing I want to achieve through python client.

I can create the type as follows:

from cinderclient import client

cinder = client.Client('2', 'admin', 'pw', 'demo', 'http://127.0.0.1:5000/v2.0<https://urldefense.proofpoint.com/v2/url?u=http-3A__127.0.0.1-3A5000_v2.0&d=AwMBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=CTAUyaHvyUUJ-0QHviztQxBhCDLLSg1DksoSE4TOfZ8&m=EIUflZKBvoV_Hp3DkmTE612FqBGHpwXLuwGJ3UpwbbI&s=hk8YML4Dn_kR2cMzCB4Lohd-fnmlk8Z9zBEu1Cc3DO0&e=>', service_type="volumev2")

cinder.volume_types.create('nfs')

However how can I associate the extra-spec through python-client code to the 'nfs' volume (same impact as the CLI 'cinder type-key nfs set volume_backend_name=myNFSBackend' does)?

The 'set_keys' etc. methods are there in the "v2/volume_types.py" in python-cinderclient codebase. How to call it? (it's part of VolumeType class, not VolumeTypeManager).

Any help would be great.

Thanks, Pradip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150331/0b5cfd89/attachment.html>


More information about the OpenStack-dev mailing list