'Change volume type.
Returns a boolean indicating whether the retype occurred.
:param ctxt: Context
:param volume: A dictionary describing the volume to migrate
:param new_type: A dictionary describing the volume type to convert to
:param diff: A dictionary with the difference between the two types
:param host: A dictionary describing the host to migrate to, where
host[\'host\'] is its name, and host[\'capabilities\'] is a
dictionary of its reported capabilities'

@proxy._trace_time
def retype(self, ctxt, volume, new_type, diff, host):

    LOG.debug('retype:    volume    =    %(vol)s    type    =    %(ntype)s', {'vol': volume.get('display_name'), 'ntype': new_type['name']})
    if ('location_info' not in host['capabilities']):
        return False
    info = host['capabilities']['location_info']
    try:
        (dest, dest_host, dest_pool) = info.split(':')
    except ValueError:
        return False
    volume_host = volume.get('host').split('_')[1]
    if ((dest != strings.XIV_BACKEND_PREFIX) or (dest_host != volume_host)):
        return False
    pool_name = self.storage_info[storage.FLAG_KEYS['storage_pool']]
    if (pool_name != dest_pool):
        LOG.debug('retype:    migrate    volume    %(vol)s    to    host=%(host)s,    pool=%(pool)s', {'vol': volume.get('display_name'), 'host': dest_host, 'pool': dest_pool})
        (mig_result, model) = self.migrate_volume(context=ctxt, volume=volume, host=host)
        if (not mig_result):
            raise self.meta['exception'].VolumeBackendAPIException(data=PERF_CLASS_ADD_ERROR)
    old_specs = self._qos_specs_from_volume(volume)
    new_specs = self._get_qos_specs(new_type.get('id', None))
    if (not new_specs):
        if old_specs:
            LOG.debug('qos:    removing    qos    class    for    %(vol)s.', {'vol': volume.display_name})
            self._qos_remove_vol(volume)
        return True
    perf_class_name_old = self._check_perf_class_on_backend(old_specs)
    perf_class_name_new = self._check_perf_class_on_backend(new_specs)
    if (perf_class_name_new != perf_class_name_old):
        self._qos_add_vol(volume, perf_class_name_new)
    return True
