return None
+def list_volume_types(cinder_client, public=True, private=True):
+ try:
+ volume_types = cinder_client.volume_types.list()
+ if not public:
+ volume_types = [vt for vt in volume_types if not vt.is_public]
+ if not private:
+ volume_types = [vt for vt in volume_types if vt.is_public]
+ return volume_types
+ except Exception, e:
+ print "Error [list_volume_types(cinder_client)]:", e
+ return None
+
+
+def create_volume_type(cinder_client, name):
+ try:
+ volume_type = cinder_client.volume_types.create(name)
+ return volume_type
+ except Exception, e:
+ print "Error [create_volume_type(cinder_client, '%s')]:" % name, e
+ return None
+
+
def update_cinder_quota(cinder_client, tenant_id, vols_quota,
snapshots_quota, gigabytes_quota):
quotas_values = {"volumes": vols_quota,
return False
-def list_volume_types(cinder_client, public=True, private=True):
- try:
- volume_types = cinder_client.volume_types.list()
- if not public:
- volume_types = [vt for vt in volume_types if not vt.is_public]
- if not private:
- volume_types = [vt for vt in volume_types if vt.is_public]
- return volume_types
- except:
- return None
-
-
-def create_volume_type(cinder_client, name):
- try:
- volume_type = cinder_client.volume_types.create(name)
- return volume_type
- except:
- print "Error:", sys.exc_info()[0]
- return None
-
-
def delete_volume_type(cinder_client, volume_type):
try:
cinder_client.volume_types.delete(volume_type)
return True
- except:
- print "Error:", sys.exc_info()[0]
+ except Exception, e:
+ print "Error [delete_volume_type(cinder_client, '%s')]:" % volume_type, e
return False