Skip to content

Instantly share code, notes, and snippets.

@aravindavk
aravindavk / cli.md
Last active August 31, 2017 08:21
Glusterd2 CLI and Plugin

Gd2 exposes REST APIs and CLI is one consumer of these APIs.

+------------+                                          +--------------------+
|    gd2     |------REST APIs---------------------------| restclient --- CLI |
+------------+                                          +--------------------+

restclient is a Go library available in github.com/gluster/glusterd2/pkg/restclient

To add a CLI subcommand,

@aravindavk
aravindavk / crawl_and_worker.py
Created May 29, 2017 11:09
Crawl and Worker
# Popen find command and start a thread to distribute the load
from errno import ENOENT
import logging
import os
import subprocess
import sys
from threading import Thread, RLock
import time
outfile = None
@aravindavk
aravindavk / Main.elm
Last active June 23, 2016 13:33
elm-lang JS port Example - Sending Elm Record as JS Object
-- ELM VERSION 0.17.0
port module Converter exposing (..)
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-- MAIN
@aravindavk
aravindavk / dirname_from_gfid.py
Last active February 24, 2016 08:46
To find directory path from GFID. Usage: python dirname_from_gfid.py <BRICK_ROOT> <GFID>
#!/usr/bin/env python
import os
import sys
ROOT_GFID = "00000000-0000-0000-0000-000000000001"
def symlink_gfid_to_path(brick, gfid):
"""
Each directories are symlinked to file named GFID
@aravindavk
aravindavk / glusterrest_glusterd_1.0.md
Last active December 21, 2015 10:45
Gluster REST Server - A solution for Glusterd 1.0

Root Endpoint and Version

Root endpoint will be http(s)://hostname/v1

Client Errors

Unauthorized access will result in 401 UnAuthorized response.

HTTP/1.1 401 Unauthorized

Content-Type: application/json

import xattr
import sys
import os
ROOT_GFID = "00000000-0000-0000-0000-000000000001"
PFX = "user.pgfid"
def symlink_gfid_to_path(brick, gfid):
import uuid
import xattr
import os
from hashlib import md5
import sys
IGNORE_DIRS = [".glusterfs", ".trashcan"]
PFX = "user.pgfid"

Source Tree

$SRC/
  - xlators/
      - features/
          - changelogs/
              - lib/ # Changelog API
              - src/ # Changelog Translator
  - geo-replication/
  • src/ # gsyncd shell and other scripts required for Geo-rep create
@aravindavk
aravindavk / find_gfid_issues.py
Last active November 15, 2015 09:12
python find_gfid_issues.py <BRICK_PATH>
import sys
import os
import xattr
import uuid
from errno import ENODATA
IGNORE_DIRS = [".glusterfs", ".trashcan"]
#!/usr/bin/python
import random
import unittest
on_disk = None
class Error(Exception):
pass