Esempio n. 1
0
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]
if afs.defaultConfig.ProjectName != None :
    thisPrjObj=PS.getProjectByName(afs.defaultConfig.ProjectName)
    if thisPrjObj == None :
        myParser.error("Project \"%s\" does not exist" % afs.defaultConfig.ProjectName)
    if thisPrjObj.id != PrjObj.id :
        if not afs.defaultConfig.force :
            myParser.error("VolumeName \"%s\" not matched by given Project \"%s\"\n" % (VolumeName,afs.defaultConfig.ProjectName))
            sys.exit(1)
        PrjObj = thisPrjObj
    
Esempio n. 2
0
    if afs.defaultConfig.dpart != None :
        if not afs.defaultConfig.dpart in dstFS.parts : 
            sys.stderr.write("Partition %s does not exist on server %s\n" % (afs.defaultConfig.dpart, afs.defaultConfig.dsrv))
            sys.exit(2)
        else :
            reqDstPart=afs.defaultConfig.dpart  
    else :
        reqDstPart=None
else :
    dstFS=None
    if afs.defaultConfig.dpart != None :
        sys.stderr.write("Warning: ignoring given dpart=%s, because no dsrv has been specified.\n" % afs.defaultConfig.dpart)

# XXX we should handle everything internally with bytes
untilFree=parseHumanWriteableSize(afs.defaultConfig.untilfree)/1024
minUsage=parseHumanWriteableSize(afs.defaultConfig.minVolumeUsage)/1024
VolObj = Volume()
movedVolcount=0
for srcP in srcParts :
    print "Processing Partition %s...." % srcP
    # check if partition is freed enough
    parts=FS.getPartitions(afs.defaultConfig.ssrv)
    if parts[srcP]["free"] > untilFree and untilFree > 0 :
        print "already %s Bytes free on spart %s." % (afs.util.afsutil.humanReadableSize(parts[srcP]["free"]),srcP )
        continue
    # get list of volumes to move
    srcVolList=FS.getVolList(srcFS.servernames[0],srcP,cached=False)
    # get RW Volumes :
    RWVols=[]
    solitaryROVols=[]