/
usr
/
lib
/
python2.6
/
site-packages
/
cinderclient
/
v1
/
/usr/lib/python2.6/site-packages/cinderclient/v1
mkdir
upload
Name
Size
Mode
Actions
contrib/
-
0755
rm
availability_zones.py
1427
0644
edit
dl
rm
availability_zones.pyc
1596
0644
edit
dl
rm
client.py
4723
0644
edit
dl
rm
client.pyc
3876
0644
edit
dl
rm
limits.py
2784
0644
edit
dl
rm
limits.pyc
4106
0644
edit
dl
rm
qos_specs.py
4791
0644
edit
dl
rm
qos_specs.pyc
6046
0644
edit
dl
rm
quotas.py
2001
0644
edit
dl
rm
quotas.pyc
2466
0644
edit
dl
rm
quota_classes.py
1659
0644
edit
dl
rm
quota_classes.pyc
1958
0644
edit
dl
rm
services.py
2186
0644
edit
dl
rm
services.pyc
2639
0644
edit
dl
rm
shell.py
49112
0644
edit
dl
rm
shell.pyc
49732
0644
edit
dl
rm
volumes.py
15290
0644
edit
dl
rm
volumes.pyc
18544
0644
edit
dl
rm
volume_backups.py
2607
0644
edit
dl
rm
volume_backups.pyc
3232
0644
edit
dl
rm
volume_backups_restore.py
1574
0644
edit
dl
rm
volume_backups_restore.pyc
1780
0644
edit
dl
rm
volume_encryption_types.py
3581
0644
edit
dl
rm
volume_encryption_types.pyc
4069
0644
edit
dl
rm
volume_snapshots.py
6515
0644
edit
dl
rm
volume_snapshots.pyc
8649
0644
edit
dl
rm
volume_transfers.py
3248
0644
edit
dl
rm
volume_transfers.pyc
4014
0644
edit
dl
rm
volume_types.py
3493
0644
edit
dl
rm
volume_types.pyc
4151
0644
edit
dl
rm
__init__.py
695
0644
edit
dl
rm
__init__.pyc
225
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/cinderclient/v1/volume_types.py
(3493B)
# Copyright (c) 2011 Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. """ Volume Type interface. """ from cinderclient import base class VolumeType(base.Resource): """ A Volume Type is the type of volume to be created """ def __repr__(self): return "<VolumeType: %s>" % self.name def get_keys(self): """ Get extra specs from a volume type. :param vol_type: The :class:`VolumeType` to get extra specs from """ _resp, body = self.manager.api.client.get( "/types/%s/extra_specs" % base.getid(self)) return body["extra_specs"] def set_keys(self, metadata): """ Set extra specs on a volume type. :param type : The :class:`VolumeType` to set extra spec on :param metadata: A dict of key/value pairs to be set """ body = {'extra_specs': metadata} return self.manager._create( "/types/%s/extra_specs" % base.getid(self), body, "extra_specs", return_raw=True) def unset_keys(self, keys): """ Unset extra specs on a volume type. :param type_id: The :class:`VolumeType` to unset extra spec on :param keys: A list of keys to be unset """ # NOTE(jdg): This wasn't actually doing all of the keys before # the return in the loop resulted in ony ONE key being unset. # since on success the return was NONE, we'll only interrupt the loop # and return if there's an error resp = None for k in keys: resp = self.manager._delete( "/types/%s/extra_specs/%s" % ( base.getid(self), k)) if resp is not None: return resp class VolumeTypeManager(base.ManagerWithFind): """ Manage :class:`VolumeType` resources. """ resource_class = VolumeType def list(self, search_opts=None): """ Get a list of all volume types. :rtype: list of :class:`VolumeType`. """ return self._list("/types", "volume_types") def get(self, volume_type): """ Get a specific volume type. :param volume_type: The ID of the :class:`VolumeType` to get. :rtype: :class:`VolumeType` """ return self._get("/types/%s" % base.getid(volume_type), "volume_type") def delete(self, volume_type): """ Delete a specific volume_type. :param volume_type: The name or ID of the :class:`VolumeType` to get. """ self._delete("/types/%s" % base.getid(volume_type)) def create(self, name): """ Creates a volume type. :param name: Descriptive name of the volume type :rtype: :class:`VolumeType` """ body = { "volume_type": { "name": name, } } return self._create("/types", body, "volume_type")
Save
cmd:
run