Example #1
0
 def manage_existing(self, volume, existing_ref):
     ldev = _str2int(existing_ref.get('ldev'))
     metadata = utils.get_volume_metadata(volume)
     return {
         'provider_location': six.text_type(ldev),
         'metadata': dict(
             metadata, ldev=ldev, type=utils.NORMAL_LDEV_TYPE),
     }
Example #2
0
 def copy_dest_vol_meta_to_src_vol(self, src_vol, dest_vol):
     metadata = utils.get_volume_metadata(dest_vol)
     try:
         self.db.volume_metadata_update(
             self.ctxt, src_vol['id'], metadata, True)
     except Exception as ex:
         utils.output_log(
             318, src_vol_id=src_vol['id'], dest_vol_id=dest_vol['id'],
             reason=six.text_type(ex))
Example #3
0
 def create_snapshot(self, snapshot):
     src_vref = self.db.volume_get(self.ctxt, snapshot['volume_id'])
     ldev = utils.get_ldev(src_vref)
     # When 'ldev' is 0, it should be true.
     # Therefore, it cannot remove 'is None'.
     if ldev is None:
         msg = utils.output_log(624, type='volume', id=src_vref['id'])
         raise exception.HPEXPError(data=msg)
     size = snapshot['volume_size']
     metadata = utils.get_volume_metadata(src_vref)
     new_ldev, ldev_type = self._copy_ldev(ldev, size, metadata)
     if not self.conf.hpexp_driver_cert_mode:
         self.db.snapshot_metadata_update(
             self.ctxt, snapshot['id'],
             dict(ldev=new_ldev, type=ldev_type), False)
     return {
         'provider_location': six.text_type(new_ldev),
     }