Revision 945a7e67

b/lib/hypervisor/hv_kvm.py
1419 1419
    # instance is not already paused and if we are not going to accept a
1420 1420
    # migrating instance. In the latter case, pausing is not needed.
1421 1421
    start_kvm_paused = not (_KVM_START_PAUSED_FLAG in kvm_cmd) and not incoming
1422
    if start_kvm_paused:
1423
      kvm_cmd.extend([_KVM_START_PAUSED_FLAG])
1422 1424

  
1423 1425
    # Note: CPU pinning is using up_hvp since changes take effect
1424 1426
    # during instance startup anyway, and to avoid problems when soft
......
1426 1428
    cpu_pinning = False
1427 1429
    if up_hvp.get(constants.HV_CPU_MASK, None):
1428 1430
      cpu_pinning = True
1429
      if start_kvm_paused:
1430
        kvm_cmd.extend([_KVM_START_PAUSED_FLAG])
1431 1431

  
1432 1432
    if security_model == constants.HT_SM_POOL:
1433 1433
      ss = ssconf.SimpleStore()
......
1484 1484

  
1485 1485
    # If requested, set CPU affinity and resume instance execution
1486 1486
    if cpu_pinning:
1487
      try:
1488
        self._ExecuteCpuAffinity(instance.name, up_hvp[constants.HV_CPU_MASK])
1489
      finally:
1490
        if start_kvm_paused:
1491
          # To control CPU pinning, the VM was started frozen, so we need
1492
          # to resume its execution, but only if freezing was not
1493
          # explicitly requested.
1494
          # Note: this is done even when an exception occurred so the VM
1495
          # is not unintentionally frozen.
1496
          self._CallMonitorCommand(instance.name, self._CONT_CMD)
1487
      self._ExecuteCpuAffinity(instance.name, up_hvp[constants.HV_CPU_MASK])
1488

  
1489
    if start_kvm_paused:
1490
      # To control CPU pinning, ballooning, and vnc/spice passwords the VM was
1491
      # started in a frozen state. If freezing was not explicitely requested
1492
      # resume the vm status.
1493
      self._CallMonitorCommand(instance.name, self._CONT_CMD)
1497 1494

  
1498 1495
  def StartInstance(self, instance, block_devices, startup_paused):
1499 1496
    """Start an instance.

Also available in: Unified diff