vagrant-skytap 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.byebug_history +218 -0
- data/CHANGELOG.md +14 -0
- data/README.md +35 -45
- data/bar +6 -0
- data/eng-10269-cleanup.diff +247 -0
- data/eng-10269-tmp.diff +361 -0
- data/eng-10269.diff +577 -0
- data/eng-10269.diff.1 +455 -0
- data/lib/vagrant-skytap/action/initial_state.rb +20 -0
- data/lib/vagrant-skytap/action/is_parallelized.rb +21 -0
- data/lib/vagrant-skytap/action/message_resuming.rb +16 -0
- data/lib/vagrant-skytap/action/run_environment.rb +9 -3
- data/lib/vagrant-skytap/action/wait_for_communicator.rb +1 -1
- data/lib/vagrant-skytap/action.rb +74 -16
- data/lib/vagrant-skytap/api/environment.rb +4 -0
- data/lib/vagrant-skytap/api/runstate_operations.rb +9 -4
- data/lib/vagrant-skytap/command/start_mixins.rb +47 -0
- data/lib/vagrant-skytap/command/up.rb +126 -0
- data/lib/vagrant-skytap/plugin.rb +6 -1
- data/lib/vagrant-skytap/version.rb +1 -1
- data/locales/en.yml +4 -2
- data/spec/acceptance/provider/up_spec.rb +40 -0
- metadata +43 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47c85dd2458a8d1d42b2286b41114b294508ec3e
|
4
|
+
data.tar.gz: 1303ac73f297dfe5806c6e334f4d77b09e3129f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8204bab0a119675849462559d68652343ec493fa65122d3e71000a48c8be119990add1f6944ffb23ca5bdf23e6234eceb328372d8f154216845cb60e96f5282
|
7
|
+
data.tar.gz: cbb06929b9b391836d74038d74356be45b0dad9ae0ebc10ad8690be532aa05ea8dab268b21bebca1376d76f45b27c5fe1d58ab75a73d7d2724daddd5c60e2282
|
data/.byebug_history
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
exit
|
2
|
+
Vagrant::source_rootc
|
3
|
+
Vagrant::source_root
|
4
|
+
q
|
5
|
+
c
|
6
|
+
up
|
7
|
+
config.env
|
8
|
+
up
|
9
|
+
env
|
10
|
+
c
|
11
|
+
@env
|
12
|
+
up
|
13
|
+
down
|
14
|
+
args
|
15
|
+
up
|
16
|
+
options
|
17
|
+
up
|
18
|
+
args
|
19
|
+
down
|
20
|
+
up
|
21
|
+
args.count
|
22
|
+
args
|
23
|
+
up
|
24
|
+
options
|
25
|
+
c
|
26
|
+
fff5~5~5~5~
|
27
|
+
$1
|
28
|
+
up_result.stderr =~ /multiselect.*\[(.*)\]/
|
29
|
+
$1
|
30
|
+
$0
|
31
|
+
up_result.stderr =~ /multiselect(.*)\}/
|
32
|
+
up_result.stderr =~ /multiselect(.*\)}/
|
33
|
+
up_result.stderr
|
34
|
+
up_result.stderr =~ /multiselect/
|
35
|
+
up_result.stderr =~ "multiselect"
|
36
|
+
puts up_result.stdout
|
37
|
+
up_result.stdout
|
38
|
+
c
|
39
|
+
up
|
40
|
+
options
|
41
|
+
args
|
42
|
+
finish
|
43
|
+
s
|
44
|
+
n
|
45
|
+
args
|
46
|
+
s
|
47
|
+
n
|
48
|
+
c
|
49
|
+
up
|
50
|
+
down
|
51
|
+
up
|
52
|
+
@options[:env]
|
53
|
+
@options[:env]["VAGRANT_LOG"] = "info"
|
54
|
+
@options[:env]
|
55
|
+
@options
|
56
|
+
process.environment
|
57
|
+
n
|
58
|
+
notify
|
59
|
+
n
|
60
|
+
finish
|
61
|
+
down
|
62
|
+
up
|
63
|
+
@command << "VAGRANT_LOG=info"
|
64
|
+
@command
|
65
|
+
n
|
66
|
+
args
|
67
|
+
s
|
68
|
+
n
|
69
|
+
Which
|
70
|
+
options
|
71
|
+
args
|
72
|
+
command
|
73
|
+
finish
|
74
|
+
s
|
75
|
+
name
|
76
|
+
s
|
77
|
+
n
|
78
|
+
log
|
79
|
+
s
|
80
|
+
n
|
81
|
+
s
|
82
|
+
puts execute("vagrant", "help", "VAGRANT_LOG=info").stdout
|
83
|
+
puts _
|
84
|
+
execute("vagrant", "help", "VAGRANT_LOG=info")
|
85
|
+
c
|
86
|
+
puts up_result.stdout
|
87
|
+
up_result.stdout
|
88
|
+
c
|
89
|
+
b 24
|
90
|
+
up
|
91
|
+
finish
|
92
|
+
n
|
93
|
+
q
|
94
|
+
[1,2,3,4].partition{|n| n < 3}
|
95
|
+
machines.reject{|m| m.state.id == :running}
|
96
|
+
machines.first.state.id
|
97
|
+
machines.first.state
|
98
|
+
machines.first.status
|
99
|
+
machines.first
|
100
|
+
c
|
101
|
+
@env.environment
|
102
|
+
@env.env
|
103
|
+
@env[:foo]
|
104
|
+
@env
|
105
|
+
env
|
106
|
+
q
|
107
|
+
@env.config
|
108
|
+
@env.vagrantfile.config
|
109
|
+
@env.vagrantfile.machine_config(:vm1, :skytap, [])
|
110
|
+
@env.vagrantfile.machine_config(:vm1)
|
111
|
+
@env.vagrantfile.machine_config(:vm1, :skytap, [])
|
112
|
+
@env.vagrantfile.machine_config(:vm1, :skytap, 'skytap/empty')
|
113
|
+
@env.vagrantfile.machine_config(:vm1, 'skytap', 'skytap/empty')
|
114
|
+
@env.vagrantfile.machine_config('vm1', 'skytap', 'skytap/empty')
|
115
|
+
@env.vagrantfile.machine_config('vm1')
|
116
|
+
@env.vagrantfile
|
117
|
+
c
|
118
|
+
machines.count
|
119
|
+
c
|
120
|
+
env[:machine].provider_config
|
121
|
+
env[:machine].env.vagrantfile.config[:vpn_url]
|
122
|
+
env[:machine].env.vagrantfile.config.vpn_url.value
|
123
|
+
env[:machine].env.vagrantfile.config.vpn_url.to_s
|
124
|
+
env[:machine].env.vagrantfile.config.vpn_url
|
125
|
+
env[:machine].env.vagrantfile.config
|
126
|
+
env[:machine].env.vagrantfile.config.usernamf
|
127
|
+
env[:machine].env.vagrantfile.config.username.to_s
|
128
|
+
env[:machine].env.vagrantfile.config.username
|
129
|
+
env[:machine].env.vagrantfile.config.api_token
|
130
|
+
env[:machine].env.vagrantfile.config
|
131
|
+
env[:machine].env.vagrantfile
|
132
|
+
c
|
133
|
+
env[:machine]
|
134
|
+
c
|
135
|
+
l
|
136
|
+
p env
|
137
|
+
pp env
|
138
|
+
ap env
|
139
|
+
env[:host]
|
140
|
+
env[:local_data_path]
|
141
|
+
env.local_data_path
|
142
|
+
env[:root_path]
|
143
|
+
env[:home_path]
|
144
|
+
env.keys
|
145
|
+
env.class
|
146
|
+
env
|
147
|
+
c
|
148
|
+
path
|
149
|
+
n
|
150
|
+
s
|
151
|
+
c
|
152
|
+
@env.local_data_path
|
153
|
+
c
|
154
|
+
@env.local_data_path
|
155
|
+
c
|
156
|
+
up
|
157
|
+
@env
|
158
|
+
env.local_data_path
|
159
|
+
env
|
160
|
+
env[:machines].first
|
161
|
+
s
|
162
|
+
c
|
163
|
+
env
|
164
|
+
c
|
165
|
+
display env
|
166
|
+
c
|
167
|
+
env[:machines]
|
168
|
+
c
|
169
|
+
@env
|
170
|
+
@env.environment
|
171
|
+
c
|
172
|
+
env[:machines]
|
173
|
+
c
|
174
|
+
env[:machines]
|
175
|
+
c
|
176
|
+
machines.first.provider_config
|
177
|
+
machines.first.env.provider_config
|
178
|
+
machines.first.env
|
179
|
+
machines.first
|
180
|
+
@env.environment
|
181
|
+
c
|
182
|
+
env[:machine]
|
183
|
+
env[:machines]
|
184
|
+
env[:environment]
|
185
|
+
environment
|
186
|
+
q
|
187
|
+
env[:machines].collect(&:id)
|
188
|
+
env[:machines]
|
189
|
+
n
|
190
|
+
c
|
191
|
+
n
|
192
|
+
options
|
193
|
+
n
|
194
|
+
b
|
195
|
+
c 83
|
196
|
+
c
|
197
|
+
n
|
198
|
+
finish
|
199
|
+
n
|
200
|
+
machines
|
201
|
+
$!
|
202
|
+
finish
|
203
|
+
$!
|
204
|
+
n
|
205
|
+
options
|
206
|
+
n
|
207
|
+
c
|
208
|
+
finish
|
209
|
+
n
|
210
|
+
s
|
211
|
+
c
|
212
|
+
Vagrant::Errors::VMBootTimeout
|
213
|
+
Vagrant::Errors::VagrantError::VMBootTimeout
|
214
|
+
VagrantError::VMBootTimeout
|
215
|
+
Errors::VMBootTimeout
|
216
|
+
c
|
217
|
+
options
|
218
|
+
c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
|
2
|
+
# 0.1.7 (November 30, 2015)
|
3
|
+
|
4
|
+
* Added parallelization support with a custom "up" command. VMs are
|
5
|
+
created and customized separately, and then all are run with a single
|
6
|
+
REST call.
|
7
|
+
|
8
|
+
# 0.1.6 (November 13, 2015)
|
9
|
+
|
10
|
+
* Add `vpn_url` setting to specify the method for connecting to the
|
11
|
+
Skytap VM. If not present, the user will select the VPN interactively.
|
12
|
+
* Handle "network unreachable" errors while waiting for machines to boot.
|
13
|
+
* Add more validation logic prior to creating VMs.
|
14
|
+
|
1
15
|
# 0.1.5 (November 6, 2015)
|
2
16
|
|
3
17
|
* Initial beta release.
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Before you begin, make sure you have:
|
|
24
24
|
* A Skytap username and API token from the "My Account" page
|
25
25
|
* A Skytap VPN in the region where you'll be creating environments; a NAT-enabled VPN is recommended.
|
26
26
|
|
27
|
-
To check if a VPN is available, navigate to a Skytap environment in the region and open the network settings. If the **VPN** section is visible in the network settings, a VPN is available. If you do not have a Skytap VPN, work with your Skytap administrator to create one. For instructions, see [Creating a VPN Connection to an External Network](Vpns.html).
|
27
|
+
To check if a VPN is available, navigate to a Skytap environment in the region and open the network settings. If the **VPN** section is visible in the network settings, a VPN is available. If you do not have a Skytap VPN, work with your Skytap administrator to create one. For instructions, see [Creating a VPN Connection to an External Network](http://help.skytap.com/#Vpns.html).
|
28
28
|
|
29
29
|
## Installing the Skytap Provider and Starting Your First Environment
|
30
30
|
|
@@ -61,7 +61,30 @@ Before you begin, make sure you have:
|
|
61
61
|
1. Choose "skytap" as the user login for the VM.
|
62
62
|
1. Wait for `vagrant up` to complete, then do `vagrant ssh` to verify that you can access the new VM.
|
63
63
|
|
64
|
+
## Multi-machine Example
|
65
|
+
The following defines two VMs in a single environment. Both are based on the same Ubuntu template as above, but have different hardware settings. Since the source VM in the public library template is connected to a network, both of the VMs in the new environment will be connected to a single network.
|
64
66
|
|
67
|
+
```ruby
|
68
|
+
config.vm.define "web" do |server|
|
69
|
+
server.vm.provider :skytap do |box|
|
70
|
+
box.vm_url = "https://cloud.skytap.com/vms/3157858"
|
71
|
+
box.cpus = 2
|
72
|
+
box.cpuspersocket = 1
|
73
|
+
box.ram = 1024
|
74
|
+
end
|
75
|
+
server.vm.synced_folder "~/web_files", "/synced", type: :nfs
|
76
|
+
end
|
77
|
+
|
78
|
+
config.vm.define "db" do |server|
|
79
|
+
server.vm.provider :skytap do |box|
|
80
|
+
box.vm_url = "https://cloud.skytap.com/vms/3157858"
|
81
|
+
box.cpus = 8
|
82
|
+
box.cpuspersocket = 4
|
83
|
+
box.ram = 8192
|
84
|
+
end
|
85
|
+
server.vm.synced_folder "~/db_files", "/synced", type: :nfs
|
86
|
+
end
|
87
|
+
```
|
65
88
|
|
66
89
|
## Supported Commands
|
67
90
|
|
@@ -83,6 +106,7 @@ For the most part these behave identically to the builtin Vagrant commands.
|
|
83
106
|
| `vagrant up [<vm_name>, <vm_name>]` | Run an environment or VM(s), creating them from settings in the Vagrantfile if they do not already exist.|
|
84
107
|
|
85
108
|
Notes:
|
109
|
+
|
86
110
|
* When the first VM is created, a Skytap environment will be created; when all VMs are deleted, the containing environment will also be deleted.
|
87
111
|
* The timeout for graceful shutdown is currently set to 5 minutes.
|
88
112
|
* Changes to hardware settings of an existing VM will take effect when the VM is being powered on; that is, when doing `vagrant reload`, or `vagrant up` when the machine is halted.
|
@@ -90,21 +114,6 @@ Notes:
|
|
90
114
|
|
91
115
|
## Additional Supported Actions
|
92
116
|
|
93
|
-
### Edit the VM Settings
|
94
|
-
|
95
|
-
1. Edit the VM definitions in the Vagrantfile.
|
96
|
-
2. Use `vagrant up` (if the VMs are halted) or `vagrant reload` to apply updates.
|
97
|
-
|
98
|
-
### Add VM(s) to an Environment
|
99
|
-
|
100
|
-
1. Add new definitions for the VMs to the Vagrantfile.
|
101
|
-
2. Use `vagrant up` to create the new VMs
|
102
|
-
|
103
|
-
### Remove VM(s) from an Environment
|
104
|
-
|
105
|
-
1. Use `vagrant destroy` to delete the Skytap VM.
|
106
|
-
2. Remove the VM definition from the Vagrantfile. See [Creating a Vagrantfile](Vagrantfile.html).
|
107
|
-
|
108
117
|
### Sync Local Folders with the VM's Folders using NFS
|
109
118
|
|
110
119
|
The Skytap Vagrant provider supports Vagrant's built-in NFS sharing facility. In the following example, a local directory `~/web_files` will be visible on the VM at the path `/synced`.
|
@@ -119,32 +128,7 @@ config.vm.define "web" do |server|
|
|
119
128
|
end
|
120
129
|
```
|
121
130
|
|
122
|
-
For more information, see
|
123
|
-
|
124
|
-
## Multi-machine Example
|
125
|
-
The following defines two VMs in a single environment. Both are based on the same Ubuntu template as above, but have different hardware settings. Since the source VM in the public library template is connected to a network, both of the VMs in the new environment will be connected to a single network.
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
config.vm.define "web" do |server|
|
129
|
-
server.vm.provider :skytap do |box|
|
130
|
-
box.vm_url = "https://cloud.skytap.com/vms/3157858"
|
131
|
-
box.cpus = 2
|
132
|
-
box.cpuspersocket = 1
|
133
|
-
box.ram = 1024
|
134
|
-
end
|
135
|
-
server.vm.synced_folder "~/web_files", "/synced", type: :nfs
|
136
|
-
end
|
137
|
-
|
138
|
-
config.vm.define "db" do |server|
|
139
|
-
server.vm.provider :skytap do |box|
|
140
|
-
box.vm_url = "https://cloud.skytap.com/vms/3157858"
|
141
|
-
box.cpus = 8
|
142
|
-
box.cpuspersocket = 4
|
143
|
-
box.ram = 8192
|
144
|
-
end
|
145
|
-
server.vm.synced_folder "~/db_files", "/synced", type: :nfs
|
146
|
-
end
|
147
|
-
```
|
131
|
+
For more information, see [https://docs.vagrantup.com/v2/synced-folders](https://docs.vagrantup.com/v2/synced-folders).
|
148
132
|
|
149
133
|
## Skytap-specific Vagrantfile Settings
|
150
134
|
|
@@ -155,12 +139,16 @@ end
|
|
155
139
|
|cpuspersocket | no | Number of virtual cores per processor.|
|
156
140
|
|ram | no | RAM (megabytes).|
|
157
141
|
|guestos | no | The VMware guest OS for the virtual machine.|
|
142
|
+
|vpn_url | no | The URL of the Skytap VPN to use when connecting to the VM.|
|
158
143
|
|
159
144
|
Notes:
|
145
|
+
|
160
146
|
* Source VMs must come from a template, not an environment, and they must be saved in the powered off state.
|
161
147
|
* Multi-machine environments may use source VMs from multiple templates, from your customer account and/or the public template library, as long as all are in the same region. Your user account must have permissions to see the templates containing the source VMs.
|
162
|
-
|
163
|
-
|
148
|
+
* `cpus` must be evenly divisible by `cpuspersocket`. E.g., two quad-core processors have a total of 8 virtual cores, so the `cpus` value would be 8. (Most VMs in the public template library are single-core.)
|
149
|
+
* The `guestos` setting is distinct from from Vagrant's `config.vm.guest` setting.
|
150
|
+
* If you do not know the URL for the VPN you wish to use, contact your Skytap administrator.
|
151
|
+
|
164
152
|
|
165
153
|
## Login Credentials
|
166
154
|
In addition to setting username and password in the Vagrantfile with `config.ssh.username` and `config.ssh.password`, the Skytap Vagrant provider also supports [VM Credentials](http://help.skytap.com/#VM_Settings_Credentials.html) stored with the Skytap VM. Credentials are a free-form field; if formatted as "username / password", the Skytap provider will parse the credentials and present them to the user when the VM is first created.
|
@@ -178,5 +166,7 @@ To enable logging while troubleshooting, see [https://docs.vagrantup.com/v2/othe
|
|
178
166
|
* At this time, WinRM credentials stored in Skytap VMs will be ignored. The username and password for WinRM connections must be stored in the Vagrantfile (`config.winrm.username` and `config.winrm.password`).
|
179
167
|
* Running, reloading, or destroying a Skytap VM can result in "stale NFS file handle" errors on other providers' VMs. This is a known issue when using multiple providers on the same host machine. The workaround is to use `vagrant reload` on the affected VM to refresh that VM's NFS mount(s).
|
180
168
|
* At this time, `vagrant share` is not supported.
|
181
|
-
*
|
169
|
+
* High-level networking features (including port forwarding and private networks) are currently unsupported.
|
182
170
|
* Although several Skytap public library VMs include credentials for the `root` login, its use is not recommended.
|
171
|
+
* Once a VM has been created, it is not possible to change its connection method (i.e., connect using a different VPN). This is the
|
172
|
+
case whether the VPN is specified in the Vagrantfile with the `vpn_url` setting, or selected interactively.
|
data/bar
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
2015-11-09T18:14:57.1402+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] perf_stat_counters.rb:109 Perf: 118||DB: 0.0ms|V: 0.0ms|GET /ibm_marketplace/subscribe html||Chrome 46.0.2490.80|406
|
2
|
+
2015-11-09T18:14:57.1391+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Completed 406 Not Acceptable in 16.5ms (ActiveRecord: 0.0ms)
|
3
|
+
2015-11-09T18:14:57.1385+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Filter chain halted as :verify_oauth_signature rendered or redirected
|
4
|
+
2015-11-09T18:14:57.1375+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] ibm_marketplace_controller.rb:636 Request did not include an OAuth consumer key.
|
5
|
+
2015-11-09T18:14:57.1220+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] log_subscriber.rb:105 Processing by IbmMarketplaceController#subscribe as HTML
|
6
|
+
2015-11-09T18:14:57.0192+00:00 tuk1m1wfe20 wfe 5546 - - [wfe.4119d810693b013377e6005056ae425d.5546.143] logger.rb:31 Started GET "/ibm_marketplace/subscribe" for 66.193.98.66 at 2015-11-09 18:14:57 +0000
|
@@ -0,0 +1,247 @@
|
|
1
|
+
# HG changeset patch
|
2
|
+
# Parent 315fe5d07c6435fdb931fb73df1aef34a8205916
|
3
|
+
ENG-10269 the last mandatory bit of cleanup: how we capture provide vm state
|
4
|
+
|
5
|
+
diff -r 315fe5d07c64 lib/vagrant-skytap/action.rb
|
6
|
+
--- a/lib/vagrant-skytap/action.rb Fri Nov 20 12:31:47 2015 -0800
|
7
|
+
+++ b/lib/vagrant-skytap/action.rb Fri Nov 20 19:19:54 2015 -0800
|
8
|
+
@@ -168,11 +168,11 @@
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
- # Some middlewares perform further actions after the succeeding
|
13
|
+
- # middleware returns. Provision and SyncedFolders, specifically,
|
14
|
+
- # both require the machine to be booted on the way back. This
|
15
|
+
- # requirement can be satisfied by putting the WaitForCommunicator
|
16
|
+
- # middleware later in the sequence.
|
17
|
+
+ # Note: Provision and SyncedFolders perform actions before and after
|
18
|
+
+ # calling the next middleware in the sequence. Both require that
|
19
|
+
+ # the machine be booted before those calls return. This requirement
|
20
|
+
+ # can be satisfied by putting the WaitForCommunicator middleware
|
21
|
+
+ # later in the sequence.
|
22
|
+
def self.action_prepare_boot
|
23
|
+
Vagrant::Action::Builder.new.tap do |b|
|
24
|
+
b.use PrepareNFSSettings
|
25
|
+
@@ -185,19 +185,27 @@
|
26
|
+
|
27
|
+
def self.action_resume
|
28
|
+
Vagrant::Action::Builder.new.tap do |b|
|
29
|
+
- b.use action_up
|
30
|
+
+ Vagrant::Action::Builder.new.tap do |b|
|
31
|
+
+ b.use InitializeAPIClient
|
32
|
+
+ b.use FetchEnvironment
|
33
|
+
+ b.use Call, IsSuspended do |env, b1|
|
34
|
+
+ if env[:result]
|
35
|
+
+ b1.use MessageResuming
|
36
|
+
+ b1.use RunVm
|
37
|
+
+ b1.use WaitForCommunicator
|
38
|
+
+ end
|
39
|
+
+ end
|
40
|
+
+ end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
- # This action is called to bring the box up from nothing.
|
45
|
+
- def self.action_up
|
46
|
+
- Vagrant::Action::Builder.new.tap do |b|
|
47
|
+
- b.use action_create
|
48
|
+
- b.use action_run_vm
|
49
|
+
- end
|
50
|
+
- end
|
51
|
+
+ # The Skytap provider has a modified "vagrant up" command which
|
52
|
+
+ # takes advantage of parallel runstate operations on Skytap
|
53
|
+
+ # environments. The create and update_hardware actions are
|
54
|
+
+ # separated from the run_vm action, so we can pass in the ids
|
55
|
+
+ # and initial states for all machines to be run, potentially
|
56
|
+
+ # with a single REST call.
|
57
|
+
|
58
|
+
- # This action is called by our modified "up" command.
|
59
|
+
def self.action_create
|
60
|
+
Vagrant::Action::Builder.new.tap do |b|
|
61
|
+
b.use HandleBox
|
62
|
+
@@ -217,6 +225,13 @@
|
63
|
+
b1.use StoreExtraData
|
64
|
+
b1.use SetUpVm
|
65
|
+
end
|
66
|
+
+ end
|
67
|
+
+ end
|
68
|
+
+
|
69
|
+
+ def self.action_update_hardware
|
70
|
+
+ Vagrant::Action::Builder.new.tap do |b|
|
71
|
+
+ b.use InitializeAPIClient
|
72
|
+
+ b.use FetchEnvironment
|
73
|
+
b.use Call, IsStopped do |env, b1|
|
74
|
+
if env[:result]
|
75
|
+
b1.use UpdateHardware
|
76
|
+
@@ -226,28 +241,25 @@
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
- # This action is called by our modified "up" command after
|
81
|
+
- # all the VMs have been created. The action is called once
|
82
|
+
- # for each machine, but by default, the RunEnvironment
|
83
|
+
- # middleware will run all the machines in parallel; after
|
84
|
+
- # the first invocation, RunEnvironment is a no-op.
|
85
|
+
def self.action_run_vm
|
86
|
+
Vagrant::Action::Builder.new.tap do |b|
|
87
|
+
b.use InitializeAPIClient
|
88
|
+
b.use FetchEnvironment
|
89
|
+
+
|
90
|
+
b.use Call, InitialState do |env, b1|
|
91
|
+
case env[:result]
|
92
|
+
when :running
|
93
|
+
b1.use MessageAlreadyRunning
|
94
|
+
next
|
95
|
+
when :suspended
|
96
|
+
- b1.use Message, "The machine will be resumed"
|
97
|
+
- when :stopped
|
98
|
+
+ b1.use MessageResuming
|
99
|
+
+ else
|
100
|
+
b1.use action_prepare_boot
|
101
|
+
end
|
102
|
+
-
|
103
|
+
b1.use Call, IsParallelized do |env2, b2|
|
104
|
+
if env2[:result]
|
105
|
+
+ # Note: RunEnvironment is a no-op after
|
106
|
+
+ # the first invocation.
|
107
|
+
b2.use RunEnvironment
|
108
|
+
else
|
109
|
+
b2.use RunVm
|
110
|
+
@@ -263,13 +275,17 @@
|
111
|
+
b.use ConfigValidate
|
112
|
+
b.use InitializeAPIClient
|
113
|
+
b.use FetchEnvironment
|
114
|
+
- b.use Call, ExistenceCheck do |env, b2|
|
115
|
+
+ b.use Call, ExistenceCheck do |env, b1|
|
116
|
+
case env[:result]
|
117
|
+
when :missing_environment, :missing_vm, :no_vms
|
118
|
+
- b2.use MessageNotCreated
|
119
|
+
+ b1.use MessageNotCreated
|
120
|
+
else
|
121
|
+
- b2.use action_halt
|
122
|
+
- b2.use action_up
|
123
|
+
+ b1.use action_halt
|
124
|
+
+ b1.use action_update_hardware
|
125
|
+
+ # We don't need to store the initial states
|
126
|
+
+ # before calling run_vm, because the default
|
127
|
+
+ # behavior is to treat the VMs as powered off.
|
128
|
+
+ b1.use action_run_vm
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
@@ -294,6 +310,7 @@
|
133
|
+
autoload :MessageAlreadyRunning, action_root.join("message_already_running")
|
134
|
+
autoload :MessageNotCreated, action_root.join("message_not_created")
|
135
|
+
autoload :MessageEnvironmentUrl, action_root.join("message_environment_url")
|
136
|
+
+ autoload :MessageResuming, action_root.join("message_resuming")
|
137
|
+
autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
|
138
|
+
autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
|
139
|
+
autoload :PrepareNFSValidIds, action_root.join("prepare_nfs_valid_ids")
|
140
|
+
diff -r 315fe5d07c64 lib/vagrant-skytap/action/initial_state.rb
|
141
|
+
--- a/lib/vagrant-skytap/action/initial_state.rb Fri Nov 20 12:31:47 2015 -0800
|
142
|
+
+++ b/lib/vagrant-skytap/action/initial_state.rb Fri Nov 20 19:19:54 2015 -0800
|
143
|
+
@@ -1,9 +1,8 @@
|
144
|
+
module VagrantPlugins
|
145
|
+
module Skytap
|
146
|
+
module Action
|
147
|
+
- # This is specifically for the "up" action. When we run in parallel, we have
|
148
|
+
- # to know which machines were initially powered off so we can set up operations
|
149
|
+
- # which will happen after the machine is ready
|
150
|
+
+ # Our modified "up" command captures the VM states in the initial_states hash
|
151
|
+
+ # before running them, potentially in parallel.
|
152
|
+
class InitialState
|
153
|
+
def initialize(app, env)
|
154
|
+
@app = app
|
155
|
+
@@ -11,7 +10,8 @@
|
156
|
+
end
|
157
|
+
|
158
|
+
def call(env)
|
159
|
+
- env[:result] = env[:initial_states][env[:machine].id]
|
160
|
+
+ # if initial_states is absent, result is nil
|
161
|
+
+ env[:result] = env[:initial_states].try(:[], env[:machine].id)
|
162
|
+
@app.call(env)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
diff -r 315fe5d07c64 lib/vagrant-skytap/action/message_resuming.rb
|
166
|
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
167
|
+
+++ b/lib/vagrant-skytap/action/message_resuming.rb Fri Nov 20 19:19:54 2015 -0800
|
168
|
+
@@ -0,0 +1,16 @@
|
169
|
+
+module VagrantPlugins
|
170
|
+
+ module Skytap
|
171
|
+
+ module Action
|
172
|
+
+ class MessageResuming
|
173
|
+
+ def initialize(app, env)
|
174
|
+
+ @app = app
|
175
|
+
+ end
|
176
|
+
+
|
177
|
+
+ def call(env)
|
178
|
+
+ env[:ui].info(I18n.t("vagrant_skytap.resuming"))
|
179
|
+
+ @app.call(env)
|
180
|
+
+ end
|
181
|
+
+ end
|
182
|
+
+ end
|
183
|
+
+ end
|
184
|
+
+end
|
185
|
+
diff -r 315fe5d07c64 lib/vagrant-skytap/action/run_environment.rb
|
186
|
+
--- a/lib/vagrant-skytap/action/run_environment.rb Fri Nov 20 12:31:47 2015 -0800
|
187
|
+
+++ b/lib/vagrant-skytap/action/run_environment.rb Fri Nov 20 19:19:54 2015 -0800
|
188
|
+
@@ -3,8 +3,9 @@
|
189
|
+
module VagrantPlugins
|
190
|
+
module Skytap
|
191
|
+
module Action
|
192
|
+
- # Runs multiple VMs in parallel. The :first_machine flag is used to prevent
|
193
|
+
- # redundant REST calls on subsequent invocations.
|
194
|
+
+ # Runs multiple VMs in parallel. This middleware will be invoked for
|
195
|
+
+ # each machine, so we set the :first_machine flag to prevent redundant
|
196
|
+
+ # REST calls.
|
197
|
+
class RunEnvironment
|
198
|
+
include Vagrant::Util::Retryable
|
199
|
+
|
200
|
+
diff -r 315fe5d07c64 lib/vagrant-skytap/command/up.rb
|
201
|
+
--- a/lib/vagrant-skytap/command/up.rb Fri Nov 20 12:31:47 2015 -0800
|
202
|
+
+++ b/lib/vagrant-skytap/command/up.rb Fri Nov 20 19:19:54 2015 -0800
|
203
|
+
@@ -60,7 +60,6 @@
|
204
|
+
# Go over each VM and bring it up
|
205
|
+
@logger.debug("'Up' each target VM...")
|
206
|
+
|
207
|
+
- # Create the VMs, then pass all the machines to the run action
|
208
|
+
machines = []
|
209
|
+
names = argv
|
210
|
+
if names.empty?
|
211
|
+
@@ -85,15 +84,9 @@
|
212
|
+
|
213
|
+
machines << machine
|
214
|
+
machine.action(:create, options)
|
215
|
+
+ machine.action(:update_hardware, options)
|
216
|
+
end
|
217
|
+
|
218
|
+
- # Capture states before the parallel runstate operation.
|
219
|
+
- # Checking state is relatively expensive. we should be smarter
|
220
|
+
- # about what information to capture. For example, we can
|
221
|
+
- # determine which machines were newly created, and put them in
|
222
|
+
- # the :stopped collection. Or call them :created? No, that
|
223
|
+
- # would likely be confusing
|
224
|
+
- #require_boot = machines.select{|m| m.state.id == :stopped}
|
225
|
+
initial_states = machines.inject({}) do |acc, m|
|
226
|
+
acc[m.id] = m.state.id
|
227
|
+
acc
|
228
|
+
@@ -103,7 +96,6 @@
|
229
|
+
machine.action(:run_vm, options.merge(
|
230
|
+
first_machine: i == 0,
|
231
|
+
machines: machines,
|
232
|
+
- #require_boot: require_boot,
|
233
|
+
initial_states: initial_states
|
234
|
+
))
|
235
|
+
end
|
236
|
+
diff -r 315fe5d07c64 locales/en.yml
|
237
|
+
--- a/locales/en.yml Fri Nov 20 12:31:47 2015 -0800
|
238
|
+
+++ b/locales/en.yml Fri Nov 20 19:19:54 2015 -0800
|
239
|
+
@@ -22,6 +22,8 @@
|
240
|
+
Stopping the instance...
|
241
|
+
terminating: |-
|
242
|
+
Terminating the instance...
|
243
|
+
+ resuming: |-
|
244
|
+
+ Resuming the suspended instance ...
|
245
|
+
waiting_for_ready: |-
|
246
|
+
Waiting for instance to become "ready"...
|
247
|
+
waiting_for_ssh: |-
|