vagrant-ovirt4 1.2.3 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.github/workflows/release.yml +20 -0
- data/.gitignore +1 -2
- data/Gemfile +3 -11
- data/Gemfile.lock +27 -206
- data/README.md +8 -21
- data/Rakefile +1 -18
- data/lib/vagrant-ovirt4/action.rb +17 -8
- data/lib/vagrant-ovirt4/action/create_vm.rb +5 -5
- data/lib/vagrant-ovirt4/action/halt_vm.rb +11 -0
- data/lib/vagrant-ovirt4/action/read_ssh_info.rb +6 -1
- data/lib/vagrant-ovirt4/action/read_state.rb +7 -1
- data/lib/vagrant-ovirt4/action/start_vm.rb +8 -2
- data/lib/vagrant-ovirt4/action/wait_till_up.rb +7 -1
- data/lib/vagrant-ovirt4/config.rb +1 -1
- data/lib/vagrant-ovirt4/version.rb +1 -1
- data/locales/en.yml +4 -0
- data/spec/vagrant-ovirt4/config_spec.rb +2 -2
- data/vagrant-ovirt4.gemspec +1 -0
- metadata +19 -14
- data/.kitchen.yml +0 -83
- data/Jenkinsfile +0 -70
- data/lib/vagrant-ovirt4/action/sync_folders.rb +0 -69
- data/test/integration/bios_serial/bios_serial_spec.rb +0 -6
- data/test/integration/dynamic_network/network_spec.rb +0 -6
- data/test/integration/optimized_for.sh +0 -4
- data/test/integration/singleton-static_network/network_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48a3502fc6d918fe1418248df8be2ca6ba8d2e0f477eb79784c0dbfd6a12c2e2
|
4
|
+
data.tar.gz: f33988dd5f134f0f6336e62ab21e4a4de534a434eb721e754301e6319e9043be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a84a0d2994268c8fa8df3715fbc5d3c5b40c1505cfdbb750e94539561498cc2d803ca532478bf24d9fc45d1a220bee0bcd1fd00b977f9bf221f841deed5860ec
|
7
|
+
data.tar.gz: 2533a97a3cfe3435cad9c3d9dc9199380874736f9221991e8b3072504a07dc7a590aceaf616450f4ddb7d0f52b169f57ef7855e3e3f7a75df1ea81e5ff638600
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths:
|
6
|
+
- lib/vagrant-ovirt4/version.rb
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: fregante/setup-git-user@v1
|
15
|
+
- name: Release Gem
|
16
|
+
uses: cadwallion/publish-rubygems-action@master
|
17
|
+
env:
|
18
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
19
|
+
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
20
|
+
RELEASE_COMMAND: rake release
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,20 +1,12 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem '
|
4
|
+
gem 'rake'
|
5
|
+
gem 'rspec-core'
|
5
6
|
gem 'pry'
|
6
7
|
gem 'byebug'
|
7
8
|
gem 'pry-byebug'
|
8
|
-
|
9
|
-
|
10
|
-
group :testing do
|
11
|
-
gem 'rspec-its'
|
12
|
-
gem 'rspec'
|
13
|
-
gem 'rake'
|
14
|
-
gem 'kitchen-vagrant'
|
15
|
-
gem 'kitchen-inspec'
|
16
|
-
gem 'test-kitchen'
|
17
|
-
gem 'net-scp', "~>1.2"
|
9
|
+
gem 'rake-release'
|
18
10
|
end
|
19
11
|
|
20
12
|
group :plugins do
|
data/Gemfile.lock
CHANGED
@@ -1,229 +1,50 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/myoung34/vagrant.git
|
3
|
-
revision: 4572267c33f4ba569f68ad4bff026e9a7ef63b56
|
4
|
-
specs:
|
5
|
-
vagrant (1.9.3.dev)
|
6
|
-
childprocess (~> 0.5.0)
|
7
|
-
erubis (~> 2.7.0)
|
8
|
-
hashicorp-checkpoint (~> 0.1.1)
|
9
|
-
i18n (>= 0.6.0, <= 0.8.0)
|
10
|
-
listen (~> 3.1.5)
|
11
|
-
log4r (~> 1.1.9, < 1.1.11)
|
12
|
-
net-scp (~> 1.2.0)
|
13
|
-
net-sftp (~> 2.1)
|
14
|
-
net-ssh (~> 3.0.1)
|
15
|
-
nokogiri (= 1.6.7.1)
|
16
|
-
rb-kqueue (~> 0.2.0)
|
17
|
-
rest-client (>= 1.6.0, < 3.0)
|
18
|
-
ruby_dep (<= 1.3.1)
|
19
|
-
wdm (~> 0.1.0)
|
20
|
-
winrm (~> 2.1)
|
21
|
-
winrm-elevated (~> 1.1)
|
22
|
-
winrm-fs (~> 1.0)
|
23
|
-
|
24
1
|
PATH
|
25
2
|
remote: .
|
26
3
|
specs:
|
27
|
-
vagrant-ovirt4 (
|
4
|
+
vagrant-ovirt4 (2.0.0)
|
28
5
|
filesize (~> 0)
|
6
|
+
nokogiri (>= 1.10.8)
|
29
7
|
ovirt-engine-sdk (~> 4.0.1)
|
30
8
|
|
31
9
|
GEM
|
32
10
|
remote: http://rubygems.org/
|
33
11
|
specs:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
excon (>= 0.38.0)
|
44
|
-
json
|
45
|
-
domain_name (0.5.20170223)
|
46
|
-
unf (>= 0.0.5, < 1.0.0)
|
47
|
-
erubis (2.7.0)
|
48
|
-
excon (0.71.0)
|
49
|
-
faraday (0.11.0)
|
50
|
-
multipart-post (>= 1.2, < 3)
|
51
|
-
ffi (1.11.1)
|
52
|
-
filesize (0.1.1)
|
53
|
-
gssapi (1.2.0)
|
54
|
-
ffi (>= 1.0.1)
|
55
|
-
gyoku (1.3.1)
|
56
|
-
builder (>= 2.1.2)
|
57
|
-
hashicorp-checkpoint (0.1.4)
|
58
|
-
hashie (3.5.5)
|
59
|
-
http-cookie (1.0.3)
|
60
|
-
domain_name (~> 0.5)
|
61
|
-
httpclient (2.8.3)
|
62
|
-
i18n (0.8.0)
|
63
|
-
inspec (1.15.0)
|
64
|
-
faraday (>= 0.9.0)
|
65
|
-
hashie (~> 3.4)
|
66
|
-
json (>= 1.8, < 3.0)
|
67
|
-
method_source (~> 0.8)
|
68
|
-
mixlib-log
|
69
|
-
parallel (~> 1.9)
|
70
|
-
pry (~> 0)
|
71
|
-
rainbow (~> 2)
|
72
|
-
rspec (~> 3)
|
73
|
-
rspec-its (~> 1.2)
|
74
|
-
rspec_junit_formatter (~> 0.2.3)
|
75
|
-
rubyzip (~> 1.1)
|
76
|
-
sslshake (~> 1)
|
77
|
-
thor (~> 0.19)
|
78
|
-
toml (~> 0.1)
|
79
|
-
train (>= 0.22.0, < 1.0)
|
80
|
-
json (2.0.3)
|
81
|
-
kitchen-inspec (0.17.0)
|
82
|
-
hashie (~> 3.4)
|
83
|
-
inspec (>= 0.34.0, < 2.0.0)
|
84
|
-
test-kitchen (~> 1.6)
|
85
|
-
kitchen-vagrant (1.0.2)
|
86
|
-
test-kitchen (~> 1.4)
|
87
|
-
listen (3.1.5)
|
88
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
89
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
90
|
-
ruby_dep (~> 1.2)
|
91
|
-
little-plugger (1.1.4)
|
92
|
-
log4r (1.1.10)
|
93
|
-
logging (2.1.0)
|
94
|
-
little-plugger (~> 1.1)
|
95
|
-
multi_json (~> 1.10)
|
96
|
-
method_source (0.8.2)
|
97
|
-
mime-types (3.1)
|
98
|
-
mime-types-data (~> 3.2015)
|
99
|
-
mime-types-data (3.2016.0521)
|
100
|
-
mini_portile2 (2.0.0)
|
101
|
-
mixlib-install (2.1.12)
|
102
|
-
artifactory
|
103
|
-
mixlib-shellout
|
104
|
-
mixlib-versioning
|
105
|
-
thor
|
106
|
-
mixlib-log (1.7.1)
|
107
|
-
mixlib-shellout (2.2.7)
|
108
|
-
mixlib-versioning (1.1.0)
|
109
|
-
multi_json (1.12.1)
|
110
|
-
multipart-post (2.0.0)
|
111
|
-
net-scp (1.2.1)
|
112
|
-
net-ssh (>= 2.6.5)
|
113
|
-
net-sftp (2.1.2)
|
114
|
-
net-ssh (>= 2.6.5)
|
115
|
-
net-ssh (3.0.2)
|
116
|
-
net-ssh-gateway (1.3.0)
|
117
|
-
net-ssh (>= 2.6.5)
|
118
|
-
netrc (0.11.0)
|
119
|
-
nokogiri (1.6.7.1)
|
120
|
-
mini_portile2 (~> 2.0.0.rc2)
|
121
|
-
nori (2.6.0)
|
12
|
+
byebug (11.1.3)
|
13
|
+
coderay (1.1.2)
|
14
|
+
filesize (0.2.0)
|
15
|
+
json (2.5.1)
|
16
|
+
method_source (1.0.0)
|
17
|
+
mini_portile2 (2.5.0)
|
18
|
+
nokogiri (1.11.1)
|
19
|
+
mini_portile2 (~> 2.5.0)
|
20
|
+
racc (~> 1.4)
|
122
21
|
ovirt-engine-sdk (4.0.12)
|
123
22
|
json
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
pry (
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
rb-inotify (0.9.8)
|
138
|
-
ffi (>= 0.5.0)
|
139
|
-
rb-kqueue (0.2.4)
|
140
|
-
ffi (>= 0.5.0)
|
141
|
-
rest-client (2.0.1)
|
142
|
-
http-cookie (>= 1.0.2, < 2.0)
|
143
|
-
mime-types (>= 1.16, < 4.0)
|
144
|
-
netrc (~> 0.8)
|
145
|
-
rspec (3.5.0)
|
146
|
-
rspec-core (~> 3.5.0)
|
147
|
-
rspec-expectations (~> 3.5.0)
|
148
|
-
rspec-mocks (~> 3.5.0)
|
149
|
-
rspec-core (3.5.4)
|
150
|
-
rspec-support (~> 3.5.0)
|
151
|
-
rspec-expectations (3.5.0)
|
152
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
153
|
-
rspec-support (~> 3.5.0)
|
154
|
-
rspec-its (1.2.0)
|
155
|
-
rspec-core (>= 3.0.0)
|
156
|
-
rspec-expectations (>= 3.0.0)
|
157
|
-
rspec-mocks (3.5.0)
|
158
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
159
|
-
rspec-support (~> 3.5.0)
|
160
|
-
rspec-support (3.5.0)
|
161
|
-
rspec_junit_formatter (0.2.3)
|
162
|
-
builder (< 4)
|
163
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
164
|
-
ruby_dep (1.3.1)
|
165
|
-
rubyntlm (0.6.1)
|
166
|
-
rubyzip (1.3.0)
|
167
|
-
safe_yaml (1.0.4)
|
168
|
-
slop (3.6.0)
|
169
|
-
sslshake (1.0.13)
|
170
|
-
test-kitchen (1.15.0)
|
171
|
-
mixlib-install (>= 1.2, < 3.0)
|
172
|
-
mixlib-shellout (>= 1.2, < 3.0)
|
173
|
-
net-scp (~> 1.1)
|
174
|
-
net-ssh (>= 2.9, < 5.0)
|
175
|
-
net-ssh-gateway (~> 1.2)
|
176
|
-
safe_yaml (~> 1.0)
|
177
|
-
thor (~> 0.18)
|
178
|
-
thor (0.19.4)
|
179
|
-
toml (0.1.2)
|
180
|
-
parslet (~> 1.5.0)
|
181
|
-
train (0.22.1)
|
182
|
-
docker-api (~> 1.26)
|
183
|
-
json (>= 1.8, < 3.0)
|
184
|
-
mixlib-shellout (~> 2.0)
|
185
|
-
net-scp (~> 1.2)
|
186
|
-
net-ssh (>= 2.9, < 5.0)
|
187
|
-
winrm (~> 2.0)
|
188
|
-
winrm-fs (~> 1.0)
|
189
|
-
unf (0.1.4)
|
190
|
-
unf_ext
|
191
|
-
unf_ext (0.0.7.2)
|
192
|
-
wdm (0.1.1)
|
193
|
-
winrm (2.1.2)
|
194
|
-
builder (>= 2.1.2)
|
195
|
-
erubis (~> 2.7)
|
196
|
-
gssapi (~> 1.2)
|
197
|
-
gyoku (~> 1.0)
|
198
|
-
httpclient (~> 2.2, >= 2.2.0.2)
|
199
|
-
logging (>= 1.6.1, < 3.0)
|
200
|
-
nori (~> 2.0)
|
201
|
-
rubyntlm (~> 0.6.0, >= 0.6.1)
|
202
|
-
winrm-elevated (1.1.0)
|
203
|
-
winrm (~> 2.0)
|
204
|
-
winrm-fs (~> 1.0)
|
205
|
-
winrm-fs (1.0.1)
|
206
|
-
erubis (~> 2.7)
|
207
|
-
logging (>= 1.6.1, < 3.0)
|
208
|
-
rubyzip (~> 1.1)
|
209
|
-
winrm (~> 2.0)
|
23
|
+
pry (0.13.1)
|
24
|
+
coderay (~> 1.1)
|
25
|
+
method_source (~> 1.0)
|
26
|
+
pry-byebug (3.9.0)
|
27
|
+
byebug (~> 11.0)
|
28
|
+
pry (~> 0.13.0)
|
29
|
+
racc (1.5.2)
|
30
|
+
rake (13.0.3)
|
31
|
+
rake-release (1.2.1)
|
32
|
+
bundler (>= 1.11, < 3)
|
33
|
+
rspec-core (3.10.1)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-support (3.10.1)
|
210
36
|
|
211
37
|
PLATFORMS
|
212
38
|
ruby
|
213
39
|
|
214
40
|
DEPENDENCIES
|
215
41
|
byebug
|
216
|
-
kitchen-inspec
|
217
|
-
kitchen-vagrant
|
218
|
-
net-scp (~> 1.2)
|
219
42
|
pry
|
220
43
|
pry-byebug
|
221
44
|
rake
|
222
|
-
|
223
|
-
rspec-
|
224
|
-
test-kitchen
|
225
|
-
vagrant!
|
45
|
+
rake-release
|
46
|
+
rspec-core
|
226
47
|
vagrant-ovirt4!
|
227
48
|
|
228
49
|
BUNDLED WITH
|
229
|
-
1.
|
50
|
+
1.17.2
|
data/README.md
CHANGED
@@ -63,6 +63,12 @@ Vagrant.configure("2") do |config|
|
|
63
63
|
:ovirt__network_name => 'ovirtmgmt' #DHCP
|
64
64
|
# Static configuration
|
65
65
|
#:ovirt__ip => '192.168.2.198', :ovirt__network_name => 'ovirtmgmt', :ovirt__gateway => '192.168.2.125', :ovirt__netmask => '255.255.0.0', :ovirt__dns_servers => '192.168.2.1', :ovirt__dns_search => 'test.local'
|
66
|
+
# Static configuration with biosdevname. Guest OS assigns interface names (ens3, em1 or something else). ovirt__interface_name has to match that name.
|
67
|
+
#:ovirt__ip => '192.168.2.198', :ovirt__network_name => 'ovirtmgmt', :ovirt__gateway => '192.168.2.125', :ovirt__netmask => '255.255.0.0', :ovirt__dns_servers => '192.168.2.1', :ovirt__dns_search => 'test.local', :ovirt__interface_name => 'ens3'
|
68
|
+
|
69
|
+
# configure additional interface
|
70
|
+
# config.vm.network :private_network,
|
71
|
+
# :ovirt__ip => '192.168.2.199', :ovirt__network_name => 'ovirtmgmt', :ovirt__netmask => '255.255.0.0', :ovirt__interface_name => 'ens4'
|
66
72
|
|
67
73
|
config.vm.provider :ovirt4 do |ovirt|
|
68
74
|
ovirt.url = 'https://server/ovirt-engine/api'
|
@@ -74,9 +80,9 @@ Vagrant.configure("2") do |config|
|
|
74
80
|
ovirt.cluster = 'Default'
|
75
81
|
ovirt.template = 'Vagrant-Centos7-test'
|
76
82
|
ovirt.console = 'vnc'
|
77
|
-
ovirt.disk_size = '15
|
83
|
+
ovirt.disk_size = '15 GiB' # only growing is supported. works the same way as below memory settings
|
78
84
|
ovirt.memory_size = '1 GiB' #see https://github.com/dominikh/filesize for usage
|
79
|
-
ovirt.memory_guaranteed = '256
|
85
|
+
ovirt.memory_guaranteed = '256 MiB' #see https://github.com/dominikh/filesize for usage
|
80
86
|
ovirt.cpu_cores = 2
|
81
87
|
ovirt.cpu_sockets = 2
|
82
88
|
ovirt.cpu_threads = 2
|
@@ -132,25 +138,6 @@ end
|
|
132
138
|
a. `storage_domain`: the storage domain where the disk should be created
|
133
139
|
|
134
140
|
|
135
|
-
## Testing
|
136
|
-
|
137
|
-
Currently pull-requests are tested via [test-kitchen using kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant).
|
138
|
-
See [Jenkinsfile](Jenkinsfile) for more information.
|
139
|
-
If you'd like to run them yourself, however, they make not work in all setups. For example they assume `192.168.2.0/24`, host pinning will probably not have a host that's in all set ups, and the template names might not match.
|
140
|
-
|
141
|
-
To run Unit tests: `bundle install; bundle exec rspec`
|
142
|
-
|
143
|
-
To run acceptance tests:
|
144
|
-
|
145
|
-
```bash
|
146
|
-
export OVIRT_URL='https://yoururl/ovirt-engine/api''
|
147
|
-
export OVIRT_USERNAME='yourname@internal'
|
148
|
-
export OVIRT_PASSWORD='yourpassword!'
|
149
|
-
gem build *.gemspec
|
150
|
-
vagrant plugin install *.gem
|
151
|
-
bundle exec kitchen test all
|
152
|
-
```
|
153
|
-
|
154
141
|
## Contributing
|
155
142
|
|
156
143
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
|
+
require 'rake/release'
|
3
4
|
require 'rspec/core/rake_task'
|
4
|
-
require 'kitchen/rake_tasks'
|
5
5
|
|
6
6
|
# Immediately sync all stdout so that tools like buildbot can
|
7
7
|
# immediately load in the output.
|
@@ -14,20 +14,3 @@ Dir.chdir(File.expand_path("../", __FILE__))
|
|
14
14
|
# This installs the tasks that help with gem creation and
|
15
15
|
# publishing.
|
16
16
|
Bundler::GemHelper.install_tasks
|
17
|
-
|
18
|
-
# Install the `spec` task so that we can run tests.
|
19
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
20
|
-
t.rspec_opts = "--order defined"
|
21
|
-
end
|
22
|
-
|
23
|
-
# Default task is to run all tests
|
24
|
-
namespace :test do
|
25
|
-
task :all do
|
26
|
-
RSpec::Core::RakeTask.new(:spec)
|
27
|
-
Rake::Task["spec"].execute
|
28
|
-
Kitchen::RakeTasks.new
|
29
|
-
Rake::Task['kitchen:all'].invoke
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
task :default => 'test:all'
|
@@ -13,8 +13,11 @@ module VagrantPlugins
|
|
13
13
|
b.use ConfigValidate
|
14
14
|
b.use ConnectOVirt
|
15
15
|
b.use Call, ReadState do |env, b2|
|
16
|
+
# synced_folders defaults to NFS on linux. Make it default to rsync as before.
|
17
|
+
env[:machine].config.nfs.functional = false
|
16
18
|
if env[:machine_state_id] == :up
|
17
|
-
b2.use
|
19
|
+
b2.use SyncedFolderCleanup
|
20
|
+
b2.use SyncedFolders
|
18
21
|
b2.use MessageAlreadyUp
|
19
22
|
next
|
20
23
|
end
|
@@ -37,7 +40,8 @@ module VagrantPlugins
|
|
37
40
|
|
38
41
|
b2.use StartVM
|
39
42
|
b2.use WaitTillUp
|
40
|
-
b2.use
|
43
|
+
b2.use SyncedFolderCleanup
|
44
|
+
b2.use SyncedFolders
|
41
45
|
end
|
42
46
|
b.use DisconnectOVirt
|
43
47
|
end
|
@@ -54,8 +58,8 @@ module VagrantPlugins
|
|
54
58
|
|
55
59
|
b2.use ConnectOVirt
|
56
60
|
b2.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
|
57
|
-
b2.use HaltVM
|
58
|
-
b2.use WaitTillDown
|
61
|
+
b2.use HaltVM unless env[:machine].state.id == :down
|
62
|
+
b2.use WaitTillDown unless env[:machine].state.id == :down
|
59
63
|
b2.use DestroyVM
|
60
64
|
b2.use DisconnectOVirt
|
61
65
|
end
|
@@ -66,12 +70,15 @@ module VagrantPlugins
|
|
66
70
|
Vagrant::Action::Builder.new.tap do |b|
|
67
71
|
b.use ConfigValidate
|
68
72
|
b.use Call, IsCreated do |env, b2|
|
73
|
+
# synced_folders defaults to NFS on linux. Make it default to rsync as before.
|
74
|
+
env[:machine].config.nfs.functional = false
|
69
75
|
if !env[:result]
|
70
76
|
b2.use MessageNotCreated
|
71
77
|
next
|
72
78
|
end
|
73
79
|
b2.use Provision
|
74
|
-
b2.use
|
80
|
+
b2.use SyncedFolderCleanup
|
81
|
+
b2.use SyncedFolders
|
75
82
|
end
|
76
83
|
end
|
77
84
|
end
|
@@ -161,7 +168,7 @@ module VagrantPlugins
|
|
161
168
|
end
|
162
169
|
|
163
170
|
def self.action_reload
|
164
|
-
|
171
|
+
Vagrant::Action::Builder.new.tap do |b|
|
165
172
|
b.use action_halt
|
166
173
|
b.use action_up
|
167
174
|
end
|
@@ -194,7 +201,8 @@ module VagrantPlugins
|
|
194
201
|
b.use MessageNotSuspended
|
195
202
|
next
|
196
203
|
end
|
197
|
-
b.use
|
204
|
+
b.use StartVM
|
205
|
+
b.use WaitTillUp
|
198
206
|
end
|
199
207
|
end
|
200
208
|
|
@@ -234,7 +242,8 @@ module VagrantPlugins
|
|
234
242
|
autoload :SnapshotSave, action_root.join("snapshot_save")
|
235
243
|
autoload :StartVM, action_root.join("start_vm")
|
236
244
|
autoload :SuspendVM, action_root.join("suspend_vm")
|
237
|
-
autoload :
|
245
|
+
autoload :SyncedFolders, 'vagrant/action/builtin/synced_folders'
|
246
|
+
autoload :SyncedFolderCleanup, 'vagrant/action/builtin/synced_folder_cleanup'
|
238
247
|
autoload :WaitTillDown, action_root.join("wait_till_down")
|
239
248
|
autoload :WaitTillUp, action_root.join("wait_till_up")
|
240
249
|
autoload :WaitTilSuspended, action_root.join("wait_til_suspended")
|
@@ -29,15 +29,15 @@ module VagrantPlugins
|
|
29
29
|
env[:ui].info(" -- Optimized For: #{config.optimized_for}")
|
30
30
|
env[:ui].info(" -- Description: #{config.description}")
|
31
31
|
env[:ui].info(" -- Comment: #{config.comment}")
|
32
|
-
env[:ui].info(" -- Disk: #{Filesize.from("#{config.disk_size} B").to_f('
|
32
|
+
env[:ui].info(" -- Disk: #{Filesize.from("#{config.disk_size} B").to_f('GiB').to_i} GiB") unless config.disk_size.nil?
|
33
33
|
env[:ui].info(" -- Additional Disks:") unless config.disks.empty?
|
34
34
|
config.disks.each do |disk|
|
35
|
-
env[:ui].info(" ---- name=#{disk[:name]} size=#{Filesize.from("#{disk[:size]} B").to_f('
|
35
|
+
env[:ui].info(" ---- name=#{disk[:name]} size=#{Filesize.from("#{disk[:size]} B").to_f('GiB').to_i} GiB")
|
36
36
|
end
|
37
37
|
env[:ui].info(" -- Memory: ")
|
38
|
-
env[:ui].info(" ---- Memory: #{Filesize.from("#{config.memory_size} B").to_f('
|
39
|
-
env[:ui].info(" ---- Maximum: #{Filesize.from("#{config.memory_maximum} B").to_f('
|
40
|
-
env[:ui].info(" ---- Guaranteed: #{Filesize.from("#{config.memory_guaranteed} B").to_f('
|
38
|
+
env[:ui].info(" ---- Memory: #{Filesize.from("#{config.memory_size} B").to_f('MiB').to_i} MiB")
|
39
|
+
env[:ui].info(" ---- Maximum: #{Filesize.from("#{config.memory_maximum} B").to_f('MiB').to_i} MiB")
|
40
|
+
env[:ui].info(" ---- Guaranteed: #{Filesize.from("#{config.memory_guaranteed} B").to_f('MiB').to_i} MiB")
|
41
41
|
env[:ui].info(" -- Cpu: ")
|
42
42
|
env[:ui].info(" ---- Cores: #{config.cpu_cores}")
|
43
43
|
env[:ui].info(" ---- Sockets: #{config.cpu_sockets}")
|
@@ -12,6 +12,17 @@ module VagrantPlugins
|
|
12
12
|
def call(env)
|
13
13
|
env[:ui].info(I18n.t("vagrant_ovirt4.halt_vm"))
|
14
14
|
|
15
|
+
# Halt via OS capability
|
16
|
+
begin
|
17
|
+
if env[:machine].guest.capability?(:halt)
|
18
|
+
env[:machine].guest.capability(:halt)
|
19
|
+
# Give the VM a chance to shutdown gracefully..."
|
20
|
+
sleep 10
|
21
|
+
end
|
22
|
+
rescue
|
23
|
+
env[:ui].info("Failed to shutdown guest gracefully.")
|
24
|
+
end
|
25
|
+
|
15
26
|
machine = env[:vms_service].vm_service(env[:machine].id)
|
16
27
|
machine.stop rescue nil #todo dont rescue
|
17
28
|
|
@@ -36,7 +36,12 @@ module VagrantPlugins
|
|
36
36
|
|
37
37
|
nics_service = server.nics_service
|
38
38
|
nics = nics_service.list
|
39
|
-
|
39
|
+
begin
|
40
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment.reported_devices).collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first
|
41
|
+
rescue
|
42
|
+
# for backwards compatibility with ovirt 4.3
|
43
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment).reported_devices.collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first rescue nil
|
44
|
+
end
|
40
45
|
|
41
46
|
# Return the info
|
42
47
|
# TODO: Some info should be configurable in Vagrantfile
|
@@ -33,7 +33,13 @@ module VagrantPlugins
|
|
33
33
|
end
|
34
34
|
nics_service = server.nics_service
|
35
35
|
nics = nics_service.list
|
36
|
-
|
36
|
+
begin
|
37
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment.reported_devices).collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first
|
38
|
+
rescue
|
39
|
+
# for backwards compatibility with ovirt 4.3
|
40
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment).reported_devices.collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first rescue nil
|
41
|
+
end
|
42
|
+
|
37
43
|
unless ip_addr.nil?
|
38
44
|
env[:ip_address] = ip_addr
|
39
45
|
@logger.debug("Got output #{env[:ip_address]}")
|
@@ -46,9 +46,15 @@ module VagrantPlugins
|
|
46
46
|
(0...configured_ifaces_options.length()).each do |iface_index|
|
47
47
|
iface_options = configured_ifaces_options[iface_index]
|
48
48
|
|
49
|
+
if iface_options[:interface_name] != nil then
|
50
|
+
iface_name = iface_options[:interface_name]
|
51
|
+
else
|
52
|
+
iface_name = "eth#{iface_index}"
|
53
|
+
end
|
54
|
+
|
49
55
|
if iface_options[:ip] then
|
50
56
|
nic_configuration = {
|
51
|
-
name:
|
57
|
+
name: iface_name,
|
52
58
|
on_boot: true,
|
53
59
|
boot_protocol: OvirtSDK4::BootProtocol::STATIC,
|
54
60
|
ip: {
|
@@ -60,7 +66,7 @@ module VagrantPlugins
|
|
60
66
|
}
|
61
67
|
else
|
62
68
|
nic_configuration = {
|
63
|
-
name:
|
69
|
+
name: iface_name,
|
64
70
|
on_boot: true,
|
65
71
|
boot_protocol: OvirtSDK4::BootProtocol::DHCP,
|
66
72
|
}
|
@@ -57,7 +57,13 @@ module VagrantPlugins
|
|
57
57
|
|
58
58
|
nics_service = server.nics_service
|
59
59
|
nics = nics_service.list
|
60
|
-
|
60
|
+
begin
|
61
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment.reported_devices).collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first
|
62
|
+
rescue
|
63
|
+
# for backwards compatibility with ovirt 4.3
|
64
|
+
ip_addr = nics.collect { |nic_attachment| env[:connection].follow_link(nic_attachment).reported_devices.collect { |dev| dev.ips.collect { |ip| ip.address if ip.version == 'v4' } unless dev.ips.nil? } }.flatten.reject { |ip| ip.nil? }.first rescue nil
|
65
|
+
end
|
66
|
+
|
61
67
|
unless ip_addr.nil?
|
62
68
|
env[:ui].info("Got IP: #{ip_addr}")
|
63
69
|
# Check if SSH-Server is up
|
@@ -98,7 +98,7 @@ module VagrantPlugins
|
|
98
98
|
@cpu_threads = 1 if @cpu_threads == UNSET_VALUE
|
99
99
|
@cluster = nil if @cluster == UNSET_VALUE
|
100
100
|
@console = nil if @console == UNSET_VALUE
|
101
|
-
@memory_size = '256
|
101
|
+
@memory_size = '256 MiB' if @memory_size == UNSET_VALUE
|
102
102
|
@memory_maximum = @memory_size if @memory_maximum == UNSET_VALUE
|
103
103
|
@memory_guaranteed = @memory_size if @memory_guaranteed == UNSET_VALUE
|
104
104
|
@template = nil if @template == UNSET_VALUE
|
data/locales/en.yml
CHANGED
@@ -55,6 +55,10 @@ en:
|
|
55
55
|
The instance is not running. Use `vagrant up` to start it.
|
56
56
|
short_down: |-
|
57
57
|
down
|
58
|
+
long_not_created: |-
|
59
|
+
The instance is not created. Use `vagrant up` to create it.
|
60
|
+
short_not_created: |-
|
61
|
+
not created
|
58
62
|
errors:
|
59
63
|
remove_vm_error: |-
|
60
64
|
Error removing VM '%{vm_name}'. oVirt error message was '%{error_message}'
|
@@ -68,13 +68,13 @@ describe VagrantPlugins::OVirtProvider::Config do
|
|
68
68
|
[:memory_size, :memory_maximum, :memory_guaranteed].each do |attribute|
|
69
69
|
|
70
70
|
it "should not default #{attribute} if overridden" do
|
71
|
-
instance.send("#{attribute}=".to_sym, "512
|
71
|
+
instance.send("#{attribute}=".to_sym, "512 MiB")
|
72
72
|
instance.finalize!
|
73
73
|
instance.send(attribute).should == 512000000
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should convert the value" do
|
77
|
-
instance.send("#{attribute}=".to_sym, "1
|
77
|
+
instance.send("#{attribute}=".to_sym, "1 GiB")
|
78
78
|
instance.finalize!
|
79
79
|
instance.send(attribute).should == 1000000000
|
80
80
|
end
|
data/vagrant-ovirt4.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-ovirt4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Young
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ovirt-engine-sdk
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.10.8
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.10.8
|
41
55
|
description: Vagrant provider for oVirt and RHEV v4
|
42
56
|
email:
|
43
57
|
- myoung34@my.apsu.edu
|
@@ -45,13 +59,13 @@ executables: []
|
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
62
|
+
- ".github/FUNDING.yml"
|
63
|
+
- ".github/workflows/release.yml"
|
48
64
|
- ".gitignore"
|
49
|
-
- ".kitchen.yml"
|
50
65
|
- ".rspec"
|
51
66
|
- Dockerfile
|
52
67
|
- Gemfile
|
53
68
|
- Gemfile.lock
|
54
|
-
- Jenkinsfile
|
55
69
|
- LICENSE
|
56
70
|
- README.md
|
57
71
|
- Rakefile
|
@@ -85,7 +99,6 @@ files:
|
|
85
99
|
- lib/vagrant-ovirt4/action/snapshot_save.rb
|
86
100
|
- lib/vagrant-ovirt4/action/start_vm.rb
|
87
101
|
- lib/vagrant-ovirt4/action/suspend_vm.rb
|
88
|
-
- lib/vagrant-ovirt4/action/sync_folders.rb
|
89
102
|
- lib/vagrant-ovirt4/action/wait_til_suspended.rb
|
90
103
|
- lib/vagrant-ovirt4/action/wait_till_down.rb
|
91
104
|
- lib/vagrant-ovirt4/action/wait_till_up.rb
|
@@ -113,10 +126,6 @@ files:
|
|
113
126
|
- spec/vagrant-ovirt4/action/read_state_spec.rb
|
114
127
|
- spec/vagrant-ovirt4/config_spec.rb
|
115
128
|
- templates/Vagrantfile.erb
|
116
|
-
- test/integration/bios_serial/bios_serial_spec.rb
|
117
|
-
- test/integration/dynamic_network/network_spec.rb
|
118
|
-
- test/integration/optimized_for.sh
|
119
|
-
- test/integration/singleton-static_network/network_spec.rb
|
120
129
|
- tools/prepare_redhat_for_box.sh
|
121
130
|
- vagrant-ovirt4.gemspec
|
122
131
|
homepage: https://github.com/myoung34/vagrant-ovirt4
|
@@ -138,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
147
|
- !ruby/object:Gem::Version
|
139
148
|
version: '0'
|
140
149
|
requirements: []
|
141
|
-
rubygems_version: 3.0.
|
150
|
+
rubygems_version: 3.0.3
|
142
151
|
signing_key:
|
143
152
|
specification_version: 4
|
144
153
|
summary: This vagrant plugin provides the ability to create, control, and destroy
|
@@ -156,7 +165,3 @@ test_files:
|
|
156
165
|
- spec/vagrant-ovirt4/action/read_ssh_info_spec.rb
|
157
166
|
- spec/vagrant-ovirt4/action/read_state_spec.rb
|
158
167
|
- spec/vagrant-ovirt4/config_spec.rb
|
159
|
-
- test/integration/bios_serial/bios_serial_spec.rb
|
160
|
-
- test/integration/dynamic_network/network_spec.rb
|
161
|
-
- test/integration/optimized_for.sh
|
162
|
-
- test/integration/singleton-static_network/network_spec.rb
|
data/.kitchen.yml
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
driver:
|
2
|
-
name: vagrant
|
3
|
-
vagrantfile_erb: templates/Vagrantfile.erb
|
4
|
-
provider: ovirt4
|
5
|
-
|
6
|
-
verifier:
|
7
|
-
name: inspec
|
8
|
-
format: doc
|
9
|
-
|
10
|
-
platforms:
|
11
|
-
- name: centos7
|
12
|
-
driver_plugin: vagrant
|
13
|
-
driver_config:
|
14
|
-
customize:
|
15
|
-
memory_size: 1024 MB
|
16
|
-
url: <%= ENV['OVIRT_URL'] %>
|
17
|
-
insecure: true
|
18
|
-
username: <%= ENV['OVIRT_USERNAME'] %>
|
19
|
-
password: <%= ENV['OVIRT_PASSWORD'] %>
|
20
|
-
cluster: Default
|
21
|
-
debug: true
|
22
|
-
box: ovirt4
|
23
|
-
box_url: https://github.com/myoung34/vagrant-ovirt4/blob/master/example_box/dummy.box?raw=true
|
24
|
-
|
25
|
-
suites:
|
26
|
-
- name: singleton-static_network
|
27
|
-
driver_config:
|
28
|
-
vm_hostname: static
|
29
|
-
customize:
|
30
|
-
template: vagrant-centos7
|
31
|
-
network:
|
32
|
-
- ["private_network", {ovirt__ip: <%= "192.168.2.254" %>, ovirt__network_name: 'ovirtmgmt', ovirt__gateway: 192.168.2.1, ovirt__netmask: 255.255.255.0, ovirt__dns_servers: 192.168.2.1}]
|
33
|
-
- name: dynamic_network
|
34
|
-
driver_config:
|
35
|
-
vm_hostname: dynamic
|
36
|
-
network:
|
37
|
-
- ["private_network", {ovirt__network_name: 'ovirtmgmt'}]
|
38
|
-
customize:
|
39
|
-
template: vagrant-centos7
|
40
|
-
cloud_init: |
|
41
|
-
runcmd:
|
42
|
-
- ifdown eth0
|
43
|
-
- service network restart
|
44
|
-
- name: bios_serial
|
45
|
-
driver_config:
|
46
|
-
vm_hostname: bios-serial
|
47
|
-
network:
|
48
|
-
- ["private_network", {ovirt__network_name: 'ovirtmgmt'}]
|
49
|
-
customize:
|
50
|
-
template: vagrant-centos7
|
51
|
-
bios_serial: 'banana-hammock'
|
52
|
-
cloud_init: |
|
53
|
-
runcmd:
|
54
|
-
- ifdown eth0
|
55
|
-
- service network restart
|
56
|
-
- name: optimized_for_default
|
57
|
-
verifier:
|
58
|
-
name: shell
|
59
|
-
command: curl --silent -k -L --user "${OVIRT_USERNAME}:${OVIRT_PASSWORD}" --header 'Content-Type: application/xml' --header 'Accept: application/xml' ${OVIRT_URL}/vms/d3f659e1-21ff-42a0-b5fa-7c2f74a36c2b | xmllint --xpath '/vm/type/text()' - | grep desktop
|
60
|
-
driver_config:
|
61
|
-
vm_hostname: optimized-for
|
62
|
-
network:
|
63
|
-
- ["private_network", {ovirt__network_name: 'ovirtmgmt'}]
|
64
|
-
customize:
|
65
|
-
template: vagrant-centos7
|
66
|
-
cloud_init: |
|
67
|
-
runcmd:
|
68
|
-
- ifdown eth0
|
69
|
-
- service network restart
|
70
|
-
- name: optimized_for_set
|
71
|
-
verifier:
|
72
|
-
name: shell
|
73
|
-
command: test/integration/optimized_for.sh
|
74
|
-
driver_config:
|
75
|
-
vm_hostname: optimized-for
|
76
|
-
network:
|
77
|
-
- ["private_network", {ovirt__network_name: 'ovirtmgmt'}]
|
78
|
-
customize:
|
79
|
-
template: vagrant-centos7
|
80
|
-
cloud_init: |
|
81
|
-
runcmd:
|
82
|
-
- ifdown eth0
|
83
|
-
- service network restart
|
data/Jenkinsfile
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#!/usr/bin/env groovy
|
2
|
-
node {
|
3
|
-
stage('Checkout') {
|
4
|
-
checkout scm
|
5
|
-
}
|
6
|
-
|
7
|
-
// Run as many tests as possible in parallel.
|
8
|
-
String[] vagrantVersions = ["1.9.1", "1.9.2"]
|
9
|
-
stage('Test') {
|
10
|
-
|
11
|
-
def buildJobs = [:]
|
12
|
-
|
13
|
-
buildJobs["rspec"] = {
|
14
|
-
docker.build("jenkins/ruby:2.2.6").inside('-v /opt/gemcache:/opt/gemcache') {
|
15
|
-
sh """#!/bin/bash -ex
|
16
|
-
bundle install --path /opt/gemcache
|
17
|
-
bundle exec rspec
|
18
|
-
"""
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
for (int i = 0; i < vagrantVersions.length; i++) {
|
23
|
-
def index = i //if we tried to use i below, it would equal 4 in each job execution.
|
24
|
-
def vagrantVersion = vagrantVersions[index]
|
25
|
-
|
26
|
-
buildJobs["vagrant-${vagrantVersion}"] = {
|
27
|
-
|
28
|
-
docker.image("myoung34/vagrant:${vagrantVersion}").inside('-v /opt/gemcache:/opt/gemcache') {
|
29
|
-
sh """#!/bin/bash -ex
|
30
|
-
temp_dir="/tmp/\$(cat /proc/sys/kernel/random/uuid)"
|
31
|
-
cp -r \$(pwd) \$temp_dir
|
32
|
-
cd \$temp_dir
|
33
|
-
gem build *.gemspec
|
34
|
-
/usr/bin/vagrant plugin install *.gem
|
35
|
-
bundle install --path /opt/gemcache --without development plugins
|
36
|
-
export VAGRANT_VERSION=\$(echo ${vagrantVersion} | sed 's/\\.//g')
|
37
|
-
bundle exec kitchen test ^[^singleton-]
|
38
|
-
"""
|
39
|
-
}
|
40
|
-
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
parallel( buildJobs )
|
45
|
-
}
|
46
|
-
|
47
|
-
for (int i = 0; i < vagrantVersions.length; i++) {
|
48
|
-
def index = i //if we tried to use i below, it would equal 4 in each job execution.
|
49
|
-
def vagrantVersion = vagrantVersions[index]
|
50
|
-
|
51
|
-
|
52
|
-
stage("singleton vagrant-${vagrantVersion}") {
|
53
|
-
docker.image("myoung34/vagrant:${vagrantVersion}").inside('-v /opt/gemcache:/opt/gemcache') {
|
54
|
-
sh """#!/bin/bash -ex
|
55
|
-
gem build *.gemspec
|
56
|
-
/usr/bin/vagrant plugin install *.gem
|
57
|
-
bundle install --path /opt/gemcache --without development plugins
|
58
|
-
bundle exec kitchen destroy all
|
59
|
-
rm -rf .kitchen
|
60
|
-
export VAGRANT_VERSION=\$(echo ${vagrantVersion} | sed 's/\\.//g')
|
61
|
-
bundle exec kitchen test ^singleton-
|
62
|
-
"""
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
stage("Cleanup") {
|
68
|
-
deleteDir()
|
69
|
-
}
|
70
|
-
}
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require "log4r"
|
2
|
-
require "vagrant/util/subprocess"
|
3
|
-
|
4
|
-
module VagrantPlugins
|
5
|
-
module OVirtProvider
|
6
|
-
module Action
|
7
|
-
class SyncFolders
|
8
|
-
def initialize(app, env)
|
9
|
-
@app = app
|
10
|
-
@logger = Log4r::Logger.new("vagrant_ovirt::action::sync_folders")
|
11
|
-
end
|
12
|
-
|
13
|
-
def call(env)
|
14
|
-
@app.call(env)
|
15
|
-
|
16
|
-
ssh_info = env[:machine].ssh_info
|
17
|
-
|
18
|
-
env[:machine].config.vm.synced_folders.each do |id, data|
|
19
|
-
next if data[:disabled]
|
20
|
-
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
21
|
-
guestpath = data[:guestpath]
|
22
|
-
|
23
|
-
# Make sure there is a trailing slash on the host path to avoid creating an additional directory with rsync
|
24
|
-
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
25
|
-
|
26
|
-
# on windows rsync.exe requires cygdrive-style paths.
|
27
|
-
# assumes: /c/...
|
28
|
-
# Should be msysgit and cygwin compatible if /etc/fstab in cygwin contains:
|
29
|
-
# none / cygdrive binary,posix=0,user 0 0
|
30
|
-
if Vagrant::Util::Platform.windows?
|
31
|
-
hostpath = hostpath.gsub(/^(\w):/) { "/#{$1}" }
|
32
|
-
end
|
33
|
-
|
34
|
-
env[:ui].info(I18n.t("vagrant_ovirt4.rsync_folder", :hostpath => hostpath, :guestpath => guestpath))
|
35
|
-
|
36
|
-
# Create the guest path
|
37
|
-
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
38
|
-
env[:machine].communicate.sudo("chown #{ssh_info[:username]} '#{guestpath}'")
|
39
|
-
|
40
|
-
# Rsync over to the guest path using the SSH info
|
41
|
-
command = [
|
42
|
-
"rsync",
|
43
|
-
"--verbose",
|
44
|
-
"--archive",
|
45
|
-
"-z",
|
46
|
-
"--owner",
|
47
|
-
"--perms",
|
48
|
-
"--exclude",
|
49
|
-
".vagrant/",
|
50
|
-
"-e",
|
51
|
-
"ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path][0]}'",
|
52
|
-
hostpath,
|
53
|
-
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"
|
54
|
-
]
|
55
|
-
|
56
|
-
r = Vagrant::Util::Subprocess.execute(*command)
|
57
|
-
if r.exit_code != 0
|
58
|
-
raise Errors::RsyncError,
|
59
|
-
:guestpath => guestpath,
|
60
|
-
:hostpath => hostpath,
|
61
|
-
:stderr => r.stderr
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
@@ -1,4 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
bios_serial=$(vagrant ssh -c 'sudo dmidecode -s system-serial-number' 2>/dev/null | tail -n 1 | sed 's/[\r\n]//g')
|
3
|
-
vm_id=$(curl --silent -k -L --user "${OVIRT_USERNAME}:${OVIRT_PASSWORD}" --header 'Content-Type: application/xml' --header 'Accept: application/xml' ${OVIRT_URL}/vms | xmllint --xpath 'string(./vms/vm[./serial_number/value/text() = "'$bios_serial'"]/@id)' -)
|
4
|
-
curl --silent -k -L --user "${OVIRT_USERNAME}:${OVIRT_PASSWORD}" --header 'Content-Type: application/xml' --header 'Accept: application/xml' ${OVIRT_URL}/vms/${vm_id} | xmllint --xpath './vm/type/text()' - | grep server
|
@@ -1,11 +0,0 @@
|
|
1
|
-
describe command('uname -a') do
|
2
|
-
its(:exit_status) { should eq 0 }
|
3
|
-
its(:stderr) { should be_empty }
|
4
|
-
its(:stdout) { should match(/^Linux kitchen-static-[0-9]+-[a-f0-9\-]+/) }
|
5
|
-
end
|
6
|
-
|
7
|
-
describe command("ip route get 1 | awk '{print $NF;exit}'") do
|
8
|
-
its(:exit_status) { should eq 0 }
|
9
|
-
its(:stderr) { should be_empty }
|
10
|
-
its(:stdout) { should match(/^192.168.2.254$/) }
|
11
|
-
end
|