vagrant-g5k 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fe452d0c9d49354e7ab25094dcc73723103d67f
4
- data.tar.gz: 13f854e214d65d43109608ae487c10f642ba81d8
3
+ metadata.gz: 3584cb138bea51e6e39c67fbce25e69edab6a742
4
+ data.tar.gz: bbc3daa4abec3664a478c2c3cc74e4902a0e3687
5
5
  SHA512:
6
- metadata.gz: 7bad68ae00e744df6b480825fb5da0fb68eaf981a791cd2a7f5ad4c9f1ce1538ebdd9030de1d8a6e8b7a88f30c3be1b85f253350fe6d5fc4ffd88344c57e2a39
7
- data.tar.gz: c58fc1ef51ccabb2bb1739608f58e77676f1e46eed5222336d7de5cde8aaeebc6430a5c8d4b3f2f9446344fb4bc4e90082f7268fc1e2e624ace76336b3500c29
6
+ metadata.gz: e15b9be060f76de0210b35d7392e13ac2c876b8f4ff37a3dfd9bbbe45246535efd1fcdd00cd71817a30c820c51235e5a658ff3efee765ef5e1a7fdfc283cae83
7
+ data.tar.gz: d0e4163e16ed67890ad4f5011ea18cf54edd991395022bc12e1abcec6dc120aefea755061d542c58b4a6a2d5be97af9e3dbd14c10d7b06b4e32d9b421e8f00a0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.0.11
2
+
3
+ * Support for other "OAR behind ssh scheduler" (e.g Igrida)
4
+ * Reuse already opened ssh connection
5
+
6
+ # 0.0.10
7
+
8
+ * Support different backing strategies (copy, cow, direct, snapshot)
9
+ * Add a mandatory project_id in the configuration
10
+
1
11
  # 0.0.9
2
12
 
3
13
  * Add support for custom walltime
data/README.md CHANGED
@@ -1,14 +1,12 @@
1
1
  # Vagrant G5K Provider
2
2
  This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [G5K](https://www.grid5000.fr)
3
- provider to Vagrant, allowing Vagrant to control and provision **virtual machines** in
4
- Grid5000.
3
+ provider to Vagrant, allowing Vagrant to control and provision **virtual machines** on Grid5000.
5
4
 
6
- **NOTE:** This plugin requires Vagrant 1.2+,
5
+ More generally any *OAR behind ssh* that support launching `kvm` could be used (e.g [Igrida](http://igrida.gforge.inria.fr/)). Thus *vagrant-oar* could be a more appropriate name.
7
6
 
8
- ## Features
7
+ > This plugin requires
8
+ * Vagrant 1.2+,
9
9
 
10
- * Boot one vm instance
11
- * SSH into the instances.
12
10
 
13
11
  ## Usage
14
12
 
@@ -28,13 +26,13 @@ Check the Vagrantfile.
28
26
 
29
27
  ## Note on disk format and backing strategy
30
28
 
31
- Virtual Machines can be booted either :
29
+ Virtual Machines can be booted either :
32
30
 
33
31
  * From a `qcow2` image stored in the frontend filesystem
34
32
  * From a rbd image stored in one of the ceph cluster of Grid'5000.
35
33
 
36
- Once the base image is chosen, you can pick one of the following strategy
37
- to back the disk image of the virtual machines :
34
+ Once the base image is chosen, you can pick one of the following strategy
35
+ to back the disk image of the virtual machines :
38
36
 
39
37
  * `copy`: will make a full copy of the image in your home directory (resp. in the same pool as the rbd)
40
38
  * `cow`: will create a Copy On write image in your home directory (resp. in the same pool as the rbd)
data/Vagrantfile CHANGED
@@ -2,21 +2,19 @@
2
2
  # vi: set ft=ruby :
3
3
  #
4
4
  # Testing purpose only
5
- Vagrant.require_plugin "vagrant-g5k"
5
+ #Vagrant.require_plugin "vagrant-g5k"
6
6
 
7
7
  Vagrant.configure(2) do |config|
8
8
  # box isn't used
9
9
  config.vm.define "vm" do |my|
10
10
  my.vm.box = "dummy"
11
-
12
- # make sure the insecure-key of vagrant is authorized
13
- my.vm.provision "shell", inline: "echo hello", privileged: false
11
+ my.vm.provision "ansible", :playbook => "playbook.yml"
14
12
  end
15
13
 
16
14
  # user to log with inside the vm
17
15
  config.ssh.username = "root"
18
16
  # password to use to log inside the vm
19
- # config.ssh.password = ""
17
+ config.ssh.password = ""
20
18
 
21
19
  config.vm.provider "g5k" do |g5k|
22
20
  # The project id.
@@ -25,41 +23,41 @@ Vagrant.configure(2) do |config|
25
23
  g5k.project_id = "vagrant-g5k"
26
24
 
27
25
  # user name used to connect to g5k
28
- g5k.username = ENV['USER']
26
+ # default to ENV["USER"]
27
+ # g5k.username = "john"
29
28
 
30
- # private key
29
+ # private key to use
31
30
  # g5k.private_key = File.join(ENV['HOME'], ".ssh/id_rsa_discovery")
32
31
 
33
32
  # site to use
33
+ # g5k.site = "igrida-oar-frontend"
34
34
  g5k.site = "rennes"
35
35
 
36
+ # gateway to use (if needed)
37
+ g5k.gateway = "access.grid5000.fr"
38
+ # g5k.gateway = "transit.irisa.fr"
39
+
36
40
  # walltime to use
37
41
  # g5k.walltime = "02:00:00"
38
42
 
39
43
  # image location
40
44
  #g5k.image = {
41
- # "path" => "/grid5000/virt-images/alpine_docker.qcow2",
42
- # "backing" => "cow"
45
+ # "path" => "/udd/msimonin/precise.qcow2",
46
+ # "backing" => "copy"
43
47
  #}
44
48
 
45
49
  # it could be backed by the ceph
46
50
  g5k.image = {
47
- "pool" => "msimonin_rbds",
48
- "rbd" => "bases/alpine_docker",
49
- "snapshot" => "parent",
50
- "id" => "$USER",
51
- "conf" => "$HOME/.ceph/config",
52
- "backing" => "copy"
53
- }
54
-
55
- # g5k.backing_strategy = "snapshot"
56
- # this is a copy on write strategy
57
- # image_location is use to read, an epehemeral disk will hold the writes
58
- # if not specified this means that the image is used in r/w mode.
59
- # changes will be persistent
60
- g5k.backing_strategy = "cow"
51
+ "pool" => "msimonin_rbds",
52
+ "rbd" => "bases/alpine_docker",
53
+ "snapshot" => "parent",
54
+ "id" => "$USER",
55
+ "conf" => "$HOME/.ceph/config",
56
+ "backing" => "snapshot"
57
+ }
58
+
61
59
  # ports to expose (at least ssh has to be forwarded)
62
- g5k.ports = ['2222-:22','3000-:3000']
60
+ g5k.ports = ['2222-:22']
63
61
  end
64
62
 
65
63
 
@@ -108,7 +108,6 @@ module VagrantPlugins
108
108
  b2.use MessageNotCreated
109
109
  next
110
110
  end
111
- puts "provision"
112
111
  b2.use Provision
113
112
  end
114
113
  end
@@ -116,6 +115,7 @@ module VagrantPlugins
116
115
 
117
116
  action_root = Pathname.new(File.expand_path("../action", __FILE__))
118
117
  autoload :ConnectG5K, action_root.join("connect_g5k")
118
+ autoload :CloseG5K, action_root.join("close_g5k")
119
119
  autoload :CreateLocalWorkingDir, action_root.join("create_local_working_dir")
120
120
  autoload :DeleteJob, action_root.join("delete_job")
121
121
  autoload :DeleteDisk, action_root.join("delete_disk")
@@ -0,0 +1,24 @@
1
+ require "log4r"
2
+ require "vagrant-g5k/util/g5k_utils"
3
+
4
+ # Unused
5
+ module VagrantPlugins
6
+ module G5K
7
+ module Action
8
+ # This action connects to G5K, verifies credentials work, and
9
+ # puts the G5K connection object into the `:g5k_connection` key
10
+ # in the environment.
11
+ class CloseG5K
12
+ def initialize(app, env)
13
+ @app = app
14
+ @logger = Log4r::Logger.new("vagrant_g5k::action::close_g5k")
15
+ end
16
+
17
+ def call(env)
18
+ env[:g5k_connection].close()
19
+ @app.call(env)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -14,19 +14,16 @@ module VagrantPlugins
14
14
  end
15
15
 
16
16
  def call(env)
17
- args = {
18
- :@ui => env[:ui]
19
- }
20
- a = env[:machine].provider_config.instance_variables.map do |attr|
21
- [ attr, env[:machine].provider_config.instance_variable_get(attr)]
22
- end.to_h
23
- args.merge!(a)
24
- #.map do |attr|
25
- # {attr => env[:machine].provider_config.instance_variable_get(attr)}
26
- #end
27
- env[:g5k_connection] = Connection.new(
28
- args
29
- )
17
+ # This is a hack to make the connection persistent
18
+ # even after environment unload is called
19
+ if Connection.instance.nil?
20
+ @logger.debug("Creating new connection")
21
+ env[:g5k_connection] = Connection.new(env)
22
+ else
23
+ @logger.debug("Reusing connection")
24
+ env[:g5k_connection] = Connection.instance
25
+ end
26
+
30
27
  @app.call(env)
31
28
  end
32
29
  end
@@ -37,14 +37,17 @@ module VagrantPlugins
37
37
  return nil if machine.id.nil?
38
38
 
39
39
  if ssh_fwd.nil?
40
-
41
40
  raise Error "ssh_port should be forwarded"
42
41
  end
42
+
43
43
  ssh_info = {
44
44
  :host => conn.node,
45
45
  :port => ssh_fwd,
46
- :proxy_command => "ssh #{conn.username}@access.grid5000.fr #{ssh_key(conn)} nc %h %p",
47
46
  }
47
+
48
+ if !conn.gateway.nil?
49
+ ssh_info[:proxy_command] = "ssh #{conn.username}@#{conn.gateway} #{ssh_key(conn)} nc %h %p"
50
+ end
48
51
  ssh_info[:private_key_path] = [conn.private_key] if ! conn.private_key.nil?
49
52
  return ssh_info
50
53
  end
@@ -24,12 +24,16 @@ module VagrantPlugins
24
24
  def recover(env)
25
25
  return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)
26
26
 
27
- if env[:machine].provider.state.id != :not_created
27
+ if ![:not_created, :shutdown].include?(env[:machine].provider.state.id)
28
28
  # Undo the import
29
29
  terminate(env)
30
30
  end
31
31
  end
32
32
 
33
+ def terminate(env)
34
+ @logger.info("Terminate the machine")
35
+ end
36
+
33
37
  end
34
38
  end
35
39
  end
@@ -1,5 +1,6 @@
1
1
  require 'net/ssh/multi'
2
2
  require 'vagrant-g5k/util/g5k_utils'
3
+ include Process
3
4
 
4
5
  module VagrantPlugins
5
6
  module G5K
@@ -12,8 +13,20 @@ module VagrantPlugins
12
13
 
13
14
  def execute
14
15
  # TODO
16
+ options = {}
17
+ opts = OptionParser.new do |o|
18
+ o.banner = 'Usage: vagrant g(k [vm-name]'
19
+ o.separator ''
20
+ o.version = VagrantPlugins::G5K::VERSION
21
+ o.program_name = 'vagrant g5k'
22
+ end
23
+ argv = parse_options(opts)
24
+ with_target_vms(argv, options) do |machine|
25
+ puts machine.config.vm.networks
26
+ end
27
+ puts "sleeping"
28
+ wait
15
29
  end
16
-
17
30
  end
18
31
  end
19
32
  end
@@ -29,6 +29,11 @@ module VagrantPlugins
29
29
  # @return [String]
30
30
  attr_accessor :site
31
31
 
32
+ # G5K gateway
33
+ #
34
+ # @return [String]
35
+ attr_accessor :gateway
36
+
32
37
  # G5K image
33
38
  #
34
39
  # @return [Hash]
@@ -41,17 +46,11 @@ module VagrantPlugins
41
46
  # @return [Array]
42
47
  attr_accessor :ports
43
48
 
44
- # G5K backing strategy
45
- #
46
- #
47
- # @return [String]
48
- attr_accessor :backing_strategy
49
-
50
49
  def initialize()
51
- @username = nil
50
+ @username = ENV['USER']
52
51
  @project_id = nil
53
- @site = "rennes"
54
- @backing_strategy = ""
52
+ @site = nil
53
+ @gateway = nil
55
54
  @walltime = "01:00:00"
56
55
  end
57
56
 
@@ -63,11 +62,11 @@ module VagrantPlugins
63
62
  def validate(machine)
64
63
  errors = _detected_errors
65
64
 
66
- errors << "g5k username is required" if @username.nil?
65
+ errors << "g5k project_id is required" if @project_id.nil?
66
+ errors << "g5k site is required" if @site.nil?
67
67
  errors << "g5k image is required" if @image.nil?
68
- errors << "g5k image is required" if @project_id.nil?
69
-
70
- # TODO validate image hash
68
+ errors << "g5k image must be a Hash" if !@image.is_a?(Hash)
69
+
71
70
  { "G5K Provider" => errors }
72
71
  end
73
72
 
@@ -34,7 +34,7 @@ module VagrantPlugins
34
34
  Provider
35
35
  end
36
36
 
37
- command(:vmlist) do
37
+ command(:g5k) do
38
38
  require_relative 'command'
39
39
  Command
40
40
  end
@@ -16,7 +16,7 @@ module VagrantPlugins
16
16
  return Action.send(action_method) if Action.respond_to?(action_method)
17
17
  nil
18
18
  end
19
-
19
+
20
20
  def ssh_info
21
21
  # Run a custom action called "read_ssh_info" which does what it
22
22
  # says and puts the resulting SSH info into the `:machine_ssh_info`
@@ -21,6 +21,8 @@ module VagrantPlugins
21
21
 
22
22
  attr_accessor :username
23
23
 
24
+ attr_accessor :gateway
25
+
24
26
  attr_accessor :project_id
25
27
 
26
28
  attr_accessor :private_key
@@ -29,8 +31,6 @@ module VagrantPlugins
29
31
 
30
32
  attr_accessor :walltime
31
33
 
32
- attr_accessor :image_location
33
-
34
34
  attr_accessor :logger
35
35
 
36
36
  attr_accessor :node
@@ -39,21 +39,43 @@ module VagrantPlugins
39
39
 
40
40
  attr_accessor :ports
41
41
 
42
- attr_accessor :backing_strategy
42
+ @@instance = nil
43
+
44
+ def self.instance
45
+ @@instance
46
+ end
47
+
48
+
49
+ def initialize(env)
50
+ # provider specific config
51
+ @provider_config = env[:machine].provider_config
52
+ @username = @provider_config.username
53
+ @project_id = @provider_config.project_id
54
+ @private_key = @provider_config.private_key
55
+ @site = @provider_config.site
56
+ @walltime = @provider_config.walltime
57
+ @ports = @provider_config.ports
58
+ @image= @provider_config.image
59
+ @gateway = @provider_config.gateway
60
+ # grab the network config of the vm
61
+ @networks = env[:machine].config.vm.networks
62
+ # to log to the ui
63
+ @ui = env[:ui]
43
64
 
44
- def initialize(args)
45
- # initialize
46
- args.each do |k,v|
47
- instance_variable_set("#{k}", v) unless v.nil?
48
- end
49
65
  @logger = Log4r::Logger.new("vagrant::environment")
50
- @logger.debug("connecting with #{@username} on site #{@site}")
51
66
  options = {
52
67
  :forward_agent => true
53
68
  }
54
69
  options[:keys] = [@private_key] if !@private_key.nil?
55
- gateway = Net::SSH::Gateway.new("access.grid5000.fr", @username, options)
56
- @session = gateway.ssh(@site, @username, options)
70
+ if @gateway.nil?
71
+ @logger.debug("connecting with #{@username} on site #{@site}")
72
+ @session = Net::SSH.start(@site, @username, options)
73
+ else
74
+ @logger.debug("connecting with #{@username} on site #{@site} through #{@gateway}")
75
+ gateway = Net::SSH::Gateway.new(@gateway, @username, options)
76
+ @session = gateway.ssh(@site, @username, options)
77
+ end
78
+ @@instance = self
57
79
  end
58
80
 
59
81
  def create_local_working_dir(env)
@@ -62,14 +84,16 @@ module VagrantPlugins
62
84
 
63
85
  def cwd(env)
64
86
  # remote working directory
65
- File.join("/home", @username, ".vagrant", @project_id)
87
+ File.join(".vagrant", @project_id)
66
88
  end
67
89
 
68
90
 
69
91
  def check_job(job_id)
70
92
  oarstat = exec("oarstat --json")
71
93
  oarstat = JSON.load(oarstat)
94
+ @logger.debug("Looking for the job id #{job_id} and username #{@username}")
72
95
  r = oarstat.select!{ |k,v| k == job_id and v["owner"] == @username }.values.first
96
+ @logger.debug(r.inspect)
73
97
  # update the assigned hostname
74
98
  # this will be used to reach the vm
75
99
  if !r.nil?
@@ -93,7 +117,7 @@ module VagrantPlugins
93
117
  strategy = @image["backing"]
94
118
  file_to_check = ""
95
119
  if [STRATEGY_SNAPSHOT, STRATEGY_DIRECT].include?(strategy)
96
- file_to_check = @image[path]
120
+ file_to_check = @image["path"]
97
121
  else
98
122
  file_to_check = File.join(cwd(env), env[:machine].name.to_s)
99
123
  end
@@ -104,17 +128,17 @@ module VagrantPlugins
104
128
  strategy = @image["backing"]
105
129
  file_to_check = ""
106
130
  if [STRATEGY_SNAPSHOT, STRATEGY_DIRECT].include?(strategy)
107
- file_to_check = @image[path]
131
+ file_to_check = @image["rbd"]
108
132
  else
109
- file_to_check = File.join(cwd(env), env[:machine].name.to_s)[1..-1]
133
+ file_to_check = File.join(cwd(env), env[:machine].name.to_s)
110
134
  end
111
- exec("(rbd --pool #{@image["pool"]} --id #{@image["id"]} --conf #{@image["conf"]} ls | grep #{file_to_check}) || echo \"\"")
135
+ exec("(rbd --pool #{@image["pool"]} --id #{@image["id"]} --conf #{@image["conf"]} ls | grep \"^#{file_to_check}\") || echo \"\"")
112
136
  end
113
137
 
114
138
 
115
139
  def launch_vm(env)
116
140
  launcher_path = File.join(File.dirname(__FILE__), LAUNCHER_SCRIPT)
117
- @ui.info("Launching the VM on Grid'5000")
141
+ @ui.info("Launching the VM on #{@site}")
118
142
  # Checking the subnet job
119
143
  # uploading the launcher
120
144
  launcher_remote_path = File.join(cwd(env), LAUNCHER_SCRIPT)
@@ -126,8 +150,8 @@ module VagrantPlugins
126
150
 
127
151
  args = [drive, net].join(" ")
128
152
  # Submitting a new job
129
- job_id = exec("oarsub -t allow_classic_ssh -l \"{virtual!=\'none\'}/nodes=1,walltime=#{@walltime}\" --name #{env[:machine].name} --checkpoint 60 --signal 12 \"#{launcher_remote_path} #{args}\" | grep OAR_JOB_ID | cut -d '=' -f2").chomp
130
-
153
+ # Getting the job_id as a ruby string
154
+ job_id = exec("oarsub --json -t allow_classic_ssh -l \"nodes=1,walltime=#{@walltime}\" --name #{env[:machine].name} --checkpoint 60 --signal 12 \"#{launcher_remote_path} #{args}\" | grep \"job_id\"| cut -d':' -f2").gsub(/"/,"").strip
131
155
 
132
156
  begin
133
157
  retryable(:on => VagrantPlugins::G5K::Errors::JobNotRunning, :tries => 100, :sleep => 2) do
@@ -144,7 +168,7 @@ module VagrantPlugins
144
168
  @ui.error("Tired of waiting")
145
169
  raise VagrantPlugins::G5K::Errors::JobNotRunning
146
170
  end
147
- @ui.info("VM booted on Grid'5000")
171
+ @ui.info("VM booted on #{@site}")
148
172
 
149
173
  end
150
174
 
@@ -156,7 +180,7 @@ module VagrantPlugins
156
180
 
157
181
  if @image["pool"].nil?
158
182
  disk = File.join(cwd(env), env[:machine].name.to_s)
159
- exec("rm #{disk}")
183
+ exec("rm -f #{disk}")
160
184
  else
161
185
  disk = File.join(@image["pool"], cwd(env), env[:machine].name.to_s)
162
186
  begin
@@ -171,6 +195,12 @@ module VagrantPlugins
171
195
  end
172
196
  end
173
197
 
198
+ def close()
199
+ # Terminate the session
200
+ @session.close
201
+ end
202
+
203
+
174
204
 
175
205
  def exec(cmd)
176
206
  @logger.debug("Executing #{cmd}")
@@ -231,12 +261,15 @@ module VagrantPlugins
231
261
  def _generate_drive_rbd(env)
232
262
  strategy = @image["backing"]
233
263
  if [STRATEGY_SNAPSHOT, STRATEGY_DIRECT].include?(strategy)
234
- file = @image["path"]
264
+ file = File.join(@image["pool"], @image["rbd"])
235
265
  elsif strategy == STRATEGY_COW
236
266
  file = _rbd_clone_or_copy_image(env, clone = true)
237
267
  elsif strategy == STRATEGY_COPY
238
268
  file = _rbd_clone_or_copy_image(env, clone = false)
239
269
  end
270
+ # encapsulate the file to a qemu ready disk description
271
+ file = "rbd:#{file}:id=#{@image["id"]}:conf=#{@image["conf"]}"
272
+ @logger.debug("Generated drive string : #{file}")
240
273
  return file
241
274
  end
242
275
 
@@ -253,24 +286,25 @@ module VagrantPlugins
253
286
  end
254
287
 
255
288
  def _rbd_clone_or_copy_image(env, clone = true)
256
- @ui.info("Clone the rbd image")
257
289
  # destination in the same pool under the .vagrant ns
258
290
  destination = File.join(@image["pool"], cwd(env), env[:machine].name.to_s)
259
- # Even if nothing will happen when the destination already exist, we should test it before
291
+ # Even if nothing bad will happen when the destination already exist, we should test it before
260
292
  exists = _check_rbd_local_storage(env)
261
293
  if exists == ""
262
294
  # we create the destination
263
295
  if clone
264
296
  # parent = pool/rbd@snap
297
+ @ui.info("Cloning the rbd image")
265
298
  parent = File.join(@image["pool"], "#{@image["rbd"]}@#{@image["snapshot"]}")
266
299
  exec("rbd clone #{parent} #{destination} --conf #{@image["conf"]} --id #{@image["id"]}" )
267
300
  else
301
+ @ui.info("Copying the rbd image (This may take some time)")
268
302
  # parent = pool/rbd@snap
269
303
  parent = File.join(@image["pool"], "#{@image["rbd"]}")
270
304
  exec("rbd cp #{parent} #{destination} --conf #{@image["conf"]} --id #{@image["id"]}" )
271
305
  end
272
306
  end
273
- return "rbd:#{destination}:id=#{@image["id"]}:conf=#{@image["conf"]}"
307
+ return destination
274
308
  end
275
309
 
276
310
  def _file_clone_or_copy_image(env, clone = true)
@@ -292,6 +326,7 @@ module VagrantPlugins
292
326
  "hostfwd=tcp::#{p}"
293
327
  end.join(',')
294
328
  net = "-net nic,model=virtio -net user,#{fwd_ports}"
329
+ @logger.info("Mapping ports")
295
330
  return net
296
331
  end
297
332
  end
@@ -1,22 +1,14 @@
1
1
  #!/bin/bash
2
+
3
+ # This script is borrowed from pmorrillon.
4
+ # Thanks to him !
5
+
2
6
  #OAR -l slash_22=1+{virtual!='none'}/nodes=1,walltime=06:00:00
3
7
  #OAR --checkpoint 60
4
8
  #OAR --signal 12
5
9
 
6
10
  # Directory for qcow2 snapshots
7
11
  export TMPDIR=/tmp
8
- #IMAGE=/grid5000/virt-images/alpine-docker.qcow2
9
-
10
- # GET Virtual IP information
11
- IP_ADDR=$(/usr/local/bin/g5k-subnets -im | head -1 | awk '{print $1}')
12
- MAC_ADDR=$(/usr/local/bin/g5k-subnets -im | head -1 | awk '{print $2}')
13
-
14
- echo "VM IP informations :"
15
- echo "IP address: $IP_ADDR"
16
- echo "MAC address: $MAC_ADDR"
17
-
18
- # Create tap
19
- TAP=$(sudo create_tap)
20
12
 
21
13
  # Memory allocation
22
14
  KEEP_SYSTEM_MEM=1 # Gb
@@ -35,7 +27,6 @@ clean_shutdown() {
35
27
  trap clean_shutdown 12
36
28
 
37
29
  # Launch virtual machine
38
- #kvm -m $VM_MEM -smp $SMP -drive file=/grid5000/images/KVM/alpine_docker.qcow2,if=virtio -snapshot -fsdev local,security_model=none,id=fsdev0,path=$HOME -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -nographic -net nic,model=virtio,macaddr=$MAC_ADDR -net tap,ifname=$TAP,script=no -monitor unix:/tmp/alpine_docker_vm.mon,server,nowait -localtime -enable-kvm &
39
30
  #kvm -m $VM_MEM -smp $SMP -drive file=$IMAGE,if=virtio -snapshot -fsdev local,security_model=none,id=fsdev0,path=$HOME -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -nographic -net nic,model=virtio,macaddr=$MAC_ADDR -net tap,ifname=$TAP,script=no -monitor unix:/tmp/vagrant-g5k.mon,server,nowait -localtime -enable-kvm &
40
31
  kvm -m $VM_MEM -smp $SMP -fsdev local,security_model=none,id=fsdev0,path=$HOME -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare -nographic -monitor unix:/tmp/vagrant-g5k.mon,server,nowait -localtime -enable-kvm $@ &
41
32
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module G5K
3
- VERSION = '0.0.10'
3
+ VERSION = '0.0.11'
4
4
  end
5
5
  end
@@ -0,0 +1,20 @@
1
+ require "vagrant-g5k/config"
2
+ require 'rspec/its'
3
+
4
+ describe VagrantPlugins::G5K::Config do
5
+ let(:instance) {described_class.new}
6
+
7
+ before :each do
8
+ ENV["USER"] = "user"
9
+ end
10
+
11
+
12
+ describe "defaults" do
13
+ its("project_id"){should == nil}
14
+ its("site"){should == nil}
15
+ its("walltime"){should == "01:00:00"}
16
+ its("username"){should == "user"}
17
+ end
18
+
19
+ end
20
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-g5k
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Simonin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iniparse
@@ -130,6 +130,7 @@ files:
130
130
  - lib/vagrant-g5k.rb
131
131
  - lib/vagrant-g5k/.config.rb.swp
132
132
  - lib/vagrant-g5k/action.rb
133
+ - lib/vagrant-g5k/action/close_g5k.rb
133
134
  - lib/vagrant-g5k/action/connect_g5k.rb
134
135
  - lib/vagrant-g5k/action/create_local_working_dir.rb
135
136
  - lib/vagrant-g5k/action/delete_disk.rb
@@ -149,6 +150,7 @@ files:
149
150
  - lib/vagrant-g5k/util/launch_vm_fwd.sh
150
151
  - lib/vagrant-g5k/version.rb
151
152
  - locales/en.yml
153
+ - spec/vagrant-g5k/config_spec.rb
152
154
  - vagrant-g5k.gemspec
153
155
  homepage: https://github.com/msimonin/vagrant-g5k
154
156
  licenses: