#!/usr/bin/python # prerequsites: # 1. root filesystem is in a VG. # 2. have free space in root VG to build up a docker pool. # 3. additional extra disk import dsstst, os, sys print "- start: " + os.path.basename(__file__) dsstst.check_root() dsstst.destroy_pool_and_extra_disk() if len(sys.argv) > 1: base = sys.argv[1] else: base = dsstst.base oldpe = dsstst.get_freepe(base) + dsstst.oldpe # Fill into 70% of free space to trigger auto-extension. # XFS has PE Size = 4MB. size = str(int(4 * oldpe * 0.7)) + 'MB' vg=dsstst.get_rootvg() dsstst.conf_and_start_docker( conf='DATA_SIZE=' + size + '\nCHUNK_SIZE=1024\nDEVS=' + dsstst.extra) dsstst.check_chunksize(size=1024, vg=vg) dsstst.check_percent( new = dsstst.get_freepe(base) + dsstst.get_freepe(dsstst.pextra), old = oldpe, percent=0.7) print "- pass: " + os.path.basename(__file__)
#!/usr/bin/python # prerequsites: # 1. root filesystem is in a VG. # 2. have free space in root VG to build up a docker pool. # 3. additional extra disk import dsstst, os, sys print "- start: " + os.path.basename(__file__) dsstst.check_root() dsstst.destroy_pool_and_extra_disk() vg=dsstst.get_rootvg() if len(sys.argv) > 1: base = sys.argv[1] else: base = dsstst.base oldpe = dsstst.oldpe + dsstst.get_freepe(dev = base) dsstst.conf_and_start_docker(conf='DATA_SIZE=80%FREE\nDEVS=' + dsstst.extra) dsstst.check_chunksize(size=512, vg=vg) dsstst.check_percent( new = dsstst.get_freepe(base) + dsstst.get_freepe(dsstst.pextra), old = oldpe , percent = 0.8) print "- pass: " + os.path.basename(__file__)
#!/usr/bin/python import dsstst, subprocess, os, sys print "- start: " + os.path.basename(__file__) # Storage is already configured with devicemapper driver. Can't configure it # with overlay driver. To override, remove /etc/sysconfig/docker-storage and # retry. dsstst.check_root() dsstst.destroy_pool_and_extra_disk() if os.path.isfile(dsstst.conf_storage): os.remove(dsstst.conf_storage) dsstst.conf_and_start_docker(conf='STORAGE_DRIVER=overlay') subprocess.call(['docker', 'pull', 'rhel7']) if subprocess.call(['docker', 'run', '--rm', 'rhel7', 'grep', '^overlay / overlay rw,', '/etc/mtab']) != 0: sys.exit("- error: unable to utilize overlayfs.") print "- pass: " + os.path.basename(__file__)
#!/usr/bin/python # prerequsites: # 1. root filesystem is on the second partion of a disk. # 2. virtual disk has been enlarged to $offset (5G by default) # 3. no GROWPART is set at start. import dsstst, os, sys offset = 5000000 dev = 'vda' print "- start: " + os.path.basename(__file__) dsstst.check_root_and_destroy_pool() old = dsstst.get_partsize(dev=dev) dsstst.conf_and_start_docker('GROWPART=true') if dsstst.get_partsize(dev=dev) - old <= offset: sys.exit('- error: partition growing size is unexpected.') print "- pass: " + os.path.basename(__file__)