Exemplo n.º 1
0
group = myParser.add_mutually_exclusive_group()
group.add_argument("--ignorerx", dest="ignoreRX", action="append",  help="regEx for volumenames to ignore. All volumes not matching this will be moved.")
group.add_argument("--onlyrx", dest="onlyRX", action="append", help="regEx for volumenames to include all volumes not matching this will be ignored.")
group.add_argument("--ignoreproject", dest="ignoreProjects", action="append", help="ignore volumes of given project.")
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 :
Exemplo n.º 2
0
myParser=argparse.ArgumentParser(parents=[afs.argParser], add_help=False)
myParser.add_argument("--src", default="", help="server[_part] to empty")
myParser.add_argument("--dst" ,default="", help="server[_part] to be filled")

parseDefaultConfig(myParser)

if afs.defaultConfig.src == ""  :
    print "source-server required."
    sys.exit(0)  

if afs.defaultConfig.dst == ""  :
    print "emptying by project not implemented yet."
    sys.exit(0)  


FS=OSDFsService()
VS=OSDVolService()


if "_" in afs.defaultConfig.src :
    try :
        srcSrv,srcPart=afs.defaultConfig.src.split("_")
    except :
        sys.stderr.write("cannot parse server_partition %s" % afs.defaultConfig.src)
        sys.exit(1)
else :
   srcSrv = afs.defaultConfig.src
   srcPart = ""
    
srcFS=FS.getFileServer(srcSrv)
if srcFS == None :