'Create hypermetro.'

def create_hypermetro(self, local_lun_id, lun_params):

    try:
        config_pool = self.configuration.metro_storage_pools
        remote_pool = self.rmt_client.get_all_pools()
        pool = self.rmt_client.get_pool_info(config_pool, remote_pool)
        if (not pool):
            err_msg = _('Remote    pool    cannot    be    found.')
            LOG.error(err_msg)
            raise exception.VolumeBackendAPIException(data=err_msg)
        lun_params['PARENTID'] = pool['ID']
        remotelun_info = self.rmt_client.create_lun(lun_params)
        remote_lun_id = remotelun_info['ID']
        try:
            domain_name = self.configuration.metro_domain_name
            domain_id = self.rmt_client.get_hyper_domain_id(domain_name)
            self._wait_volume_ready(remote_lun_id)
            hypermetro = self._create_hypermetro_pair(domain_id, local_lun_id, remote_lun_id)
            LOG.info('Hypermetro    id:    %(metro_id)s.    Remote    lun    id:    %(remote_lun_id)s.', {'metro_id': hypermetro['ID'], 'remote_lun_id': remote_lun_id})
            return {'hypermetro_id': hypermetro['ID'], 'remote_lun_id': remote_lun_id}
        except exception.VolumeBackendAPIException as err:
            self.rmt_client.delete_lun(remote_lun_id)
            msg = (_('Create    hypermetro    error.    %s.') % err)
            raise exception.VolumeBackendAPIException(data=msg)
    except exception.VolumeBackendAPIException:
        raise
