From 30948aa6bf7d6a5fc214d54d9d050bd63b47496d Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Sat, 7 Feb 2009 09:03:44 +0000 Subject: [PATCH] Get rid of constants.HT_HVM_DEFAULT_BOOT_ORDER Confusingly, as a leftober from 1.2, there was a constants.HT_HVM_DEFAULT_BOOT_ORDER constant, with a value opposite to the default HV_BOOT_ORDER hv param that got enabled only if HV_BOOT_ORDER was set to None. Since setting it to None is very hard/impossible for the user, and we didn't handle other "empty" values (False, ''), we'll just force the parameter to have a valid value (after all we have a default, and that's the way we use hvparams) and get rid of the old constant altoghether. Reviewed-by: iustinp --- lib/constants.py | 1 - lib/hypervisor/hv_xen.py | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index ec9bd6681..0b43a128a 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -334,7 +334,6 @@ HTS_REQ_PORT = frozenset([HT_XEN_HVM, HT_KVM]) HTS_USE_VNC = frozenset([HT_XEN_HVM, HT_KVM]) HT_HVM_VNC_BASE_PORT = 5900 -HT_HVM_DEFAULT_BOOT_ORDER = 'dc' VNC_PASSWORD_FILE = _autoconf.SYSCONFDIR + "/ganeti/vnc-cluster-password" VNC_DEFAULT_BIND_ADDRESS = '0.0.0.0' diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 8b66b4aa7..b34b221d5 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -493,7 +493,7 @@ class XenHvmHypervisor(XenHypervisor): super(XenHvmHypervisor, cls).CheckParameterSyntax(hvparams) # boot order verification boot_order = hvparams[constants.HV_BOOT_ORDER] - if len(boot_order.strip("acdn")) != 0: + if not boot_order or len(boot_order.strip("acdn")) != 0: raise errors.HypervisorError("Invalid boot order '%s' specified," " must be one or more of [acdn]" % boot_order) @@ -567,10 +567,7 @@ class XenHvmHypervisor(XenHypervisor): config.write("device_model = '/usr/lib64/xen/bin/qemu-dm'\n") else: config.write("device_model = '/usr/lib/xen/bin/qemu-dm'\n") - if instance.hvparams[constants.HV_BOOT_ORDER] is None: - config.write("boot = '%s'\n" % constants.HT_HVM_DEFAULT_BOOT_ORDER) - else: - config.write("boot = '%s'\n" % instance.hvparams["boot_order"]) + config.write("boot = '%s'\n" % instance.hvparams[constants.HV_BOOT_ORDER]) config.write("sdl = 0\n") config.write("usb = 1\n") config.write("usbdevice = 'tablet'\n") -- GitLab