Revision 4888a609 lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
532 532
      hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
533 533
    constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
534 534
    constants.HV_CPU_TYPE: hv_base.NO_CHECK,
535
    constants.HV_CPU_CORES: hv_base.NO_CHECK,
536
    constants.HV_CPU_THREADS: hv_base.NO_CHECK,
537
    constants.HV_CPU_SOCKETS: hv_base.NO_CHECK,
535 538
    }
536 539

  
537 540
  _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
......
617 620
      elif arg == "-m":
618 621
        memory = int(arg_list.pop(0))
619 622
      elif arg == "-smp":
620
        vcpus = int(arg_list.pop(0))
623
        vcpus = int(arg_list.pop(0).split(",")[0])
621 624

  
622 625
    if instance is None:
623 626
      raise errors.HypervisorError("Pid %s doesn't contain a ganeti kvm"
......
1000 1003
        done in L{_ExecuteKVMRuntime}
1001 1004

  
1002 1005
    """
1003
    # pylint: disable=R0914,R0915
1006
    # pylint: disable=R0912,R0914,R0915
1004 1007
    _, v_major, v_min, _ = self._GetKVMVersion()
1008
    hvp = instance.hvparams
1005 1009

  
1006 1010
    pidfile = self._InstancePidFile(instance.name)
1007 1011
    kvm = constants.KVM_PATH
......
1010 1014
    # used just by the vnc server, if enabled
1011 1015
    kvm_cmd.extend(["-name", instance.name])
1012 1016
    kvm_cmd.extend(["-m", instance.beparams[constants.BE_MAXMEM]])
1013
    kvm_cmd.extend(["-smp", instance.beparams[constants.BE_VCPUS]])
1017

  
1018
    smp_list = ["%s" % instance.beparams[constants.BE_VCPUS]]
1019
    if hvp[constants.HV_CPU_CORES]:
1020
      smp_list.append("cores=%s" % hvp[constants.HV_CPU_CORES])
1021
    if hvp[constants.HV_CPU_THREADS]:
1022
      smp_list.append("threads=%s" % hvp[constants.HV_CPU_THREADS])
1023
    if hvp[constants.HV_CPU_SOCKETS]:
1024
      smp_list.append("sockets=%s" % hvp[constants.HV_CPU_SOCKETS])
1025

  
1026
    kvm_cmd.extend(["-smp", ",".join(smp_list)])
1027

  
1014 1028
    kvm_cmd.extend(["-pidfile", pidfile])
1015 1029
    kvm_cmd.extend(["-balloon", "virtio"])
1016 1030
    kvm_cmd.extend(["-daemonize"])
......
1020 1034
        constants.INSTANCE_REBOOT_EXIT:
1021 1035
      kvm_cmd.extend(["-no-reboot"])
1022 1036

  
1023
    hvp = instance.hvparams
1024 1037
    kernel_path = hvp[constants.HV_KERNEL_PATH]
1025 1038
    if kernel_path:
1026 1039
      boot_disk = boot_cdrom = boot_floppy = boot_network = False

Also available in: Unified diff