vagrant-g5k 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ #OAR -l slash_22=1+{virtual!='none'}/nodes=1,walltime=06:00:00
3
+ #OAR --checkpoint 60
4
+ #OAR --signal 12
5
+
6
+ # Directory for qcow2 snapshots
7
+ export TMPDIR=/tmp
8
+ #IMAGE=/grid5000/virt-images/alpine-docker.qcow2
9
+ IMAGE=$1
10
+ MAC_ADDR=$2
11
+
12
+ echo "VM IP informations :"
13
+ echo "MAC address: $MAC_ADDR"
14
+
15
+ # Create tap
16
+ TAP=$(sudo create_tap)
17
+
18
+ # Memory allocation
19
+ KEEP_SYSTEM_MEM=1 # Gb
20
+ TOTAL_MEM=$(cat /proc/meminfo | grep -e '^MemTotal:' | awk '{print $2}')
21
+ VM_MEM=$(( ($TOTAL_MEM / 1024) - $KEEP_SYSTEM_MEM * 1024 ))
22
+
23
+ # CPU
24
+ SMP=$(nproc)
25
+
26
+ # Clean shutdown of the VM at the end of the OAR job
27
+ clean_shutdown() {
28
+ echo "Caught shutdown signal at $(date)"
29
+ echo "system_powerdown" | nc -U /tmp/vagrant-g5k.mon
30
+ }
31
+
32
+ trap clean_shutdown 12
33
+
34
+ # Launch virtual machine
35
+ 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 &
36
+
37
+ wait
38
+
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ #OAR -l slash_22=1+{virtual!='none'}/nodes=1,walltime=06:00:00
3
+ #OAR --checkpoint 60
4
+ #OAR --signal 12
5
+
6
+ # Directory for qcow2 snapshots
7
+ export TMPDIR=/tmp
8
+ #IMAGE=/grid5000/virt-images/alpine-docker.qcow2
9
+ IMAGE=$1
10
+
11
+ # GET Virtual IP information
12
+ IP_ADDR=$(/usr/local/bin/g5k-subnets -im | head -1 | awk '{print $1}')
13
+ MAC_ADDR=$(/usr/local/bin/g5k-subnets -im | head -1 | awk '{print $2}')
14
+
15
+ echo "VM IP informations :"
16
+ echo "IP address: $IP_ADDR"
17
+ echo "MAC address: $MAC_ADDR"
18
+
19
+ # Create tap
20
+ TAP=$(sudo create_tap)
21
+
22
+ # Memory allocation
23
+ KEEP_SYSTEM_MEM=1 # Gb
24
+ TOTAL_MEM=$(cat /proc/meminfo | grep -e '^MemTotal:' | awk '{print $2}')
25
+ VM_MEM=$(( ($TOTAL_MEM / 1024) - $KEEP_SYSTEM_MEM * 1024 ))
26
+
27
+ # CPU
28
+ SMP=$(nproc)
29
+
30
+ # Clean shutdown of the VM at the end of the OAR job
31
+ clean_shutdown() {
32
+ echo "Caught shutdown signal at $(date)"
33
+ echo "system_powerdown" | nc -U /tmp/vagrant-g5k.mon
34
+ }
35
+
36
+ trap clean_shutdown 12
37
+
38
+ # Launch virtual machine
39
+ #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 &
40
+ #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 &
41
+ 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 -net user,hostfwd=tcp::2222-:22 -monitor unix:/tmp/vagrant-g5k.mon,server,nowait -localtime -enable-kvm &
42
+
43
+ wait
44
+
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module G5K
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,159 @@
1
+ en:
2
+ vagrant_g5k:
3
+ already_status: |-
4
+ The machine is already %{status}.
5
+ burning_ami: |-
6
+ Waiting for the AMI '%{ami_id}' to burn...
7
+ elb:
8
+ adjusting: |-
9
+ Adjusting availability zones of ELB %{elb_name}...
10
+ registering: |-
11
+ Registering %{instance_id} at ELB %{elb_name}...
12
+ deregistering: |-
13
+ Deregistering %{instance_id} from ELB %{elb_name}...
14
+ ok: |-
15
+ ok
16
+ skipped: |-
17
+ skipped
18
+
19
+ launching_instance: |-
20
+ Launching an instance with the following settings...
21
+ launch_no_keypair: |-
22
+ Warning! You didn't specify a keypair to launch your instance with.
23
+ This can sometimes result in not being able to access your instance.
24
+ launch_vpc_warning: |-
25
+ Warning! You're launching this instance into a VPC without an
26
+ elastic IP. Please verify you're properly connected to a VPN so
27
+ you can access this machine, otherwise Vagrant will not be able
28
+ to SSH into it.
29
+ not_created: |-
30
+ Instance is not created. Please run `vagrant up` first.
31
+ packaging_instance: |-
32
+ Burning instance %{instance_id} into an ami
33
+ packaging_instance_complete: |-
34
+ Burn was successful in %{time_seconds}s
35
+ ready: |-
36
+ Machine is booted and ready for use!
37
+ rsync_not_found_warning: |-
38
+ Warning! Folder sync disabled because the rsync binary is missing in the %{side}.
39
+ Make sure rsync is installed and the binary can be found in the PATH.
40
+ rsync_folder: |-
41
+ Rsyncing folder: %{hostpath} => %{guestpath}
42
+ source_dest_checks_no_vpc: |-
43
+ Warning! Ignoring source_dest_checks flag as it can only be configured on
44
+ a VPC instance.
45
+ starting: |-
46
+ Starting the instance...
47
+ stopping: |-
48
+ Stopping the instance...
49
+ terminating: |-
50
+ Terminating the instance...
51
+ waiting_for_ready: |-
52
+ Waiting for instance to become "ready"...
53
+ waiting_for_ssh: |-
54
+ Waiting for SSH to become available...
55
+ warn_networks: |-
56
+ Warning! The AWS provider doesn't support any of the Vagrant
57
+ high-level network configurations (`config.vm.network`). They
58
+ will be silently ignored.
59
+ warn_ssh_access: |-
60
+ Warning! Vagrant might not be able to SSH into the instance.
61
+ Please check your security groups settings.
62
+ will_not_destroy: |-
63
+ The instance '%{name}' will not be destroyed, since the confirmation
64
+ was declined.
65
+
66
+ config:
67
+ access_key_id_required: |-
68
+ An access key ID must be specified via "access_key_id"
69
+ ami_required: |-
70
+ An AMI must be configured via "ami" (region: #{region})
71
+ private_key_missing: |-
72
+ The specified private key for AWS could not be found
73
+ region_required: |-
74
+ A region must be specified via "region"
75
+ secret_access_key_required: |-
76
+ A secret access key is required via "secret_access_key"
77
+ subnet_id_required_with_public_ip: |-
78
+ If you assign a public IP address to an instance in a VPC, a subnet must be specifed via "subnet_id"
79
+ g5k_info_required: |-
80
+ One or more of the needed AWS credentials are missing. No environment variables
81
+ are set nor profile '%{profile}' exists at '%{location}'
82
+
83
+ errors:
84
+ fog_error: |-
85
+ There was an error talking to AWS. The error message is shown
86
+ below:
87
+
88
+ %{message}
89
+ internal_fog_error: |-
90
+ There was an error talking to AWS. The error message is shown
91
+ below:
92
+
93
+ Error: %{error}
94
+ Response: %{response}
95
+ instance_ready_timeout: |-
96
+ The instance never became "ready" in AWS. The timeout currently
97
+ set waiting for the instance to become ready is %{timeout} seconds.
98
+ Please verify that the machine properly boots. If you need more time
99
+ set the `instance_ready_timeout` configuration on the AWS provider.
100
+ instance_package_error: |-
101
+ There was an error packaging the instance. See details below for more info.
102
+
103
+ AMI Id: %{ami_id}
104
+ Error: %{err}
105
+ instance_package_timeout: |-
106
+ The AMI failed to become "ready" in AWS. The timeout currently
107
+ set waiting for the instance to become ready is %{timeout} seconds. For
108
+ larger instances AMI burning may take long periods of time. Please
109
+ ensure the timeout is set high enough, it can be changed by adjusting
110
+ the `instance_package_timeout` configuration on the AWS provider.
111
+ rsync_error: |-
112
+ There was an error when attempting to rsync a shared folder.
113
+ Please inspect the error message below for more info.
114
+
115
+ Host path: %{hostpath}
116
+ Guest path: %{guestpath}
117
+ Error: %{stderr}
118
+ mkdir_error: |-
119
+ There was an error when attempting to create a shared host folder.
120
+ Please inspect the error message below for more info.
121
+
122
+ Host path: %{hostpath}
123
+ Error: %{err}
124
+ elb_does_not_exist: |-
125
+ ELB configured for the instance does not exist
126
+
127
+ states:
128
+ short_not_created: |-
129
+ not created
130
+ long_not_created: |-
131
+ The EC2 instance is not created. Run `vagrant up` to create it.
132
+
133
+ short_stopped: |-
134
+ stopped
135
+ long_stopped: |-
136
+ The EC2 instance is stopped. Run `vagrant up` to start it.
137
+
138
+ short_stopping: |-
139
+ stopping
140
+ long_stopping: |-
141
+ The EC2 instance is stopping. Wait until is completely stopped to
142
+ run `vagrant up` and start it.
143
+
144
+ short_pending: |-
145
+ pending
146
+ long_pending: |-
147
+ The EC2 instance is pending a start (i.e. this is a transition state).
148
+
149
+ short_running: |-
150
+ running
151
+ long_running: |-
152
+ The EC2 instance is running. To stop this machine, you can run
153
+ `vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
154
+
155
+ short_pending: |-
156
+ pending
157
+ long_pending: |-
158
+ The EC2 instance is still being initialized. To destroy this machine,
159
+ you can run `vagrant destroy`.
@@ -0,0 +1,62 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require "vagrant-g5k/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "vagrant-g5k"
6
+ s.version = VagrantPlugins::G5K::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.license = "MIT"
9
+ s.authors = "Matthieu Simonin"
10
+ s.email = "matthieu.simonin@inria.fr"
11
+ s.homepage = "https://github.com/msimonin/vagrant-g5k"
12
+ s.summary = "Enables to boot a vm in the production environment of G5K."
13
+ s.description = "Enables to boot a vm in the production environment of G5K."
14
+
15
+ s.required_rubygems_version = ">= 1.3.6"
16
+ s.rubyforge_project = "vagrant-g5k"
17
+
18
+ s.add_runtime_dependency "iniparse", "~> 1.4", ">= 1.4.2"
19
+ s.add_runtime_dependency "net-ssh", "~> 3.0.2"
20
+ s.add_runtime_dependency "net-scp", "~> 1.1.2"
21
+ s.add_runtime_dependency "net-ssh-multi", "~> 1.2.1 "
22
+
23
+ s.add_development_dependency "rake"
24
+ # rspec 3.4 to mock File
25
+ s.add_development_dependency "rspec", "~> 3.4"
26
+ s.add_development_dependency "rspec-its"
27
+
28
+ # The following block of code determines the files that should be included
29
+ # in the gem. It does this by reading all the files in the directory where
30
+ # this gemspec is, and parsing out the ignored files from the gitignore.
31
+ # Note that the entire gitignore(5) syntax is not supported, specifically
32
+ # the "!" syntax, but it should mostly work correctly.
33
+ root_path = File.dirname(__FILE__)
34
+ all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
35
+ all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
36
+ gitignore_path = File.join(root_path, ".gitignore")
37
+ gitignore = File.readlines(gitignore_path)
38
+ gitignore.map! { |line| line.chomp.strip }
39
+ gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
40
+
41
+ unignored_files = all_files.reject do |file|
42
+ # Ignore any directories, the gemspec only cares about files
43
+ next true if File.directory?(file)
44
+
45
+ # Ignore any paths that match anything in the gitignore. We do
46
+ # two tests here:
47
+ #
48
+ # - First, test to see if the entire path matches the gitignore.
49
+ # - Second, match if the basename does, this makes it so that things
50
+ # like '.DS_Store' will match sub-directories too (same behavior
51
+ # as git).
52
+ #
53
+ gitignore.any? do |ignore|
54
+ File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
55
+ File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
56
+ end
57
+ end
58
+
59
+ s.files = unignored_files
60
+ s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
61
+ s.require_path = 'lib'
62
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-g5k
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Matthieu Simonin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: iniparse
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.4.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.4.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: net-ssh
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.2
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.2
47
+ - !ruby/object:Gem::Dependency
48
+ name: net-scp
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.2
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 1.1.2
61
+ - !ruby/object:Gem::Dependency
62
+ name: net-ssh-multi
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 1.2.1
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 1.2.1
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '3.4'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.4'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec-its
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: Enables to boot a vm in the production environment of G5K.
118
+ email: matthieu.simonin@inria.fr
119
+ executables: []
120
+ extensions: []
121
+ extra_rdoc_files: []
122
+ files:
123
+ - ".gitignore"
124
+ - ".rspec"
125
+ - CHANGELOG.md
126
+ - Gemfile
127
+ - LICENSE
128
+ - README.md
129
+ - lib/vagrant-g5k.rb
130
+ - lib/vagrant-g5k/.config.rb.swp
131
+ - lib/vagrant-g5k/action.rb
132
+ - lib/vagrant-g5k/action/.message_not_created.rb.swp
133
+ - lib/vagrant-g5k/action/connect_g5k.rb
134
+ - lib/vagrant-g5k/action/create_local_working_dir.rb
135
+ - lib/vagrant-g5k/action/is_created.rb
136
+ - lib/vagrant-g5k/action/message_already_created.rb
137
+ - lib/vagrant-g5k/action/message_not_created.rb
138
+ - lib/vagrant-g5k/action/read_ssh_info.rb
139
+ - lib/vagrant-g5k/action/read_state.rb
140
+ - lib/vagrant-g5k/action/run_instance.rb
141
+ - lib/vagrant-g5k/command.rb
142
+ - lib/vagrant-g5k/config.rb
143
+ - lib/vagrant-g5k/errors.rb
144
+ - lib/vagrant-g5k/plugin.rb
145
+ - lib/vagrant-g5k/provider.rb
146
+ - lib/vagrant-g5k/util/.g5k_utils.rb.swp
147
+ - lib/vagrant-g5k/util/g5k_utils.rb
148
+ - lib/vagrant-g5k/util/launch_vm.sh
149
+ - lib/vagrant-g5k/util/launch_vm_fwd.sh
150
+ - lib/vagrant-g5k/version.rb
151
+ - locales/en.yml
152
+ - vagrant-g5k.gemspec
153
+ homepage: https://github.com/msimonin/vagrant-g5k
154
+ licenses:
155
+ - MIT
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: 1.3.6
171
+ requirements: []
172
+ rubyforge_project: vagrant-g5k
173
+ rubygems_version: 2.5.1
174
+ signing_key:
175
+ specification_version: 4
176
+ summary: Enables to boot a vm in the production environment of G5K.
177
+ test_files: []