'Convert the volume to be of the new type.
:param context: 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.'

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

    LOG.debug('Retype    volume    request    %(vol)s    to    be    %(type)s    (host:    %(host)s),    diff    %(diff)s.', {'vol': volume['name'], 'type': new_type, 'host': host, 'diff': diff})
    options = dict(compression='compression', dedup='dedup', description='nms:description')
    retyped = False
    migrated = False
    model_update = None
    src_backend = self.__class__.__name__
    dst_backend = host['capabilities']['location_info'].split(':')[0]
    if (src_backend != dst_backend):
        LOG.warning('Cannot    retype    from    %(src_backend)s    to    %(dst_backend)s.', {'src_backend': src_backend, 'dst_backend': dst_backend})
        return False
    hosts = (volume['host'], host['host'])
    (old, new) = hosts
    if (old != new):
        (migrated, provider_location) = self.migrate_volume(context, volume, host)
    if (not migrated):
        provider_location = volume['provider_location']
        nms = self.share2nms[provider_location]
    else:
        nms_url = host['capabilities']['nms_url']
        nms = self._get_nms_for_url(nms_url)
        model_update = provider_location
        provider_location = provider_location['provider_location']
    share = provider_location.split(':')[1].split('volumes/')[1]
    folder = ('%(share)s/%(volume)s' % {'share': share, 'volume': volume['name']})
    for opt in options:
        (old, new) = diff.get('extra_specs').get(opt, (False, False))
        if (old != new):
            LOG.debug('Changing    %(opt)s    from    %(old)s    to    %(new)s.', {'opt': opt, 'old': old, 'new': new})
            try:
                nms.folder.set_child_prop(folder, options[opt], new)
                retyped = True
            except exception.NexentaException:
                LOG.error('Error    trying    to    change    %(opt)s    from    %(old)s    to    %(new)s', {'opt': opt, 'old': old, 'new': new})
                return (False, None)
    return ((retyped or migrated), model_update)
