'Changes volume from one type to another.'

def retype(self, ctxt, volume, new_type, diff, host):

    new_specs = common.ExtraSpecs.from_volume_type(new_type)
    new_specs.validate(self.client.get_vnx_enabler_status())
    lun = self.client.get_lun(name=volume.name)
    if volume.volume_type_id:
        old_specs = common.ExtraSpecs.from_volume(volume)
    else:
        utils.update_res_without_poll(lun)
        old_specs = common.ExtraSpecs.from_lun(lun)
    old_provision = old_specs.provision
    old_tier = old_specs.tier
    need_migration = utils.retype_need_migration(volume, old_provision, new_specs.provision, host)
    turn_on_compress = utils.retype_need_turn_on_compression(old_provision, new_specs.provision)
    change_tier = utils.retype_need_change_tier(old_tier, new_specs.tier)
    if (need_migration or turn_on_compress):
        if self.client.lun_has_snapshot(lun):
            LOG.debug('Driver    is    not    able    to    do    retype    because    the    volume    %s    has    a    snapshot.', volume.id)
            return False
    if need_migration:
        LOG.debug('Driver    needs    to    use    storage-assisted    migration    to    retype    the    volume.')
        return self._migrate_volume(volume, host, new_specs)
    if turn_on_compress:
        self.client.enable_compression(lun)
    if change_tier:
        lun.tier = new_specs.tier
    return True
