Revision 931419e5 lib/hypervisor/hv_xen.py

b/lib/hypervisor/hv_xen.py
949 949
                                     % (constants.XEN_CMD_XL, result.stderr))
950 950

  
951 951

  
952
def WriteXenConfigEvents(config, hvp):
953
  config.write("on_poweroff = 'preserve'\n")
954
  if hvp[constants.HV_REBOOT_BEHAVIOR] == constants.INSTANCE_REBOOT_ALLOWED:
955
    config.write("on_reboot = 'restart'\n")
956
  else:
957
    config.write("on_reboot = 'destroy'\n")
958
  config.write("on_crash = 'restart'\n")
959

  
960

  
952 961
class XenPvmHypervisor(XenHypervisor):
953 962
  """Xen PVM hypervisor interface"""
954 963

  
......
1050 1059

  
1051 1060
    if hvp[constants.HV_ROOT_PATH]:
1052 1061
      config.write("root = '%s'\n" % hvp[constants.HV_ROOT_PATH])
1053
    config.write("on_poweroff = 'destroy'\n")
1054
    if hvp[constants.HV_REBOOT_BEHAVIOR] == constants.INSTANCE_REBOOT_ALLOWED:
1055
      config.write("on_reboot = 'restart'\n")
1056
    else:
1057
      config.write("on_reboot = 'destroy'\n")
1058
    config.write("on_crash = 'restart'\n")
1062

  
1063
    WriteXenConfigEvents(config, hvp)
1059 1064
    config.write("extra = '%s'\n" % hvp[constants.HV_KERNEL_ARGS])
1060 1065

  
1061 1066
    cpuid = hvp[constants.HV_XEN_CPUID]
......
1239 1244
    if pci_pass:
1240 1245
      pci_pass_arr = pci_pass.split(";")
1241 1246
      config.write("pci = %s\n" % pci_pass_arr)
1242
    config.write("on_poweroff = 'destroy'\n")
1243
    if hvp[constants.HV_REBOOT_BEHAVIOR] == constants.INSTANCE_REBOOT_ALLOWED:
1244
      config.write("on_reboot = 'restart'\n")
1245
    else:
1246
      config.write("on_reboot = 'destroy'\n")
1247
    config.write("on_crash = 'restart'\n")
1247

  
1248
    WriteXenConfigEvents(config, hvp)
1248 1249

  
1249 1250
    cpuid = hvp[constants.HV_XEN_CPUID]
1250 1251
    if cpuid:

Also available in: Unified diff