glusterfs

Форк
0
/
specgen.scm 
98 строк · 2.8 Кб
1
#!/usr/bin/guile -s
2
!#
3

4
;;; Copyright (c) 2007-2011 Gluster Inc. <http://www.gluster.com>
5
;;;  
6
;;; This program is free software; you can redistribute it and/or modify
7
;;; it under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 2 of the License, or
9
;;; (at your option) any later version.
10
;;;  
11
;;; This program is distributed in the hope that it will be useful,
12
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;  
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with this program; if not, write to the Free Software
18
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
;;;  
20

21
;;; This script lets you specify the xlator graph as a Scheme list
22
;;; and provides a function to generate the spec file for the graph.
23

24

25
(define (volume args)
26
  (apply
27
   (lambda (name type options)
28
     (lambda args
29
       (display "volume ") (display name) (newline)
30
       (display "  type ") (display type) (newline)
31
       (map (lambda (key-value-cons)
32
	      (let ((key (car key-value-cons))
33
		    (value (cdr key-value-cons)))
34
		(display "  option ") (display key) (display " ")
35
		(display value) (newline)))
36
	    options)
37
       (if (> (length args) 0)
38
	   (begin
39
	     (display "  subvolumes ")
40
	     (map (lambda (subvol)
41
		    (display subvol) (display " "))
42
		  args)
43
	     (newline)))
44
       (display "end-volume") (newline) (newline)
45
       name))
46
   args))
47

48
;; define volumes with names/type/options and bind to a symbol
49
;; relate them seperately (see below)
50
;; more convinient to seperate volume definition and relation
51

52
(define wb (volume '(wb0
53
		     performance/write-behind
54
		     ((aggregate-size . 0)
55
		      (flush-behind . off)
56
		      ))))
57

58
(define ra (volume '(ra0
59
		     performance/read-ahead
60
		     ((page-size . 128KB)
61
		      (page-count . 1)
62
		      ))))
63

64
(define ioc (volume '(ioc0
65
		      performance/io-cache
66
		      ((page-size . 128KB)
67
		       (cache-size . 64MB)
68
		      ))))
69

70
(define iot (volume '(iot0
71
		      performance/io-threads
72
		      ()
73
		      )))
74

75
(define client1 (volume '(client1
76
			  protocol/client
77
			  ((transport-type . tcp/client)
78
			   (remote-host . localhost)
79
			   (remote-subvolume . brick1)
80
			   ))))
81

82
(define client2 (volume '(client2
83
			  protocol/client
84
			  ((transport-type . tcp/client)
85
			   (remote-host . localhost)
86
			   (remote-subvolume . brick2)
87
			   ))))
88

89
(define unify (volume '(unify0
90
			cluster/unify
91
			((scheduler . rr)
92
			 ))))
93

94
;; relate the symbols to output a spec file
95
;; note: relating with symbols lets you change volume name in one place
96

97
(wb (ra (ioc (iot (unify (client1)
98
			 (client2))))))
99

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.