+ def resolve_volume_n_validate(self, volume_ref):
+ """
+ Resolve the volume reference
+
+ Arguments:
+ volume_ref (string): Name of volume reference
+
+ Raises VolumeValidateError in case of Errors
+ """
+
+ for vol in self.driver._cinder_volume_list:
+ voldict = vol.to_dict()
+ if 'display_name' in voldict and voldict['display_name'] == volume_ref:
+ if 'status' in voldict:
+ if voldict['status'] == 'available':
+ return voldict['id']
+ else:
+ self.log.error("Volume %s not in available state. Current state: %s",
+ volume_ref, voldict['status'])
+ raise VolumeValidateError("Volume with name %s found in incorrect (%s) state"
+ %(volume_ref, voldict['status']))
+
+ self.log.info("No volume found with matching name: %s ", volume_ref)
+ raise VolumeValidateError("No volume found with matching name: %s " %(volume_ref))
+