Exemplo n.º 1
0
    #
    # Now do the same thing for the file system in which the directory and its
    # entries are to live.
    #
    if not celestefs.fileSystemExists(fileSystemName):
        fsAttrs = {
            "MaintainSerialNumbers" : "false"
        }
        celestefs.mkfs(fileSystemName, fileSystemPassword, attrs=fsAttrs)

    #
    # If it doesn't already exist, create the file.
    #
    path = "/%s/%s" % (fileSystemName, celesteName)
    if not celestefs.fileExists(path):
        fileAttrs = {
            "CacheEnabled" : "true",
            "ContentType" : "text/plain",
            "ReplicationParameters" : replicationParams
        }
        celestefs.create(path, attrs=fileAttrs)

    #
    # Repeatedly ingest and fill the file, read it back to compare it with the
    # original, and truncate it.  (If profiling is enabled, each repetition
    # will append information to timingsFile.)
    #
    remainingRepetitions = repetitions
    while repetitions <= 0 or remainingRepetitions > 0:
        pCat = Popen(["/bin/cat", localFile], stdout=PIPE)
Exemplo n.º 2
0
    else:
        inFileName = "/etc/passwd"

    #
    # Set the file's location in Celeste to be the leaf name part of the input
    # file name, placed directly in the root directory of our Celeste file
    # system.
    #
    celesteFilePath = sep + fileSystemName + sep + inFileName.split(sep)[-1]
    celesteFilePath2 = sep + fileSystemName + sep + inFileName.split(sep)[-1] + \
        "2"

    #
    # Does the file we're to ingest already exist in Celeste?
    #
    if not celestefs.fileExists(celesteFilePath):
        print >> stderr, "%s does not exist" % celesteFilePath
        celestefs.create(celesteFilePath)
    else:
        print >> stderr, "%s exists" % celesteFilePath
    if not celestefs.fileExists(celesteFilePath2):
        print >> stderr, "%s does not exist" % celesteFilePath2
        celestefs.create(celesteFilePath2)
    else:
        print >> stderr, "%s exists" % celesteFilePath2

    #
    # Write the file's contents if necessary.
    #
    statOutput = celestefs.stat(celesteFilePath2, options=["-s"])
    fileSize = int(statOutput.split()[1])
Exemplo n.º 3
0
    c.verbose = True

    if not c.credentialExists(name):
        c.mkid()

    if not c.fileSystemExists(name):
        if not c.mkfs(name, name):
            print "mkfs(%s, %s) failed" % (name, name)
            exit(1)

    filename = "/" + name + "/" + "file"

    #
    # Create or truncate the test file, as approriate.
    #
    if not c.fileExists(filename):
        createAttrs = {
            # "BlockSize" : "3"
            # "BlockSize" : "16"
        }
        c.create(filename, contentType="text/plain", attrs=createAttrs)
    else:
        c.setLength(filename, 0)

    #
    # Write a sequence of characters that give clues to their offsets in the
    # file.
    #
    p = c.pwrite(filename)
    p.stdin.write("0123456789012345678901234567890123456789")
    p.communicate()