vagrant-mos 0.9.22 → 0.9.23

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: 59e8c991547bfb7555e28e96c2e52528498c85e4
4
- data.tar.gz: ec50bd104241ec26fe1f4ffddba38db553bdec16
3
+ metadata.gz: db7ff4eacde4cbb5229ac829e02010269eadcbdf
4
+ data.tar.gz: 3ad07e6f11dd8136e64cb96091628e587de03589
5
5
  SHA512:
6
- metadata.gz: b1e0ea145f8ebb7ed9e3650b451be5892f4dcb01e676199dd034c223c146070613671064575a33128417b16bb6b094fe8f3f7f65d7016909ca73ec0e743311f5
7
- data.tar.gz: 3694313d40e5bb402e48bd88d26e1d16612cf8c92cc83621ce7429a9188c93019da15f5ecf4d6fde0ea1ef3cda37ebd9de52213b8954a9d17a96faa8ab6ca226
6
+ metadata.gz: f6269d10fc10bf6378f2fcd0cf49ebab5adf25ad6367e80fb09a89ef03aa4ecb35c1b33e747b087fccb88d329459b5972566867c8521324e8c11593b0d5e2aac
7
+ data.tar.gz: db39fd83ab78a91065f997d3aee02f7f157b49e3693f98615c0f86e8e58bbe1e43c988bbed6606cf65cab016fa550c54af25523ae612af9fabe6e3fc62c44559
data/README.md CHANGED
@@ -60,9 +60,9 @@ Vagrant.configure("2") do |config|
60
60
  mos.access_secret = "YOUR SECRET KEY"
61
61
  mos.access_url = "YOUR MOS ACCESS URL"
62
62
  mos.keypair_name = "KEYPAIR NAME"
63
-
64
63
  mos.template_id = "fa1026fe-c082-4ead-8458-802bf65ca64c"
65
-
64
+ mos.data_disk = 100
65
+ mos.band_with = 10
66
66
  override.ssh.username = "root"
67
67
  override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
68
68
  end
@@ -86,8 +86,10 @@ MOS provider设置了若干参数,主要参数说明如下:
86
86
  * `access_secret` - 访问美团云的secret
87
87
  * `access_url` -访问美团云的url
88
88
  * `region` - 创建主机的region,例如 "us-east-1"
89
- * `template_id` - 创建美团云主机的镜像,例如 "fa1026fe-c082-4ead-8458-802bf65ca64c",用户可以使用`vagrant mos-templates`查看可以使用的镜像
90
- * `instance_ready_timeout` - 等待MOS主机创建成功最长时间,单位为秒。默认为120s。
89
+ * `template_id` - 创建美团云主机的镜像,例如 "fa1026fe-c082-4ead-8458-802bf65ca64c",用户可以使用`vagrant mos-templates`查看可以使用的镜像
90
+ * `data_disk` - 创建美团云主机的数据盘大小,单位为GB,例如100代表创建100G的数据盘
91
+ * `band_width` - 创建美团云主机的外网带宽大小,单位为Mbps,例如10代表选择10Mbps的外网带宽
92
+ * `instance_ready_timeout` - 等待MOS主机创建成功最长时间,单位为秒。默认为120s
91
93
  * `instance_name` - 创建的MOS主机名称,例如 "ubuntu007"。
92
94
  * `instance_type` - 创建的MOS主机类型,例如"C1_M1". 默认配置为 "C1_M2".
93
95
  * `keypair_name` - 用户使用的秘钥名称。通过使用秘钥,用户登录该创建的主机时就不需要在输入繁琐的密码了
@@ -26,6 +26,8 @@ module VagrantPlugins
26
26
 
27
27
  # Get the configs
28
28
  region_config = env[:machine].provider_config.get_region_config(region)
29
+ data_disk = region_config.data_disk
30
+ band_width = region_config.band_width
29
31
  template_id = region_config.template_id
30
32
  name = region_config.name
31
33
  instance_type = region_config.instance_type
@@ -39,10 +41,11 @@ module VagrantPlugins
39
41
 
40
42
  # Launch!
41
43
  env[:ui].info(I18n.t("vagrant_mos.launching_instance"))
42
- env[:ui].info(" -- Name: #{name}") if name
43
- env[:ui].info(" -- Type: #{instance_type}")
44
+ env[:ui].info(" -- Machine_name: #{name}") if name
45
+ env[:ui].info(" -- Instance_type: #{instance_type}")
44
46
  env[:ui].info(" -- Template_id: #{template_id}")
45
- #env[:ui].info(" -- Region: #{region}")
47
+ env[:ui].info(" -- Data_disk: #{data_disk}")
48
+ env[:ui].info(" -- Band_width: #{band_width}")
46
49
  env[:ui].info(" -- Keypair: #{keypair}") if keypair
47
50
  env[:ui].info(" -- Terminate On Shutdown: #{terminate_on_shutdown}")
48
51
 
@@ -50,13 +53,15 @@ module VagrantPlugins
50
53
  :flavor_id => instance_type,
51
54
  :name => name,
52
55
  :template_id => template_id,
56
+ :data_disk => data_disk,
57
+ :band_width => band_width,
53
58
  :key_name => keypair,
54
59
  :instance_initiated_shutdown_behavior => terminate_on_shutdown == true ? "terminate" : nil,
55
60
  }
56
61
 
57
62
  begin
58
63
  # create a handler to access MOS
59
- server = env[:mos_compute].create_instance(options[:template_id], options[:flavor_id], nil, options[:name], options[:key_name], datadisk=9, bandwidth=2)
64
+ server = env[:mos_compute].create_instance(options[:template_id], options[:flavor_id], nil, options[:name], options[:key_name], options[:datadisk], options[:bandwidth])
60
65
  rescue Exception => e
61
66
  raise Errors::MosError, :message => e.message
62
67
  end
@@ -8,11 +8,21 @@ module VagrantPlugins
8
8
  # @return [String]
9
9
  attr_accessor :access_key
10
10
 
11
- # The ID of the image to use.
11
+ # The ID of the template to use.
12
12
  #
13
13
  # @return [String]
14
14
  attr_accessor :template_id
15
15
 
16
+ # The data_disk of the instance to create.
17
+ #
18
+ # @return [String]
19
+ attr_accessor :data_disk
20
+
21
+ # The band_width of the instance to create.
22
+ #
23
+ # @return [String]
24
+ attr_accessor :band_width
25
+
16
26
  # The name of the instance to create.
17
27
  #
18
28
  # @return [String]
@@ -75,16 +85,18 @@ module VagrantPlugins
75
85
  attr_accessor :ssh_host_attribute
76
86
 
77
87
  def initialize(region_specific=false)
78
- @access_key = UNSET_VALUE
79
- @template_id = UNSET_VALUE
88
+ @access_key = UNSET_VALUE
89
+ @template_id = UNSET_VALUE
90
+ @data_disk = UNSET_VALUE
91
+ @band_width = UNSET_VALUE
80
92
  @instance_ready_timeout = UNSET_VALUE
81
93
  @name = UNSET_VALUE
82
94
  @instance_type = UNSET_VALUE
83
95
  @keypair_name = UNSET_VALUE
84
96
  @region = UNSET_VALUE
85
97
  @version = UNSET_VALUE
86
- @access_secret = UNSET_VALUE
87
- @access_url = UNSET_VALUE
98
+ @access_secret = UNSET_VALUE
99
+ @access_url = UNSET_VALUE
88
100
  @use_iam_profile = UNSET_VALUE
89
101
  @terminate_on_shutdown = UNSET_VALUE
90
102
  @ssh_host_attribute = UNSET_VALUE
@@ -158,12 +170,18 @@ module VagrantPlugins
158
170
  # Try to get access keys from standard MOS environment variables; they
159
171
  # will default to nil if the environment variables are not present.
160
172
  @access_key = ENV['MOS_ACCESS_KEY'] if @access_key == UNSET_VALUE
161
- @access_secret = ENV['MOS_SECRET_KEY'] if @access_secret == UNSET_VALUE
162
- @access_url = ENV['MOS_SECRET_URL'] if @access_url == UNSET_VALUE
173
+ @access_secret = ENV['MOS_SECRET_KEY'] if @access_secret == UNSET_VALUE
174
+ @access_url = ENV['MOS_SECRET_URL'] if @access_url == UNSET_VALUE
163
175
 
164
176
  # Template_id must be nil, since we can't default that
165
177
  @template_id = nil if @template_id == UNSET_VALUE
166
178
 
179
+ # Default data_disk
180
+ @data_disk = 10 if @data_disk == UNSET_VALUE
181
+
182
+ # Default band_width
183
+ @band_width = 2 if @band_width == UNSET_VALUE
184
+
167
185
  # Default instance name is nil
168
186
  @name = nil if @name == UNSET_VALUE
169
187
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module MOS
3
- VERSION = '0.9.22'
3
+ VERSION = '0.9.23'
4
4
  end
5
5
  end
@@ -34,7 +34,7 @@ describe VagrantPlugins::MOS::Config do
34
34
  # simple boilerplate test, so I cut corners here. It just sets
35
35
  # each of these attributes to "foo" in isolation, and reads the value
36
36
  # and asserts the proper result comes back out.
37
- [:access_key, :template_id, :instance_ready_timeout,:name,
37
+ [:access_key, :template_id, :data_disk, :band_width, :instance_ready_timeout, :name,
38
38
  :instance_type, :keypair_name, :ssh_host_attribute,
39
39
  :region, :access_secret, :access_url, :terminate_on_shutdown,
40
40
  :use_iam_profile].each do |attribute|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-mos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.22
4
+ version: 0.9.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - yangcs2009