vagrant-ganeti 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/README.md +78 -44
  2. data/example_box/Vagrantfile +1 -1
  3. data/example_box/ganeti.box +0 -0
  4. data/example_box/ganeti1.box +0 -0
  5. data/lib/{vagrant-plugin-ganeti.rb → vagrant-ganeti.rb} +3 -3
  6. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action.rb +0 -0
  7. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/connect_ganeti.rb +0 -0
  8. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/is_created.rb +0 -0
  9. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/is_reachable.rb +0 -0
  10. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/message_already_created.rb +0 -0
  11. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/message_not_created.rb +0 -0
  12. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/message_not_reachable.rb +0 -0
  13. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/message_will_not_destroy.rb +0 -0
  14. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/read_ssh_info.rb +0 -0
  15. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/read_state.rb +0 -0
  16. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/remove_instance.rb +18 -2
  17. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/run_instance.rb +2 -2
  18. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/sync_folders.rb +0 -0
  19. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/timed_provision.rb +0 -0
  20. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/unlink_server.rb +0 -0
  21. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/action/warn_networks.rb +0 -0
  22. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/config.rb +0 -1
  23. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/errors.rb +0 -0
  24. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/plugin.rb +0 -0
  25. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/provider.rb +0 -0
  26. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/util/ganeti_client.rb +1 -1
  27. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/util/timer.rb +0 -0
  28. data/lib/{vagrant-plugin-ganeti → vagrant-ganeti}/version.rb +1 -1
  29. data/{vagrant-plugin-ganeti.gemspec → vagrant-ganeti.gemspec} +3 -3
  30. metadata +32 -31
data/README.md CHANGED
@@ -2,20 +2,20 @@
2
2
  This is a Vagrant 1.2+ plugin that adds an Ganeti provider to Vagrant, allowing Vagrant to control and provision
3
3
  machines in Ganeti.
4
4
 
5
- NOTE: This plugin requires Vagrant 1.2
6
- NOTE: This project is work in progress, there are lot of things which might not work yet.
5
+ **NOTE:** This plugin requires **Vagrant 1.2**
7
6
 
8
- ## Installation
7
+ **NOTE:** This project is work in progress, there are lot of things which might not work yet.
9
8
 
10
- Build the Gem:
9
+ ## Installation
11
10
 
12
- $ gem build 'vagrant-plugin-ganeti.gemspec'
11
+ Building the Gem from source:
13
12
 
13
+ $ gem build 'vagrant-ganeti.gemspec'
14
14
 
15
15
 
16
- Install using standard Vagrant 1.1+ plugin installation methods. After installing, vagrant up and specify the ganeti provider. An example is shown below.
16
+ Alternatively you could, Install using standard Vagrant 1.1+ plugin installation methods. After installing, vagrant up and specify the ganeti provider. An example is shown below.
17
17
 
18
- $ vagrant plugin install vagrant-plugin-ganeti-0.0.1.gem
18
+ $ vagrant plugin install vagrant-ganeti
19
19
 
20
20
  ## Usage
21
21
 
@@ -41,25 +41,28 @@ And then make a Vagrantfile that looks like the following, filling in your infor
41
41
  ganeti.os_type = "image+debian-squeeze"
42
42
  ganeti.instance_name = "gimager3.organisation.org"
43
43
  ganeti.pnode = "gnode.organisation.org"
44
- ganeti.nics = [{"ip"=>"10.10.10.100"}]
45
44
  ganeti.disks =[{"size"=>"8000"}]
46
45
  ganeti.disk_template = "plain"
47
- override.ssh.username = "User name of the default user "
48
- override.ssh.private_key_path = "Path to your private key"
46
+ override.ssh.username = "root"
49
47
  end
50
48
  end
51
49
 
52
50
 
53
51
  And then run vagrant up --provider=ganeti.
52
+
53
+ This will start an instance in the Ganeti Cluster.
54
54
 
55
- This will start an instance in the Ganeti Cluster. And assuming your SSH information was filled in properly within your Vagrantfile, SSH and provisioning will work as well.
55
+ Other overridable settings include
56
+
57
+ override.ssh.username = "User Name"
58
+ override.ssh.private_key_path = "Path to your private key"
56
59
 
57
60
  If you have issues with SSH connecting, make sure that the instances are being launched with a security group that allows SSH access.
58
61
 
59
62
  ## Box Format
60
63
 
61
64
  Every provider in Vagrant must introduce a custom box format. This
62
- provider introduces `aws` boxes. You can view an example box in
65
+ provider introduces `ganeti` boxes. You can view an example box in
63
66
  the [example_box/ directory](https://github.com/osuosl/vagrant-plugin-ganeti/master/example_box/).
64
67
  That directory also contains instructions on how to build a box.
65
68
 
@@ -70,38 +73,44 @@ provider-specific configuration for this provider.
70
73
  ## Configuration
71
74
 
72
75
  This provider exposes quite a few provider-specific configuration options:
73
-
74
- * `rapi_user` - The username for accessing the RAPI. REQUIRED
75
- * `rapi_pass` - The password for the corrensponding user. REQUIRED
76
- * `cluster` - The host address of the master Ganeti Node. REQUIRED
77
- * `os_type` - The OS that needs to be booted up. Note : This will override the default box . OPTIONAL
78
- * `mode` - Mode of creation. Defaults to create. OPTIONAL
79
- * `instance_name` - The name of the instance. REQUIRED
80
- * `pnode` - The primary node where instance needs to be created. Defaults to None. OPTIONAL
81
- * `snode` - The Secondary node in case of drbd is used. Defaults to None. OPTIONAL
82
- * `nics` - Network configuration. REQUIRED
83
- * `disks` - The Size of the Disks . Defaults to 8 G . OPTIONAL
84
- * `disk_template` - The type of the disk template. Defaults to plain . OPTIONAL
85
- * `iallocator` - The name of the iallocator policy. Defaults to cluster default . OPTIONAL
86
- * `memory` - The size of the memory. Defaults to plain . OPTIONAL
87
- * `vcpus` - The No of VCPUS . Defaults to None . OPTIONAL
88
- * `ip_check` - Either 'true' or 'false' (Without quotes). Defaults to true . OPTIONAL
89
- * `name_check` - Either 'true' or 'false' (Without quotes) . Defaults to true . OPTIONAL
90
-
91
-
92
- hvparams settings
93
- * `boot_order` - Defaults to None . OPTIONAL
94
- * `cdrom_image_path` - Defaults to None . OPTIONAL
95
- * `nic_type` - Defaults to None . OPTIONAL
96
- * `disk_type` - Defaults to None . OPTIONAL
97
- * `cpu_type` - Defaults to None . OPTIONAL
98
- * `kernel_path` - Defaults to None . OPTIONAL
99
- * `kernel_args` - Defaults to None . OPTIONAL
100
- * `initrd_path` - Defaults to None . OPTIONAL
101
- * `root_path` - Defaults to None . OPTIONAL
102
- * `serial_console` - Defaults to None . OPTIONAL
103
- * `kvm_flag` - Defaults to None . OPTIONAL
104
-
76
+ ### Required Parameters
77
+ * `rapi_user` - The username for accessing the RAPI.
78
+ * `rapi_pass` - The password for the corrensponding user.
79
+ * `cluster` - The host address of the master Ganeti Node.
80
+ * `instance_name` - The name of the instance.
81
+
82
+ ### Optional Parameters
83
+ * `os_type` - The OS that needs to be booted up. **Note :** This will override the default box .
84
+ * `mode` - Mode of creation. Defaults to create.
85
+ * `pnode` - The primary node where instance needs to be created. Defaults to None.
86
+ * `snode` - The Secondary node in case of drbd is used. Defaults to None.
87
+ * `nics` - Network configuration.
88
+ * List of (Dictionary with keys of (OneOf bridge, name, ip, vlan, mac, link, mode, network) and values of (None or String)
89
+ * `disks` - The Size of the Disks . Defaults to 8 G .
90
+ * List of (Dictionary with keys of (OneOf name, vg, adopt, spindles, mode, provider, metavg, size) and values of (NonEmptyString or Integer)
91
+ * `disk_template` - The type of the disk template. Defaults to plain .
92
+ * `iallocator` - The name of the iallocator policy. Defaults to cluster default .
93
+ * `memory` - The size of the memory. Defaults to plain .
94
+ * `vcpus` - The No of VCPUS . Defaults to None .
95
+ * `ip_check` - Either 'true' or 'false' (Without quotes). Defaults to true .
96
+ * `name_check` - Either 'true' or 'false' (Without quotes) . Defaults to true .
97
+
98
+ More about Ganeti Instance parameters can be found [here](http://docs.ganeti.org/ganeti/current/html/rapi.html#id138)
99
+
100
+ ####hvparams settings
101
+ * `boot_order` - Defaults to None .
102
+ * `cdrom_image_path` - Defaults to None .
103
+ * `nic_type` - Defaults to None .
104
+ * `disk_type` - Defaults to None .
105
+ * `cpu_type` - Defaults to None .
106
+ * `kernel_path` - Defaults to None .
107
+ * `kernel_args` - Defaults to None .
108
+ * `initrd_path` - Defaults to None .
109
+ * `root_path` - Defaults to None .
110
+ * `serial_console` - Defaults to None .
111
+ * `kvm_flag` - Defaults to None .
112
+
113
+ More about hvparam settings can be found [here](http://docs.ganeti.org/ganeti/current/man/gnt-instance.html)
105
114
 
106
115
  ## Networks
107
116
 
@@ -119,6 +128,31 @@ the remote machine over SSH.
119
128
  This is good enough for all built-in Vagrant provisioners (shell,
120
129
  chef, and puppet) to work!
121
130
 
131
+ ## Advanced Examples
132
+ #### Having Multiple Disks
133
+
134
+ Vagrant.configure("2") do |config|
135
+ config.vm.box = "ganeti"
136
+ config.vm.provider :ganeti do |ganeti, override|
137
+ .....
138
+ ganeti.disks =[{"size"=>"8000"},{"size"=>"16000"}]
139
+ .....
140
+ end
141
+ end
142
+ This creates two disks in the instance one of 8G and another of 16G.
143
+
144
+ #### Having Multiple Nics
145
+
146
+ Vagrant.configure("2") do |config|
147
+ config.vm.box = "ganeti"
148
+ config.vm.provider :ganeti do |ganeti, override|
149
+ .....
150
+ ganeti.nics =[{"ip"=> "198.51.100.4"}, {"link"=> "br0" ,"ip"=> "10.10.100.4"}, {"ip"=> "10.11.100.4"}]
151
+ .....
152
+ end
153
+ end
154
+ This creates 3 nic interfaces having ip addresses **198.51.100.4** , **10.10.100.4** and **10.11.100.4** .
155
+ Configuration parameter **nics** must be List of - Dictionary with keys of (OneOf bridge, name, ip, vlan, mac, link, mode, network)
122
156
 
123
157
  ## TODO
124
158
 
@@ -3,6 +3,6 @@
3
3
 
4
4
  Vagrant.configure("2") do |config|
5
5
  config.vm.provider :ganeti do |ganeti|
6
- ganeti.os_name = "image+debian-squeeze"
6
+ ganeti.os_type = "image+debian-squeeze"
7
7
  end
8
8
  end
Binary file
Binary file
@@ -1,11 +1,11 @@
1
1
  require "pathname"
2
2
 
3
- require "vagrant-plugin-ganeti/plugin"
4
- require "vagrant-plugin-ganeti/util/ganeti_client"
3
+ require "vagrant-ganeti/plugin"
4
+ require "vagrant-ganeti/util/ganeti_client"
5
5
 
6
6
  module VagrantPlugins
7
7
  module GANETI
8
- lib_path = Pathname.new(File.expand_path("../vagrant-plugin-ganeti", __FILE__))
8
+ lib_path = Pathname.new(File.expand_path("../vagrant-ganeti", __FILE__))
9
9
  autoload :Action, lib_path.join("action")
10
10
  autoload :Errors, lib_path.join("errors")
11
11
 
@@ -13,11 +13,27 @@ module VagrantPlugins
13
13
 
14
14
  def call(env)
15
15
  server = env[:ganeti_compute]
16
- env[:ui].info("Removing the instance#{server.info['instance_name']}")
17
- server.instance_terminate
16
+ createjob = server.instance_terminate
18
17
  # set machine id to nil
19
18
  env[:machine].id = nil
20
19
 
20
+ env[:ui].info("Removing the instance #{server.info['instance_name']}")
21
+ while true
22
+ status = server.is_job_ready(createjob)
23
+
24
+ if status == "error"
25
+ env[:ui].info("Error Removing instance")
26
+ break
27
+ elsif status == "running"
28
+ #Waiting for the message to succeed
29
+ sleep(15)
30
+ elsif status == "success"
31
+ env[:ui].info("Instance #{server.info['instance_name']} Sucessfully Removed")
32
+ break
33
+ end
34
+
35
+ end
36
+
21
37
  @app.call(env)
22
38
  end
23
39
  end
@@ -53,7 +53,7 @@ module VagrantPlugins
53
53
  bootinstancejob = client.start_instance()
54
54
  sleep(3)
55
55
  if client.is_job_ready(bootinstancejob) == "success"
56
- env[:machine].id = client.info['nics'][0]['ip']
56
+ env[:machine].id = client.info['instance_name']
57
57
  env[:ui].info( "#{ env[:machine].id}")
58
58
  env[:ui].info("Instance Started Successfully")
59
59
  else
@@ -62,7 +62,7 @@ module VagrantPlugins
62
62
  break
63
63
  elsif status == "already_exists"
64
64
  env[:ui].info( "Instance already Exists. Use Vagrant SSH to login .\nUse 'vagrant destroy' and 'vagrant up' again to create instance afresh")
65
- env[:machine].id = client.info['nics'][0]['ip']
65
+ env[:machine].id = client.info['instance_name']
66
66
  break
67
67
  end
68
68
 
@@ -290,7 +290,6 @@ module VagrantPlugins
290
290
  errors << I18n.t("vagrant_ganeti.config.disks_required") if @disks == nil
291
291
  errors << I18n.t("vagrant_ganeti.config.instance_name_required") if @instance_name.nil?
292
292
  errors << I18n.t("vagrant_ganeti.config.mode_required") if @mode.nil?
293
- errors << I18n.t("vagrant_ganeti.config.nics_required") if @nics.nil?
294
293
  errors << I18n.t("vagrant_ganeti.config.pnode_required") if @pnode.nil? and @iallocator.nil?
295
294
  errors << I18n.t("vagrant_ganeti.config.snode_required") if @snode.nil? and @disk_template == "drbd" and @iallocator.nil?
296
295
  { "GANETI Provider" => errors }
@@ -106,7 +106,7 @@ module VagrantPlugins
106
106
  # response = http.send_request("GET",url)
107
107
  rescue => e
108
108
  puts "Error sending request"
109
- puts "#{e.message}"
109
+ # puts "#{e.message}"
110
110
 
111
111
  else
112
112
  case response
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GANETI
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,18 +1,18 @@
1
1
  $:.unshift File.expand_path("../lib", __FILE__)
2
- require "vagrant-plugin-ganeti/version"
2
+ require "vagrant-ganeti/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "vagrant-ganeti"
6
6
  s.version = VagrantPlugins::GANETI::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.authors = "Ahmed Shabib,Lance Albertson"
8
+ s.authors = "AHMED Shabib"
9
9
  s.email = "reachshabib@gmail.com"
10
10
  s.homepage = "http://www.vagrantup.com"
11
11
  s.summary = "Enables Vagrant to manage machines in Ganeti"
12
12
  s.description = "Enables Vagrant to manage machines in Ganeti."
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
- s.rubyforge_project = "vagrant-plugin-ganeti"
15
+ s.rubyforge_project = "vagrant-ganeti"
16
16
 
17
17
  s.add_development_dependency "rake"
18
18
  s.add_development_dependency "rspec-core", "~> 2.12.2"
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ganeti
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
- - Ahmed Shabib,Lance Albertson
13
+ - AHMED Shabib
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-08-31 00:00:00 Z
18
+ date: 2013-09-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake
@@ -89,40 +89,41 @@ extra_rdoc_files: []
89
89
 
90
90
  files:
91
91
  - README.md
92
- - lib/vagrant-plugin-ganeti/util/timer.rb
93
- - lib/vagrant-plugin-ganeti/util/ganeti_client.rb
94
- - lib/vagrant-plugin-ganeti/action/message_already_created.rb
95
- - lib/vagrant-plugin-ganeti/action/message_will_not_destroy.rb
96
- - lib/vagrant-plugin-ganeti/action/connect_ganeti.rb
97
- - lib/vagrant-plugin-ganeti/action/unlink_server.rb
98
- - lib/vagrant-plugin-ganeti/action/remove_instance.rb
99
- - lib/vagrant-plugin-ganeti/action/is_created.rb
100
- - lib/vagrant-plugin-ganeti/action/warn_networks.rb
101
- - lib/vagrant-plugin-ganeti/action/read_state.rb
102
- - lib/vagrant-plugin-ganeti/action/timed_provision.rb
103
- - lib/vagrant-plugin-ganeti/action/run_instance.rb
104
- - lib/vagrant-plugin-ganeti/action/message_not_created.rb
105
- - lib/vagrant-plugin-ganeti/action/read_ssh_info.rb
106
- - lib/vagrant-plugin-ganeti/action/is_reachable.rb
107
- - lib/vagrant-plugin-ganeti/action/sync_folders.rb
108
- - lib/vagrant-plugin-ganeti/action/message_not_reachable.rb
109
- - lib/vagrant-plugin-ganeti/config.rb
110
- - lib/vagrant-plugin-ganeti/version.rb
111
- - lib/vagrant-plugin-ganeti/action.rb
112
- - lib/vagrant-plugin-ganeti/errors.rb
113
- - lib/vagrant-plugin-ganeti/provider.rb
114
- - lib/vagrant-plugin-ganeti/plugin.rb
115
- - lib/vagrant-plugin-ganeti.rb
92
+ - lib/vagrant-ganeti.rb
93
+ - lib/vagrant-ganeti/util/timer.rb
94
+ - lib/vagrant-ganeti/util/ganeti_client.rb
95
+ - lib/vagrant-ganeti/action/message_already_created.rb
96
+ - lib/vagrant-ganeti/action/message_will_not_destroy.rb
97
+ - lib/vagrant-ganeti/action/connect_ganeti.rb
98
+ - lib/vagrant-ganeti/action/unlink_server.rb
99
+ - lib/vagrant-ganeti/action/remove_instance.rb
100
+ - lib/vagrant-ganeti/action/is_created.rb
101
+ - lib/vagrant-ganeti/action/warn_networks.rb
102
+ - lib/vagrant-ganeti/action/read_state.rb
103
+ - lib/vagrant-ganeti/action/timed_provision.rb
104
+ - lib/vagrant-ganeti/action/run_instance.rb
105
+ - lib/vagrant-ganeti/action/message_not_created.rb
106
+ - lib/vagrant-ganeti/action/read_ssh_info.rb
107
+ - lib/vagrant-ganeti/action/is_reachable.rb
108
+ - lib/vagrant-ganeti/action/sync_folders.rb
109
+ - lib/vagrant-ganeti/action/message_not_reachable.rb
110
+ - lib/vagrant-ganeti/config.rb
111
+ - lib/vagrant-ganeti/version.rb
112
+ - lib/vagrant-ganeti/action.rb
113
+ - lib/vagrant-ganeti/errors.rb
114
+ - lib/vagrant-ganeti/provider.rb
115
+ - lib/vagrant-ganeti/plugin.rb
116
116
  - Gemfile
117
117
  - LICENSE
118
118
  - LICENSE.txt
119
+ - example_box/ganeti1.box
119
120
  - example_box/README.md
120
121
  - example_box/Vagrantfile
121
122
  - example_box/metadata.json
122
123
  - example_box/ganeti.box
123
124
  - Rakefile
124
125
  - locales/en.yml
125
- - vagrant-plugin-ganeti.gemspec
126
+ - vagrant-ganeti.gemspec
126
127
  - .gitignore
127
128
  homepage: http://www.vagrantup.com
128
129
  licenses: []
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
155
  version: 1.3.6
155
156
  requirements: []
156
157
 
157
- rubyforge_project: vagrant-plugin-ganeti
158
+ rubyforge_project: vagrant-ganeti
158
159
  rubygems_version: 1.8.15
159
160
  signing_key:
160
161
  specification_version: 3