def _assert_dest_node_has_enough_disk(self, context, instance, available_mb, disk_over_commit):
    'Checks if destination has enough disk for block migration.'
    available = 0
    if available_mb:
        available = (available_mb * units.Mi)
    ret = self.get_instance_disk_info(instance['name'])
    disk_infos = jsonutils.loads(ret)
    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)
Checks if destination has enough disk for block migration.
def _assert_dest_node_has_enough_disk(self, context, instance, available_mb, disk_over_commit):
    
    available = 0
    if available_mb:
        available = (available_mb * units.Mi)
    ret = self.get_instance_disk_info(instance['name'])
    disk_infos = jsonutils.loads(ret)
    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)