]> xenbits.xensource.com Git - xenrt-citrix/xenrt.git/commitdiff
Allow NO_SAN_ROOT override
authorJohn Dilley <john.dilley@citrix.com>
Mon, 16 Nov 2015 17:42:10 +0000 (17:42 +0000)
committerJohn Dilley <john.dilley@citrix.com>
Mon, 16 Nov 2015 17:42:10 +0000 (17:42 +0000)
exec/xenrt/lib/esx/host.py
exec/xenrt/lib/nativewindows/host.py
exec/xenrt/lib/oraclevm/host.py
exec/xenrt/lib/xenserver/host.py
exec/xenrt/lib/xenserver/install.py
exec/xenrt/objects.py

index 190d5c910cc59c940afa3736b12c5df05fdb0b25..aa95a29f3b61fc08f24d1e787521a37206d43826 100755 (executable)
@@ -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:
index 2b7be9817d850e30e967ea8d02ba722b811b301a..7570ba93b4d9a26586fe4d07f4f7b26aa826c6ed 100644 (file)
@@ -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:
index c2e9990b075814256634135204a0bd3d7494a6d8..c4bbc87ee9189877099bb8dbf592745c81345a9f 100644 (file)
@@ -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:
index c0ba3fe80f0cf6e996d207315f80ee24bcc8f6f6..66cf090348766f1ff7f1970827c671495dc297b9 100755 (executable)
@@ -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)
index 264658181e3ed9b37e19be39eebaed1c6d8e4a9e..f813574bacb26b108711c6cbdc4b2fc5607fcd16 100644 (file)
@@ -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
index 630d6f86bb28309f15c09b2519fc1b802edb9755..ac4a26058876442b2515e6fd485fa5ca697beeed 100755 (executable)
@@ -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: