Create state, scratch and /home in stacaccli-install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch enables creation of 3 additional filesystems during
stacaccli-install.

128M for local state information -- this is where puppet will put
its certs, ssh keys and whatever else the client needs persistent
copies of.  128M is certainly overkill in terms of size.

1G for local scratch.  This is what gets used instead of tmpfs for
the various non-persistent writable stuff.

Whatever space remains in the volume group is used for /home

Whee fun.




Index: common/config.py.in
===================================================================
RCS file: /usr/local/CVS/stacaccli/src/stacaccli/common/config.py.in,v
retrieving revision 1.3
diff -c -p -r1.3 config.py.in
*** common/config.py.in	3 Aug 2006 21:23:24 -0000	1.3
--- common/config.py.in	4 Aug 2006 01:07:54 -0000
*************** GRUB_INSTALL_PATH = os.path.join (GRUB_U
*** 71,76 ****
--- 71,80 ----
  # Location of mkinitrd
  MKINITRD_PATH = "/sbin/mkinitrd"
  
+ # Sizes of predefined partitions
+ STATE_SIZE = 128 * 1024 * 1024
+ SCRATCH_SIZE = 1024 * 1024 * 1024
+ 
  # Location of filesystem utils
  FS_UTILS_PATH = "/sbin"
  MKE2FS_PATH = os.path.join (FS_UTILS_PATH, "mke2fs")
Index: common/lvm.py
===================================================================
RCS file: /usr/local/CVS/stacaccli/src/stacaccli/common/lvm.py,v
retrieving revision 1.2
diff -c -p -r1.2 lvm.py
*** common/lvm.py	19 Jun 2006 17:16:48 -0000	1.2
--- common/lvm.py	4 Aug 2006 01:07:54 -0000
*************** def vgchange (vg, active):
*** 36,50 ****
  def lvcreate (vg, lv, size, readonly = False, origin = None):
      size_in_kb = (size + 1023) / 1024
      
      if readonly:
          perms = "r"
      else:
          perms = "rw"
      
      if origin is None:
!         logger.run_command (LVCREATE_PATH + " --size %sk -p %s --name %s %s" % (size_in_kb, perms, lv, vg))
      else:
!         logger.run_command (LVCREATE_PATH + " -s --size %sk -p %s --name %s %s" % (size_in_kb, perms, lv, origin))
  
  def lvconvert_to_snapshot (origin, cow, zero = True):
      zero_org = ""
--- 36,57 ----
  def lvcreate (vg, lv, size, readonly = False, origin = None):
      size_in_kb = (size + 1023) / 1024
      
+     # If caller did not specify a size, then we use the remaining
+     # space in the volume
+     if size_in_kb == 0:
+ 	sizestr = "$(/usr/sbin/vgs --noheadings -o vg_free --units k %s)" % (vg)
+     else:
+ 	sizestr = "%sk" % (size_in_kb)
+ 
      if readonly:
          perms = "r"
      else:
          perms = "rw"
      
      if origin is None:
!         logger.run_command (LVCREATE_PATH + " --size %s -p %s --name %s %s" % (sizestr, perms, lv, vg))
      else:
!         logger.run_command (LVCREATE_PATH + " -s --size %s -p %s --name %s %s" % (sizestr, perms, lv, origin))
  
  def lvconvert_to_snapshot (origin, cow, zero = True):
      zero_org = ""
*************** class VolumeGroupInfo:
*** 103,108 ****
--- 110,118 ----
                     are merged
        + @updatelv: the volume to which updates are downloaded to
                     before merging
+       + @statelv: the volume containing cached local state information
+       + @scratchlv: the volume used for temporary scratch space
+       + @homelv: the volume used for /home
  
      Each of the above LVs has a corresponding @lv_path member
      which contains the full path to the volume.
*************** class VolumeGroupInfo:
*** 120,130 ****
--- 130,146 ----
  
          self.originlv = rootlv + "_origin"
          self.updatelv = rootlv + "_update"
+         self.statelv = "state"
+         self.scratchlv = "scratch"
+         self.homelv = "home"
  
          self.rootlv_path = self._build_lv_path (self.rootlv)
          self.swaplv_path = self._build_lv_path (self.swaplv)
          self.originlv_path = self._build_lv_path (self.originlv)
          self.updatelv_path = self._build_lv_path ( self.updatelv)
+         self.statelv_path = self._build_lv_path (self.statelv)
+         self.scratchlv_path = self._build_lv_path (self.scratchlv)
+         self.homelv_path = self._build_lv_path (self.homelv)
          
      def _build_lv_path (self, lv):
          return os.path.join ("/dev", self.volumegroup, lv)
Index: install/installer.py
===================================================================
RCS file: /usr/local/CVS/stacaccli/src/stacaccli/install/installer.py,v
retrieving revision 1.3
diff -c -p -r1.3 installer.py
*** install/installer.py	3 Aug 2006 21:23:24 -0000	1.3
--- install/installer.py	4 Aug 2006 01:07:54 -0000
*************** class Install:
*** 159,164 ****
--- 159,194 ----
                        True,
                        self._vgi.originlv_path)
  
+     def _setup_scratchlv (self):
+         lvm.lvcreate (self._vgi.volumegroup, self._vgi.scratchlv, SCRATCH_SIZE)
+ 
+         logger.verbose ("Formatting and labelling stateless-rw partition '%s'" %
+                         self._vgi.scratchlv_path)
+         
+         logger.run_command (MKE2FS_PATH + " -j " + self._vgi.scratchlv_path)
+         logger.run_command (E2LABEL_PATH + " "
+                             + self._vgi.scratchlv_path + " stateless-rw")
+ 
+ 
+     def _setup_statelv (self):
+         lvm.lvcreate (self._vgi.volumegroup, self._vgi.statelv, STATE_SIZE)
+ 
+         logger.verbose ("Formatting and labelling stateless-state partition '%s'" %
+                         self._vgi.statelv_path)
+         
+         logger.run_command (MKE2FS_PATH + " -j " + self._vgi.statelv_path)
+         logger.run_command (E2LABEL_PATH + " "
+                             + self._vgi.statelv_path + " stateless-state")
+ 
+     def _setup_homelv (self):
+         lvm.lvcreate (self._vgi.volumegroup, self._vgi.homelv, 0)
+ 
+         logger.verbose ("Formatting and labelling /home partition '%s'" %
+                         self._vgi.homelv_path)
+         logger.run_command (MKE2FS_PATH + " -j " + self._vgi.homelv_path)
+         logger.run_command (E2LABEL_PATH + " "
+                             + self._vgi.homelv_path + " /home")
+ 
      #
      # FIXME: how can we sure we'll actually swapon this device?
      #        swapon or some other way to make sure it's in
*************** class Install:
*** 216,221 ****
--- 246,254 ----
              self._format_swaplv ()
              self._copy_image_to_originlv ()
              self._setup_rootlv ()
+             self._setup_scratchlv ()
+             self._setup_statelv ()
+             self._setup_homelv ()
  
              bootloader.update_bootloader (self._image,
                                            self._device,

[Index of Archives]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux