def _get_vcpu_total(self):
    'Get available vcpu number of physical computer.\n\n        :returns: the number of cpu core instances can be used.\n\n        '
    if (self._vcpu_total != 0):
        return self._vcpu_total
    try:
        total_pcpus = self._conn.getInfo()[2]
    except libvirt.libvirtError:
        LOG.warn(_LW('Cannot get the number of cpu, because this function is not implemented for this platform. '))
        return 0
    if (CONF.vcpu_pin_set is None):
        self._vcpu_total = total_pcpus
        return self._vcpu_total
    available_ids = hardware.get_vcpu_pin_set()
    if (available_ids[(- 1)] >= total_pcpus):
        raise exception.Invalid(_('Invalid vcpu_pin_set config, out of hypervisor cpu range.'))
    self._vcpu_total = len(available_ids)
    return self._vcpu_total
Get available vcpu number of physical computer.

:returns: the number of cpu core instances can be used.
def _get_vcpu_total(self):
    'Get available vcpu number of physical computer.\n\n        :returns: the number of cpu core instances can be used.\n\n        '
    if (self._vcpu_total != 0):
        return self._vcpu_total
    try:
        total_pcpus = self._conn.getInfo()[2]
    except libvirt.libvirtError:
        LOG.warn(_LW('Cannot get the number of cpu, because this function is not implemented for this platform. '))
        return 0
    if (CONF.vcpu_pin_set is None):
        self._vcpu_total = total_pcpus
        return self._vcpu_total
    available_ids = hardware.get_vcpu_pin_set()
    if (available_ids[(- 1)] >= total_pcpus):
        raise exception.Invalid(_('Invalid vcpu_pin_set config, out of hypervisor cpu range.'))
    self._vcpu_total = len(available_ids)
    return self._vcpu_total