LGTM, thanks On Fri, Nov 8, 2013 at 5:24 PM, Jose A. Lopes <[email protected]> wrote:
> Change Xen domain configuration to preserve the domain state after > shutdown, as opposed to automatic reboot, which is the default > behaviour. > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/hypervisor/hv_xen.py | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py > index 742c8be..510ca9d 100644 > --- a/lib/hypervisor/hv_xen.py > +++ b/lib/hypervisor/hv_xen.py > @@ -949,6 +949,15 @@ class XenHypervisor(hv_base.BaseHypervisor): > % (constants.XEN_CMD_XL, > result.stderr)) > > > +def WriteXenConfigEvents(config, hvp): > + config.write("on_poweroff = 'preserve'\n") > + if hvp[constants.HV_REBOOT_BEHAVIOR] == > constants.INSTANCE_REBOOT_ALLOWED: > + config.write("on_reboot = 'restart'\n") > + else: > + config.write("on_reboot = 'destroy'\n") > + config.write("on_crash = 'restart'\n") > + > + > class XenPvmHypervisor(XenHypervisor): > """Xen PVM hypervisor interface""" > > @@ -1050,12 +1059,8 @@ class XenPvmHypervisor(XenHypervisor): > > if hvp[constants.HV_ROOT_PATH]: > config.write("root = '%s'\n" % hvp[constants.HV_ROOT_PATH]) > - config.write("on_poweroff = 'destroy'\n") > - if hvp[constants.HV_REBOOT_BEHAVIOR] == > constants.INSTANCE_REBOOT_ALLOWED: > - config.write("on_reboot = 'restart'\n") > - else: > - config.write("on_reboot = 'destroy'\n") > - config.write("on_crash = 'restart'\n") > + > + WriteXenConfigEvents(config, hvp) > config.write("extra = '%s'\n" % hvp[constants.HV_KERNEL_ARGS]) > > cpuid = hvp[constants.HV_XEN_CPUID] > @@ -1239,12 +1244,8 @@ class XenHvmHypervisor(XenHypervisor): > if pci_pass: > pci_pass_arr = pci_pass.split(";") > config.write("pci = %s\n" % pci_pass_arr) > - config.write("on_poweroff = 'destroy'\n") > - if hvp[constants.HV_REBOOT_BEHAVIOR] == > constants.INSTANCE_REBOOT_ALLOWED: > - config.write("on_reboot = 'restart'\n") > - else: > - config.write("on_reboot = 'destroy'\n") > - config.write("on_crash = 'restart'\n") > + > + WriteXenConfigEvents(config, hvp) > > cpuid = hvp[constants.HV_XEN_CPUID] > if cpuid: > -- > 1.8.4.1 > > Hrvoje Ribicic Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370
