vagrant-subutai 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d6d2a8545054356ac7b25e47d3d8645da0ef26a
4
- data.tar.gz: 32d23a3c72eb1e0acbed5739e96208466dcec272
3
+ metadata.gz: 668e1587685362f21364688505f346639c0a5be3
4
+ data.tar.gz: aa349ce6e99e314a4d1d58cedf7499e9430b2de4
5
5
  SHA512:
6
- metadata.gz: 35680eed7399518c665f5aacff2890f6990d84fc8256d331aeb35fddf1db76ae619a095342053a2556021b88cb7d435f7bcc23f181b907ed7b70453a51f8b2ff
7
- data.tar.gz: 347b417244213eb2616e99895b1c936dcf6bfb084c561ac311f0179ea430c306f4184aa85372395c9ad75a108ef33cb040e515c278eeee41b0f2340fd36db269
6
+ metadata.gz: c3130f8f607e75d31b1ac73598944e807a2f4813a27c2a27860b391263faf77602956d166eac7fd18ace24e3e32de3e17caf5d31be7646571c92e722754f0caa
7
+ data.tar.gz: c6c57c761aff04ab63abdddca2cde12eba3aa20ca3f9535951594628258a94bee4ebc959e8aa3f8bdbfaccbd6b41ba540bd98c69c7c68da909969f082d57ea79
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @jadilet
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Vagrant Subutai CLI
1
+ # Vagrant Subutai Plugin
2
2
 
3
- Vagrant Subutai CLI - executes Subutai scripts in target hosts
3
+ Vagrant Subutai Plugin - executes Subutai scripts in target hosts
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,7 +10,7 @@ module VagrantSubutai
10
10
  class Command < Vagrant.plugin('2', :command)
11
11
  # shows description when `vagrant list-commands` is triggered
12
12
  def self.synopsis
13
- 'Vagrant Subutai CLI - executes Subutai scripts in target hosts'
13
+ 'Vagrant Subutai Plugin - executes Subutai scripts in target hosts'
14
14
  end
15
15
 
16
16
  def execute
@@ -37,7 +37,7 @@ module VagrantSubutai
37
37
  opt.on('-s', '--size NUMBER', 'set your disk size') do |num|
38
38
  disk = num.to_i
39
39
 
40
- generated_disk = SubutaiConfig.get(:_SUBUTAI_DISK)
40
+ generated_disk = SubutaiConfig.get(:_DISK_SIZE)
41
41
 
42
42
  if generated_disk.nil?
43
43
  grow_by = disk - 100 # default Subutai disk is 100 gigabytes
@@ -46,7 +46,7 @@ module VagrantSubutai
46
46
  end
47
47
 
48
48
  if grow_by > 0
49
- SubutaiConfig.put(:SUBUTAI_DISK, num, true)
49
+ SubutaiConfig.put(:DISK_SIZE, num, true)
50
50
  STDOUT.puts " \e[33mWarning the disk change cannot be applied until a restart of the VM.\e[0m"
51
51
  else
52
52
  STDOUT.puts " \e[33mWarning the operation will be ignored because it shrink operations are not supported.\e[0m"
@@ -54,7 +54,7 @@ module VagrantSubutai
54
54
  end
55
55
 
56
56
  opt.on('-i', '--info', 'shows Subutai disk capacity') do
57
- disk = SubutaiConfig.get(:SUBUTAI_DISK)
57
+ disk = SubutaiConfig.get(:DISK_SIZE)
58
58
 
59
59
  if disk.nil?
60
60
  STDOUT.puts " \e[32mSubutai disk capacity is 100 gb.\e[0m"
@@ -34,7 +34,7 @@ module SubutaiConfig
34
34
  BRIDGE
35
35
  AUTHORIZED_KEYS
36
36
  PASSWORD_OVERRIDE
37
- SUBUTAI_DISK
37
+ DISK_SIZE
38
38
  ].freeze
39
39
 
40
40
  GENERATED_PARAMETERS = %i[
@@ -49,8 +49,8 @@ module SubutaiConfig
49
49
  _ALT_MANAGEMENT
50
50
  _ALT_MANAGEMENT_MD5
51
51
  _ALT_MANAGEMENT_MD5_LAST
52
- _SUBUTAI_DISK
53
- _SUBUTAI_DISK_PORT
52
+ _DISK_SIZE
53
+ _DISK_PORT
54
54
  ].freeze
55
55
 
56
56
  # Used for testing
@@ -159,12 +159,12 @@ module SubutaiConfig
159
159
  end
160
160
 
161
161
  def self.get_grow_by
162
- disk = get(:SUBUTAI_DISK)
162
+ disk = get(:DISK_SIZE)
163
163
  if disk.nil?
164
164
  nil
165
165
  else
166
166
  disk = disk.to_i
167
- generated_disk = get(:_SUBUTAI_DISK)
167
+ generated_disk = get(:_DISK_SIZE)
168
168
  grow_by = 0
169
169
 
170
170
  if generated_disk.nil?
@@ -0,0 +1,55 @@
1
+ require_relative 'subutai_config'
2
+
3
+ # For managing VM disks
4
+ module SubutaiDisk
5
+ DISK_NAME = "SubutaiDisk"
6
+ DISK_FORMAT = "vdi"
7
+
8
+ # Checks disk size for adding new VM disks
9
+ def self.has_grow
10
+ grow_by = SubutaiConfig.get_grow_by
11
+
12
+ if grow_by.nil?
13
+ [false, nil]
14
+ elsif grow_by > 0
15
+ [true, grow_by]
16
+ else
17
+ [false, nil]
18
+ end
19
+ end
20
+
21
+ # Gives disk port
22
+ def self.port
23
+ port = SubutaiConfig.get(:_DISK_PORT)
24
+
25
+ # Default port value is 1
26
+ if port.nil?
27
+ 1
28
+ else
29
+ port.to_i + 1 # increasing by one for next vm disk attach
30
+ end
31
+ end
32
+
33
+ def self.size(grow_by)
34
+ grow_by.to_i * 1024 + 2 * 1024 # 2 gb for overhead, unit in megabytes
35
+ end
36
+
37
+ # Save disk size and port to generated.yml
38
+ def self.save_conf(grow_by)
39
+ SubutaiConfig.put(:_DISK_PORT, port, true)
40
+
41
+ generated_disk = SubutaiConfig.get(:_DISK_SIZE)
42
+ if generated_disk.nil?
43
+ SubutaiConfig.put(:_DISK_SIZE, grow_by, true) # we set all size of virtual disks to _DISK_SIZE in unit gb
44
+ else
45
+ SubutaiConfig.put(:_DISK_SIZE, grow_by + generated_disk.to_i, true) # we set all size of virtual disks to _DISK_SIZE in unit gb
46
+ end
47
+ end
48
+
49
+ # Gives disk file name
50
+ def self.file(grow_by)
51
+ disk_port = port
52
+
53
+ "./#{DISK_NAME}-#{disk_port.to_i}-#{grow_by}.#{DISK_FORMAT}"
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module VagrantSubutai
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -9,4 +9,5 @@ require 'vagrant-subutai/rh_controller'
9
9
  require 'vagrant-subutai/models/resource_host'
10
10
  require 'vagrant-subutai/packer/subutai_config'
11
11
  require 'vagrant-subutai/packer/subutai_hooks'
12
- require 'vagrant-subutai/packer/subutai_net'
12
+ require 'vagrant-subutai/packer/subutai_net'
13
+ require 'vagrant-subutai/packer/subutai_disk'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-subutai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subutai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - .gitignore
48
+ - CODEOWNERS
48
49
  - Gemfile
49
50
  - README.md
50
51
  - Rakefile
@@ -55,6 +56,7 @@ files:
55
56
  - lib/vagrant-subutai/config.rb
56
57
  - lib/vagrant-subutai/models/resource_host.rb
57
58
  - lib/vagrant-subutai/packer/subutai_config.rb
59
+ - lib/vagrant-subutai/packer/subutai_disk.rb
58
60
  - lib/vagrant-subutai/packer/subutai_hooks.rb
59
61
  - lib/vagrant-subutai/packer/subutai_net.rb
60
62
  - lib/vagrant-subutai/plugin.rb