From: John Dilley Date: Mon, 16 Nov 2015 17:42:10 +0000 (+0000) Subject: Allow NO_SAN_ROOT override X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5100333c7cb6e1a3ec88c135076b4f7dc5284c1b;p=xenrt-citrix%2Fxenrt.git Allow NO_SAN_ROOT override --- diff --git a/exec/xenrt/lib/esx/host.py b/exec/xenrt/lib/esx/host.py index 190d5c910..aa95a29f3 100755 --- a/exec/xenrt/lib/esx/host.py +++ b/exec/xenrt/lib/esx/host.py @@ -389,7 +389,7 @@ reboot pxecfg.linuxSetKernel("mboot.c32") pxecfg.linuxArgsKernelAdd("-c %s" % pxe.makeBootPath("boot.cfg")) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: diff --git a/exec/xenrt/lib/nativewindows/host.py b/exec/xenrt/lib/nativewindows/host.py index 2b7be9817..7570ba93b 100644 --- a/exec/xenrt/lib/nativewindows/host.py +++ b/exec/xenrt/lib/nativewindows/host.py @@ -147,7 +147,7 @@ class WindowsHost(xenrt.GenericHost): serport = self.lookup("SERIAL_CONSOLE_PORT", "0") serbaud = self.lookup("SERIAL_CONSOLE_BAUD", "115200") pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: diff --git a/exec/xenrt/lib/oraclevm/host.py b/exec/xenrt/lib/oraclevm/host.py index c2e9990b0..c4bbc87ee 100644 --- a/exec/xenrt/lib/oraclevm/host.py +++ b/exec/xenrt/lib/oraclevm/host.py @@ -153,7 +153,7 @@ umount /tmp/xenrttmpmount else: pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -258,7 +258,7 @@ umount /tmp/xenrttmpmount else: pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: diff --git a/exec/xenrt/lib/xenserver/host.py b/exec/xenrt/lib/xenserver/host.py index c0ba3fe80..66cf09034 100755 --- a/exec/xenrt/lib/xenserver/host.py +++ b/exec/xenrt/lib/xenserver/host.py @@ -670,6 +670,10 @@ class Host(xenrt.GenericHost): self.execdom0("md5sum /boot/%s" % imgFile)) xenrt.TEC().logverbose("initrd has been rebuilt") + @property + def mpathRoot(self): + return self.lookup("OPTION_ROOT_MPATH", False, boolean=True) and not self.lookup("FORCE_NO_ROOT_MPATH", False, boolean=True) and not self.lookup("NO_SAN_ROOT", False, boolean=True) + @property def xapiObject(self): """Gets a XAPI Host object for this Host @@ -1644,7 +1648,7 @@ done pxe.setSerial(serport, serbaud) if self.lookup("PXE_NO_PROMPT", False, boolean=True): pxe.setPrompt("0") - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -1768,9 +1772,7 @@ done # # Enable SSH into the installer to aid debug if installations fail # pxecfg.mbootArgsModule1Add("sshpassword=%s" % self.password) - optionRootMpath = self.lookup("OPTION_ROOT_MPATH", False, boolean=True) - - if optionRootMpath: + if self.mpathRoot: pxecfg.mbootArgsModule1Add("device_mapper_multipath=enabled") # Set up PXE for installer boot @@ -2156,8 +2158,7 @@ fi if xenrt.TEC().lookup("HOST_POST_INSTALL_REBOOT", False, boolean=True): self.reboot() - optionRootMpath = self.lookup("OPTION_ROOT_MPATH", False, boolean=True) - if optionRootMpath: + if self.mpathRoot: # Check to ensure that there is a multipath topology if we did multipath boot. if not len(self.getMultipathInfo()) > 0 : raise xenrt.XRTFailure("There is no multipath topology found with multipath boot") @@ -11386,7 +11387,7 @@ done pxe.setSerial(serport, serbaud) if self.lookup("PXE_NO_PROMPT", False, boolean=True): pxe.setPrompt("0") - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -11450,10 +11451,8 @@ done xenrt.TEC().warning("Using installer user extra Dom0 boot args %s" % (dom0_extra_args_user)) - optionRootMpath = self.lookup("OPTION_ROOT_MPATH", False, boolean=True) - - if optionRootMpath: - pxecfg.mbootArgsModule1Add("device_mapper_multipath=%s" % optionRootMpath) + if self.mpathRoot: + pxecfg.mbootArgsModule1Add("device_mapper_multipath=enabled") # Set up PXE for installer boot pxefile = pxe.writeOut(self.machine) diff --git a/exec/xenrt/lib/xenserver/install.py b/exec/xenrt/lib/xenserver/install.py index 264658181..f813574ba 100644 --- a/exec/xenrt/lib/xenserver/install.py +++ b/exec/xenrt/lib/xenserver/install.py @@ -723,7 +723,7 @@ sleep 30 pxe.setSerial(serport, serbaud) if self.host.lookup("PXE_NO_PROMPT", False, boolean=True): pxe.setPrompt("0") - chain = self.host.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -839,9 +839,7 @@ sleep 30 # # Enable SSH into the installer to aid debug if installations fail # pxecfg.mbootArgsModule1Add("sshpassword=%s" % self.host.password) - optionRootMpath = self.host.lookup("OPTION_ROOT_MPATH", False, boolean=True) - - if optionRootMpath: + if self.mpathRoot: pxecfg.mbootArgsModule1Add("device_mapper_multipath=enabled") # Set up PXE for installer boot diff --git a/exec/xenrt/objects.py b/exec/xenrt/objects.py index 630d6f86b..ac4a26058 100755 --- a/exec/xenrt/objects.py +++ b/exec/xenrt/objects.py @@ -5686,7 +5686,7 @@ class GenericHost(GenericPlace): serport = self.lookup("SERIAL_CONSOLE_PORT", "0") serbaud = self.lookup("SERIAL_CONSOLE_BAUD", "115200") pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -5820,7 +5820,7 @@ class GenericHost(GenericPlace): serport = self.lookup("SERIAL_CONSOLE_PORT", "0") serbaud = self.lookup("SERIAL_CONSOLE_BAUD", "115200") pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -5975,7 +5975,7 @@ exit 0 # Construct a PXE target pxe = xenrt.PXEBoot() pxe.setSerial(serport, serbaud) - chain = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + chain = self.getChainBoot() if chain: pxe.addEntry("local", boot="chainlocal", options=chain) else: @@ -6829,27 +6829,44 @@ chain tftp://${next-server}/%s return subnetMask,gateway - def _getDisks(self, var, sdfallback, count, ccissIfAvailable, legacySATA): + def getChainBoot(self, noSan=False): + noSan = noSan or self.lookup("NO_SAN_ROOT", False, boolean=True) + ret = None + if noSan: + ret = self.lookup("PXE_CHAIN_LOCAL_BOOT_NOSAN", None) + if not ret: + ret = self.lookup("PXE_CHAIN_LOCAL_BOOT", None) + return ret + + def _getDisks(self, var, sdfallback, count, ccissIfAvailable, legacySATA, noSan): + noSan = noSan or self.lookup("NO_SAN_ROOT", False, boolean=True) disks = None - try: - if ccissIfAvailable: - disks = self.lookup([var, "CCISS"]) - else: - disks = self.lookup([var, "SCSI"]) - except: - pass - try: - if legacySATA: - disks = self.lookup([var, "LEGACY_SATA"]) - else: - disks = self.lookup([var, "SATA"]) - except: - pass - if not disks: - disks = self.lookup(var, None) - # REQ-35: (Better) temp fix until we fix all of the config files - if not legacySATA and disks and "scsi-SATA" in "".join(disks): - disks = None + if noSan: + varlist = ["%s_NOSAN", var] + else: + varlist = [var] + for v in varlist: + try: + if ccissIfAvailable: + disks = self.lookup([var, "CCISS"]) + else: + disks = self.lookup([var, "SCSI"]) + except: + pass + try: + if legacySATA: + disks = self.lookup([var, "LEGACY_SATA"]) + else: + disks = self.lookup([var, "SATA"]) + except: + pass + if not disks: + disks = self.lookup(var, None) + # REQ-35: (Better) temp fix until we fix all of the config files + if not legacySATA and disks and "scsi-SATA" in "".join(disks): + disks = None + if disks: + break if not disks and sdfallback: disks = string.join(map(lambda x:"sd"+chr(97+x), range(count))) if not disks: @@ -6857,14 +6874,14 @@ chain tftp://${next-server}/%s else: return string.split(disks)[:count] - def _getMainDisks(self, count, ccissIfAvailable, legacySATA): - return self._getDisks("OPTION_CARBON_DISKS", True, count=count, ccissIfAvailable=ccissIfAvailable, legacySATA=legacySATA) + def _getMainDisks(self, count, ccissIfAvailable, legacySATA, noSan): + return self._getDisks("OPTION_CARBON_DISKS", True, count=count, ccissIfAvailable=ccissIfAvailable, legacySATA=legacySATA, noSan=noSan) - def getInstallDisk(self, ccissIfAvailable=False, legacySATA=False): - return self._getMainDisks(ccissIfAvailable=ccissIfAvailable, count=1, legacySATA=legacySATA)[0] + def getInstallDisk(self, ccissIfAvailable=False, legacySATA=False, noSan=False): + return self._getMainDisks(ccissIfAvailable=ccissIfAvailable, count=1, legacySATA=legacySATA, noSan=noSan)[0] - def getGuestDisks(self, count=1, ccissIfAvailable=False, legacySATA=False): - disks = self._getDisks("OPTION_GUEST_DISKS", False, count=count, ccissIfAvailable=ccissIfAvailable, legacySATA=legacySATA) + def getGuestDisks(self, count=1, ccissIfAvailable=False, legacySATA=False, noSan=False): + disks = self._getDisks("OPTION_GUEST_DISKS", False, count=count, ccissIfAvailable=ccissIfAvailable, legacySATA=legacySATA, noSan=noSan) if disks: return disks else: