Exemplo n.º 1
0
def test_getstripe_invalid_path( testdir ):
    """
    Verify that getstripe throws an error for an invalid path
    """
    f = testdir.objects.values()[0][0]
    path = '{0}xyz'.format( f.path )
    with pytest.raises( Run_Cmd_Error ) as einfo:
        sinfo = pylut.getstripeinfo( '{0}xyz'.format( path ) )
    assert einfo.value.code == 2
    assert 'No such file or directory' in einfo.value.reason
Exemplo n.º 2
0
def test_getstripe_invalid_path(testdir):
    """
    Verify that getstripe throws an error for an invalid path
    """
    f = testdir.objects.values()[0][0]
    path = '{0}xyz'.format(f.path)
    with pytest.raises(Run_Cmd_Error) as einfo:
        sinfo = pylut.getstripeinfo('{0}xyz'.format(path))
    assert einfo.value.code == 2
    assert 'No such file or directory' in einfo.value.reason
Exemplo n.º 3
0
def test_getstripe_valid_paths( testdir ):
    """
    Verify stripecount and stripesize match expected values for files and dirs
    """
    testdir.reset()
    for inode, flist in testdir.objects.iteritems():
        for f in flist:
            if f.typ in [ 'd', 'f' ]:
                sinfo = pylut.getstripeinfo( f.path )
                assert sinfo.count == f.stripecount
                assert sinfo.size == f.stripesize
Exemplo n.º 4
0
def test_getstripe_valid_paths(testdir):
    """
    Verify stripecount and stripesize match expected values for files and dirs
    """
    testdir.reset()
    for inode, flist in testdir.objects.iteritems():
        for f in flist:
            if f.typ in ['d', 'f']:
                sinfo = pylut.getstripeinfo(f.path)
                assert sinfo.count == f.stripecount
                assert sinfo.size == f.stripesize
Exemplo n.º 5
0
Arquivo: fsitem.py Projeto: ncsa/pylut
 def stripeinfo(self):
     """
     Return stripe information, getting it if needed
     Lustre stripe is valid only for dirs and regular files
     None will be returned for non-regular files
     """
     try:
         rv = self._stripeinfo
     except AttributeError:
         if self.is_regular() or self.is_dir():
             self._stripeinfo = pylut.getstripeinfo(self.absname)
         else:
             self._stripeinfo = pylut.LustreStripeInfo()
     return self._stripeinfo
Exemplo n.º 6
0
Arquivo: fsitem.py Projeto: ncsa/pylut
 def stripeinfo( self ):
     """
     Return stripe information, getting it if needed
     Lustre stripe is valid only for dirs and regular files
     None will be returned for non-regular files
     """
     try:
         rv = self._stripeinfo
     except AttributeError:
         if self.is_regular() or self.is_dir():
             self._stripeinfo = pylut.getstripeinfo( self.absname )
         else:
             self._stripeinfo = pylut.LustreStripeInfo()
     return self._stripeinfo
Exemplo n.º 7
0
def test_setstripe_files( testdir ):
    """
    Verify resulting files have the correct stripe information
    """
    genr = ( f.path for f in testdir.files if f.typ == 'f' )
    for c in [ 1, 2 ]:
        for s in [ 524288, 1048576, 2097152 ]:
            for i in [ -1, 1, 2 ]:
                newpath = '{0}xyz'.format( genr.next() )
                pylut.setstripeinfo( newpath, count=c, size=s, offset=i )
                sinfo = pylut.getstripeinfo( newpath )
                assert sinfo.count == c
                assert sinfo.size == s
                if i > 0:
                    assert sinfo.offset == i
                else:
                    assert sinfo.offset >= 0
Exemplo n.º 8
0
def test_setstripe_files(testdir):
    """
    Verify resulting files have the correct stripe information
    """
    genr = (f.path for f in testdir.files if f.typ == 'f')
    for c in [1, 2]:
        for s in [524288, 1048576, 2097152]:
            for i in [-1, 1, 2]:
                newpath = '{0}xyz'.format(genr.next())
                pylut.setstripeinfo(newpath, count=c, size=s, offset=i)
                sinfo = pylut.getstripeinfo(newpath)
                assert sinfo.count == c
                assert sinfo.size == s
                if i > 0:
                    assert sinfo.offset == i
                else:
                    assert sinfo.offset >= 0
Exemplo n.º 9
0
def test_setstripe_dirs( testdir ):
    """
    Verify dirs get updated stripe settings
    """
    dirs = [ d.path for d in testdir.directories ]
    while len(dirs) < 18:
        dirs = dirs*2
    counter = 0
    for c in [ 1, 2 ]:
        for s in [ 524288, 1048576, 2097152 ]:
            for i in [ -1, 1, 2 ]:
                path = dirs[ counter ]
                pylut.setstripeinfo( path, count=c, size=s, offset=i )
                sinfo = pylut.getstripeinfo( path )
                assert sinfo.count == c
                assert sinfo.size == s
                assert sinfo.offset == i
                counter+=1
Exemplo n.º 10
0
def test_setstripe_dirs(testdir):
    """
    Verify dirs get updated stripe settings
    """
    dirs = [d.path for d in testdir.directories]
    while len(dirs) < 18:
        dirs = dirs * 2
    counter = 0
    for c in [1, 2]:
        for s in [524288, 1048576, 2097152]:
            for i in [-1, 1, 2]:
                path = dirs[counter]
                pylut.setstripeinfo(path, count=c, size=s, offset=i)
                sinfo = pylut.getstripeinfo(path)
                assert sinfo.count == c
                assert sinfo.size == s
                assert sinfo.offset == i
                counter += 1