drbd 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +89 -57
  2. data/VERSION +1 -1
  3. data/lib/drbd.rb +2 -0
  4. metadata +3 -3
data/README.rdoc CHANGED
@@ -23,63 +23,95 @@ Ruby wrapper for DRBD
23
23
 
24
24
 
25
25
  == How it works
26
- # simply fetch data from remote host
27
- d = Drbd.new("fqdn.domain.tld")
28
-
29
- # you can specify command to be executed
30
-
31
- d = Drbd.new("fqdn.domain.tld", :command => 'sudo /sbin/drbdadm')
32
-
33
- # obtain array of configured resources
34
- r = d.resources.first
35
-
36
- # get resource name
37
- r.name
38
-
39
- # get resource protocol
40
- r.protocol
41
-
42
- # get hosts for resource
43
- r.hosts
44
-
45
- # get status for resource
46
- r.status
47
-
48
- # get node addresses
49
- r.hosts.map{|h| h.address }
50
-
51
- # get status
52
- # resource status is hash with keys:
53
- # [:cs, :resynced_percent, :minor, :ro1, :ds1, :ro2, :ds2, :name]
54
- r.status
55
-
56
- # find resource by name
57
- r = d.find_resource_by_name("r0")
58
-
59
- # find resource by backing disk
60
- r = d.find_resource_by_disk("/dev/volgroup-logvolume--name")
61
-
62
- # true if both of devices are UpToDate
63
- r.consinstent?
64
-
65
- # true if resynced_percent is present in status
66
- r.resync_running?
67
-
68
- # true if resource status is "Connected"
69
- r.up?
70
-
71
- # true if resource status is "Unconfigured"
72
- r.down?
73
-
74
- # perform drbdadm up on resource (use at your own risk!)
75
- r.up!
76
-
77
- # perform drbdadm down on resource (use at your own risk!)
78
- r.down!
79
-
80
- # perform forced drbdadm create-md on resource (use at your own risk!)
81
- r.init_metadata
82
-
26
+ - simply fetch data from remote host
27
+
28
+ <tt>d = Drbd.new("fqdn.domain.tld")</tt>
29
+
30
+ you can specify command to be executed
31
+
32
+ <tt>d = Drbd.new("fqdn.domain.tld", :command => 'sudo /sbin/drbdadm')</tt>
33
+
34
+ - obtain array of configured configured resources
35
+
36
+ <tt>r = d.resources.first</tt>
37
+
38
+ - get resource name
39
+
40
+ <tt>r.name</tt>
41
+
42
+ - get resource protocol
43
+
44
+ <tt>r.protocol</tt>
45
+
46
+ - get hosts for resource
47
+
48
+ <tt>r.hosts</tt>
49
+
50
+ - get status for resource
51
+
52
+ <tt>r.status</tt>
53
+
54
+ - get node addresses
55
+
56
+ <tt>r.hosts.map{|h| h.address }</tt>
57
+
58
+ - get status
59
+
60
+ resource status is hash with keys:
61
+
62
+ [:cs, :resynced_percent, :minor, :ro1, :ds1, :ro2, :ds2, :name]
63
+
64
+ <tt>r.status</tt>
65
+
66
+ - find resource by name
67
+
68
+ <tt>r = d.find_resource_by_name("r0")</tt>
69
+
70
+ - find resource by backing disk
71
+
72
+ <tt>r = d.find_resource_by_disk("/dev/volgroup-logvolume--name")</tt>
73
+
74
+ - true if both of devices are UpToDate
75
+
76
+ <tt>r.consinstent?</tt>
77
+
78
+ - true if resynced_percent is present in status
79
+
80
+ <tt>r.resync_running?</tt>
81
+
82
+ - true if resource status is "Connected"
83
+
84
+ <tt>r.up?</tt>
85
+
86
+ - true if resource status is "Unconfigured"
87
+
88
+ <tt>r.down?</tt>
89
+
90
+ - stateless perform drbdadm up on resource (use at your own risk!)
91
+
92
+ <tt>r.up!</tt>
93
+
94
+ - stateless perform drbdadm down on resource (use at your own risk!)
95
+
96
+ <tt>r.down!</tt>
97
+
98
+ - stateless perform forced drbdadm create-md on resource (use at your own risk!)
99
+
100
+ if resource is not down, returns false and does nothing
101
+
102
+ <tt>r.init_metadata</tt>
103
+
104
+
105
+
106
+ - back-reference to the DRBD object
107
+
108
+ <tt>r.drbd</tt>
109
+
110
+ - uptate status of all resources
111
+
112
+ <tt>r.drbd.load_status!</tt>
113
+
114
+ <tt>d.load_status!</tt>
83
115
 
84
116
  == TODO
85
117
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/drbd.rb CHANGED
@@ -97,6 +97,7 @@ class DRBD
97
97
  command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
98
98
  system(command)
99
99
  drbd.load_status!
100
+ nil
100
101
  end
101
102
 
102
103
  def down!
@@ -104,6 +105,7 @@ class DRBD
104
105
  command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
105
106
  system(command)
106
107
  drbd.load_status!
108
+ nil
107
109
  end
108
110
 
109
111
  def init_metadata!
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drbd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Kliment