Example #1
0
from afs.lla.FileSystemLLA import FileSystemLLA


myParser=argparse.ArgumentParser(parents=[afs.argParser], add_help=False)
myParser.add_argument("--volname", dest="VolumeName", required=True, help="Name of Volume")
myParser.add_argument("--voltype", dest="VolumeType", default="RW", help="Type of Volume")
myParser.add_argument("--size", dest="VolumeSize", default="5000", help="Size of Volume in KB")
myParser.add_argument("--mpt", dest="Mountpoint", help="Mountpoint for the new volume.")
myParser.add_argument("--mpttype", dest="MountpointType", default="RW", choices=['RW', 'RO'], help="Type of mountpoint: RW or RO. Defaults to RW.")
myParser.add_argument("--aclpath", dest="ACLOrigin", help="path in AFS to copy ACLs from.")
myParser.add_argument("--prj", dest="ProjectName", help="Name of Project")
myParser.add_argument("--force", action='store_true', dest="force", default=False, help="force creation, even if Volume does not fit in given project")

parseDefaultConfig(myParser)
VD=VolumeLLA()
VlD=VLDbLLA()
FsD=FileSystemLLA()

VolumeType = afs.defaultConfig.VolumeType
if afs.defaultConfig.VolumeName[-9:] == ".readonly"  :
    VolumeName = afs.defaultConfig.VolumeName[:-9]
    VolumeType = "RO"
else :
    VolumeName = afs.defaultConfig.VolumeName

VolSize=parseHumanWriteableSize(afs.defaultConfig.VolumeSize)/1024
PS=ProjectService()
# we get a list of Projects, sorted by the Nesting Level.
# only get the most specific one

PrjObj=PS.getProjectsByVolumeName(VolumeName)[0]
Example #2
0
group.add_argument("--onlyproject", dest="onlyProjects", action="append", help="only move volumes of given project.")
myParser.add_argument("--dryrun",action="store_true", help="Just print out what would be done, but don't do it.")
myParser.add_argument("--maxnum", default = 0, type=int, help="max number of Volumes to move.")
myParser.add_argument("--untilfree", default = "0", help="move until # is free on spart.")
myParser.add_argument("--rwvols", dest="moveRWVols", default=False, action="store_true", help="move rwvols with their accompanying ROs.")
myParser.add_argument("--solitaryrovols", dest="moveSolitaryROVols", default=False, action="store_true", help="move solitary rovols.")
myParser.add_argument("--minsize", dest="minVolumeUsage", default="0", help="only move volumes with minimalsize of")
myParser.add_argument("--osdvolumes", dest="moveOSDVOlumes", default=False, action="store_true", help="also move OSD-Volumes")


parseDefaultConfig(myParser)
FS=OSDFsService()
PS=ProjectService()
VS=OSDVolService()
VD=VolumeLLA()
VlD=VLDbLLA()

if not afs.defaultConfig.moveRWVols and not afs.defaultConfig.moveSolitaryROVols :
    sys.stderr.write("If you want to nmake me do anything, specify --rwvols and/or --solitaryrovols\n")
    sys.exit(1)

if afs.defaultConfig.ignoreRX != None :
    ignoreRX=[]
    for rx in afs.defaultConfig.ignoreRX :
        try :
            ignoreRX.append(re.compile(rx))
        except :
            sys.stderr.write("Cannot compile regular expression: '%s'\n" % rx)
            sys.exit(1)
elif afs.defaultConfig.onlyRX != None :
    onlyRX=[]