'Creates a hyperscale volume.'

@utils.trace_method
def create_volume(self, volume):

    model_update = {}
    metadata_update = {}
    reflection_target_ip = None
    LOG.debug('Create    volume')
    try:
        volume_metadata = self._get_volume_metadata(volume)
        replicas = self._get_replicas(volume, volume_metadata)
        if (replicas > 1):
            LOG.debug('Create    volume    message    sent    to    peer    data    node')
            (ret, reflection_target_ip, metadata_update) = self._create_replica(volume, volume_metadata)
            if (ret is False):
                metadata_update['DN_Resiliency'] = 'degraded'
                reflection_target_ip = None
        volume_details = self._get_volume_details_for_create_volume(reflection_target_ip, volume, volume_metadata)
        util.message_data_plane(self.dn_routing_key, 'hyperscale.storage.dm.volume.create', **volume_details)
        LOG.debug('Create    volume    message    sent    to    data    node')
        volume_metadata['Primary_datanode_ip'] = self.datanode_ip
        volume_metadata['current_dn_owner'] = self.dn_routing_key
        volume_metadata['current_dn_ip'] = self.datanode_ip
        volume_metadata['hs_image_id'] = util.get_hyperscale_image_id()
        volume_metadata.update(metadata_update)
        volume['provider_location'] = PROVIDER_LOCATION
        model_update = {'provider_location': volume['provider_location'], 'metadata': volume_metadata}
    except (exception.UnableToProcessHyperScaleCmdOutput, exception.ErrorInSendingMsg):
        with excutils.save_and_reraise_exception():
            LOG.exception('Unable    to    create    hyperscale    volume')
    return model_update
