'Volume creation in K2 needs a volume group.
- create a volume group
- create a volume in the volume group'

@kaminario_logger
def create_volume(self, volume):

    vg_name = self.get_volume_group_name(volume.id)
    vol_name = self.get_volume_name(volume.id)
    prov_type = self._get_is_dedup(volume.get('volume_type'))
    try:
        LOG.debug('Creating    volume    group    with    name:    %(name)s,    quota:    unlimited    and    dedup_support:    %(dedup)s', {'name': vg_name, 'dedup': prov_type})
        vg = self.client.new('volume_groups', name=vg_name, quota=0, is_dedup=prov_type).save()
        LOG.debug('Creating    volume    with    name:    %(name)s,    size:    %(size)s    GB,    volume_group:    %(vg)s', {'name': vol_name, 'size': volume.size, 'vg': vg_name})
        vol = self.client.new('volumes', name=vol_name, size=(volume.size * units.Mi), volume_group=vg).save()
    except Exception as ex:
        vg_rs = self.client.search('volume_groups', name=vg_name)
        if (vg_rs.total != 0):
            LOG.debug('Deleting    vg:    %s    for    failed    volume    in    K2.', vg_name)
            vg_rs.hits[0].delete()
        LOG.exception('Creation    of    volume    %s    failed.', vol_name)
        raise exception.KaminarioCinderDriverException(reason=ex)
    if (self._get_is_replica(volume.volume_type) and self.replica):
        self._create_volume_replica(volume, vg, vol, self.replica.rpo)
