drbd 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.rdoc +25 -5
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/lib/drbd.rb +24 -4
  5. metadata +5 -5
data/README.rdoc CHANGED
@@ -4,18 +4,20 @@ Ruby wrapper for DRBD
4
4
 
5
5
  == It is usefull for
6
6
 
7
- * Connect to server over SSH
7
+ * Connect to the server over SSH
8
8
  * Parse current running configuration
9
9
  * Parse current status
10
+ * Execute essential commands
10
11
 
11
12
  == Limitations
12
13
 
13
- * Best with drbd version > 8.3.7
14
- * Hostname used for connection must be one of hostnames in drbd.conf (FQDN ideally)
15
- * It'sJust one-morning's prototype, take patience
14
+ * Best with DRBD version > 8.3.7
15
+ * Hostname used for connection must be one of the hostnames in drbd.conf (FQDN ideally)
16
+ * It's just one-morning's prototype, take patience
17
+ * Under development, everything may change
16
18
  * No tests
17
19
  * No documentation
18
- * Absolutely no warranty, use it at your own risk
20
+ * Absolutely no warranty, use it at your own risk. Be carefull, you may lost some data!
19
21
 
20
22
  == Installation
21
23
 
@@ -35,6 +37,24 @@ Ruby wrapper for DRBD
35
37
 
36
38
  <tt>r = d.resources.first</tt>
37
39
 
40
+ - stateless execute command (WARNING! let's check the source what it does)
41
+
42
+ <tt>r.primary!</tt>
43
+
44
+ <tt>r.primary!(:force => true)</tt>
45
+
46
+ <tt>r.secondary!</tt>
47
+
48
+ <tt>r.connect!</tt>
49
+
50
+ <tt>r.attach!</tt>
51
+
52
+ <tt>r.detach!</tt>
53
+
54
+ <tt>r.up!</tt>
55
+
56
+ <tt>r.down!</tt>
57
+
38
58
  - get resource name
39
59
 
40
60
  <tt>r.name</tt>
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/n1k/drbd"
12
12
  gem.authors = ["Adam Kliment"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "nokogiri", ">= 1.4.4"
14
+ gem.add_dependency "nokogiri", ">= 1.4.4"
15
15
  end
16
16
  Jeweler::GemcutterTasks.new
17
17
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
data/lib/drbd.rb CHANGED
@@ -95,15 +95,35 @@ class DRBD
95
95
  end
96
96
 
97
97
  def down?
98
- status[:cs] == "Unconfigured" || status.nil?
98
+ return true if status.nil?
99
+ return true if status[:cs] == "Unconfigured"
100
+ return false
99
101
  end
100
102
 
101
103
  def primary?
102
- stauts[:ro0] == "Primary"
104
+ status[:ro1] == "Primary"
105
+ end
106
+
107
+ def secondary?
108
+ stutus[:ro1] == "Secondary"
103
109
  end
104
110
 
105
- def primary!
106
- args = "-- --overwrite-data-of-peer primary #{self.name}"
111
+ def primary!(opts = {})
112
+
113
+ if opts[:force] == true
114
+ args = "-- --overwrite-data-of-peer primary #{self.name}"
115
+ else
116
+ args = "primary #{self.name}"
117
+ end
118
+
119
+ command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
120
+ system(command)
121
+ drbd.load_status!
122
+ nil
123
+ end
124
+
125
+ def secondary!
126
+ args = "-- --overwrite-data-of-peer secondary #{self.name}"
107
127
  command = "ssh #{drbd.host} \"#{drbd.command} #{args}\""
108
128
  system(command)
109
129
  drbd.load_status!
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Kliment
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-25 00:00:00 +01:00
18
+ date: 2011-02-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -48,7 +48,7 @@ dependencies:
48
48
  - 4
49
49
  - 4
50
50
  version: 1.4.4
51
- type: :development
51
+ type: :runtime
52
52
  version_requirements: *id002
53
53
  description: Ruby wrapper for DRBD - RAID 1 over TCP/IP
54
54
  email: adam.kliment@virtualmaster.cz