'Checks if destination has enough disk for block migration.'

def _assert_dest_node_has_enough_disk(self, context, instance, available_mb, disk_over_commit, block_device_info):

    available = 0
    if available_mb:
        available = (available_mb * units.Mi)
    disk_infos = self._get_instance_disk_info(instance, block_device_info)
    necessary = 0
    if disk_over_commit:
        for info in disk_infos:
            necessary += int(info['disk_size'])
    else:
        for info in disk_infos:
            necessary += int(info['virt_disk_size'])
    if ((available - necessary) < 0):
        reason = (_('Unable    to    migrate    %(instance_uuid)s:    Disk    of    instance    is    too    large(available    on    destination    host:%(available)s    <    need:%(necessary)s)') % {'instance_uuid': instance.uuid, 'available': available, 'necessary': necessary})
        raise exception.MigrationPreCheckError(reason=reason)
