'Create libvirt CPU config according to VirtCPUModel object.
:param:vcpu_model: VirtCPUModel object.
:return: vconfig.LibvirtConfigGuestCPU.'

def _vcpu_model_to_cpu_config(self, vcpu_model):

    cpu_config = vconfig.LibvirtConfigGuestCPU()
    cpu_config.arch = vcpu_model.arch
    cpu_config.model = vcpu_model.model
    cpu_config.mode = vcpu_model.mode
    cpu_config.match = vcpu_model.match
    cpu_config.vendor = vcpu_model.vendor
    if vcpu_model.topology:
        cpu_config.sockets = vcpu_model.topology.sockets
        cpu_config.cores = vcpu_model.topology.cores
        cpu_config.threads = vcpu_model.topology.threads
    if vcpu_model.features:
        for f in vcpu_model.features:
            xf = vconfig.LibvirtConfigGuestCPUFeature()
            xf.name = f.name
            xf.policy = f.policy
            cpu_config.features.add(xf)
    return cpu_config
