コード例 #1
0
ファイル: DiskDir.py プロジェクト: steveh/glusterfs
 def delete(self):
     if self.empty():
         #For delete account.
         if os.path.ismount(self.datadir):
             clean_metadata(self.datadir)
         else:
             rmdirs(self.datadir)
         self.dir_exists = False
コード例 #2
0
ファイル: DiskDir.py プロジェクト: zhufeng001/gluster
 def delete(self):
     if self.empty():
         #For delete account.
         if os.path.ismount(self.datadir):
             clean_metadata(self.datadir)
         else:
             rmdirs(self.datadir)
         self.dir_exists = False
コード例 #3
0
 def test_clean_metadata(self):
     path = "/tmp/foo/c"
     expected_d = { 'a': 'y' * 150000 }
     expected_p = pickle.dumps(expected_d, utils.PICKLE_PROTOCOL)
     for i in range(0,3):
         xkey = _xkey(path, "%s%s" % (utils.METADATA_KEY, i or ''))
         _xattrs[xkey] = expected_p[:utils.MAX_XATTR_SIZE]
         expected_p = expected_p[utils.MAX_XATTR_SIZE:]
     assert not expected_p
     utils.clean_metadata(path)
     assert _xattr_op_cnt['remove'] == 4, "%r" % _xattr_op_cnt
コード例 #4
0
 def test_clean_metadata(self):
     path = "/tmp/foo/c"
     expected_d = {"a": "y" * 150000}
     expected_p = serialize_metadata(expected_d)
     for i in range(0, 3):
         xkey = _xkey(path, "%s%s" % (utils.METADATA_KEY, i or ""))
         _xattrs[xkey] = expected_p[: utils.MAX_XATTR_SIZE]
         expected_p = expected_p[utils.MAX_XATTR_SIZE :]
     assert not expected_p
     utils.clean_metadata(path)
     assert _xattr_op_cnt["remove"] == 4, "%r" % _xattr_op_cnt
コード例 #5
0
 def test_clean_metadata_err(self):
     path = "/tmp/foo/c"
     xkey = _xkey(path, utils.METADATA_KEY)
     _xattrs[xkey] = pickle.dumps({ 'a': 'y' }, utils.PICKLE_PROTOCOL)
     _xattr_err[xkey] = errno.EOPNOTSUPP
     try:
         utils.clean_metadata(path)
     except IOError as e:
         assert e.errno == errno.EOPNOTSUPP
         assert _xattr_op_cnt['remove'] == 1, "%r" % _xattr_op_cnt
     else:
         self.fail("Expected an IOError exception on remove")
コード例 #6
0
 def test_clean_metadata_err(self):
     path = "/tmp/foo/c"
     xkey = _xkey(path, utils.METADATA_KEY)
     _xattrs[xkey] = serialize_metadata({"a": "y"})
     _xattr_rem_err[xkey] = errno.EOPNOTSUPP
     try:
         utils.clean_metadata(path)
     except IOError as e:
         assert e.errno == errno.EOPNOTSUPP
         assert _xattr_op_cnt["remove"] == 1, "%r" % _xattr_op_cnt
     else:
         self.fail("Expected an IOError exception on remove")