vagrant-startcloud 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -443
- data/README.md +109 -112
- data/lib/vagrant-startcloud/action/configure_disks.rb +78 -0
- data/lib/vagrant-startcloud/action/configure_networks.rb +51 -45
- data/lib/vagrant-startcloud/action/configure_providers.rb +47 -51
- data/lib/vagrant-startcloud/action/configure_shared_folders.rb +57 -40
- data/lib/vagrant-startcloud/action/is_created.rb +2 -14
- data/lib/vagrant-startcloud/action/is_virtualbox.rb +3 -14
- data/lib/vagrant-startcloud/action.rb +94 -50
- data/lib/vagrant-startcloud/config.rb +83 -19
- data/lib/vagrant-startcloud/plugin.rb +30 -15
- data/lib/vagrant-startcloud/version.rb +1 -1
- data/lib/vagrant-startcloud.rb +53 -1
- metadata +2 -1
data/README.md
CHANGED
@@ -1,19 +1,10 @@
|
|
1
1
|
# Vagrant StartCloud Plugin
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/vagrant-startcloud.svg)](https://badge.fury.io/rb/vagrant-startcloud)
|
4
|
-
[![Build Status](https://github.com/STARTcloud/vagrant-startcloud/workflows/CI/badge.svg)](https://github.com/STARTcloud/vagrant-startcloud/actions)
|
5
|
-
|
6
3
|
A Vagrant plugin that provides support for provisioning machines using YAML configuration with multi-provider support.
|
7
4
|
|
8
|
-
##
|
5
|
+
## Overview
|
9
6
|
|
10
|
-
|
11
|
-
- Support for multiple providers (VirtualBox, Zones, etc.)
|
12
|
-
- Network configuration management
|
13
|
-
- Shared folder configuration
|
14
|
-
- Plugin management
|
15
|
-
- Provisioner configuration (Shell, Ansible)
|
16
|
-
- Provider-specific settings
|
7
|
+
This plugin allows you to define your Vagrant configuration in a YAML file (Hosts.yml) instead of a Ruby-based Vagrantfile. It supports both VirtualBox and Zones providers, and handles network configuration, disk management, shared folders, and more.
|
17
8
|
|
18
9
|
## Installation
|
19
10
|
|
@@ -23,157 +14,163 @@ vagrant plugin install vagrant-startcloud
|
|
23
14
|
|
24
15
|
## Usage
|
25
16
|
|
26
|
-
1. Create a
|
17
|
+
1. Create a minimal Vagrantfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# Vagrantfile
|
21
|
+
Vagrant.configure('2') do |config|
|
22
|
+
StartCloud.configure(config)
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
2. Define your configuration in Hosts.yml:
|
27
27
|
|
28
28
|
```yaml
|
29
29
|
hosts:
|
30
30
|
- settings:
|
31
31
|
hostname: web
|
32
32
|
domain: example.com
|
33
|
-
server_id:
|
33
|
+
server_id: "1001"
|
34
34
|
box: ubuntu/focal64
|
35
35
|
provider_type: virtualbox
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
memory: 2048
|
37
|
+
vcpus: 2
|
38
|
+
setup_wait: 300
|
39
|
+
vagrant_user: vagrant
|
40
|
+
|
39
41
|
networks:
|
40
42
|
- type: private_network
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
43
|
+
address: 192.168.56.10
|
44
|
+
netmask: 255.255.255.0
|
45
|
+
gateway: 192.168.56.1
|
46
|
+
dhcp4: false
|
47
|
+
autoconf: true
|
48
|
+
|
49
|
+
disks:
|
50
|
+
boot:
|
51
|
+
size: 40G
|
52
|
+
data:
|
53
|
+
size: 100G
|
54
|
+
mount: /data
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
+
folders:
|
57
|
+
- map: ./app
|
58
|
+
to: /var/www/app
|
59
|
+
type: rsync
|
60
|
+
owner: www-data
|
61
|
+
group: www-data
|
56
62
|
```
|
57
63
|
|
58
64
|
## Configuration Reference
|
59
65
|
|
60
66
|
### Settings
|
61
67
|
|
62
|
-
- `hostname`:
|
68
|
+
- `hostname`: VM hostname
|
63
69
|
- `domain`: Domain name
|
64
|
-
- `server_id`: Unique identifier for the
|
65
|
-
- `box`: Vagrant box
|
66
|
-
- `
|
67
|
-
- `
|
68
|
-
- `
|
70
|
+
- `server_id`: Unique identifier for the VM
|
71
|
+
- `box`: Vagrant box to use
|
72
|
+
- `provider_type`: Provider to use (virtualbox or zones)
|
73
|
+
- `memory`: Memory allocation in MB
|
74
|
+
- `vcpus`: Number of virtual CPUs
|
75
|
+
- `setup_wait`: Boot timeout in seconds
|
76
|
+
- `vagrant_user`: SSH username
|
69
77
|
|
70
78
|
### Networks
|
71
79
|
|
72
80
|
```yaml
|
73
81
|
networks:
|
74
|
-
- type: private_network
|
75
|
-
|
82
|
+
- type: private_network # or public_network
|
83
|
+
address: 192.168.56.10
|
76
84
|
netmask: 255.255.255.0
|
77
|
-
gateway: 192.168.
|
78
|
-
|
79
|
-
|
85
|
+
gateway: 192.168.56.1
|
86
|
+
dhcp4: false
|
87
|
+
autoconf: true
|
88
|
+
mac: "00:11:22:33:44:55" # optional
|
89
|
+
nic_type: "82540EM" # optional
|
80
90
|
```
|
81
91
|
|
82
|
-
###
|
92
|
+
### Disks
|
83
93
|
|
84
94
|
```yaml
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
95
|
+
disks:
|
96
|
+
boot:
|
97
|
+
size: 40G
|
98
|
+
additional_disks:
|
99
|
+
- volume_name: data
|
100
|
+
size: 100G
|
101
|
+
port: 1
|
92
102
|
```
|
93
103
|
|
94
|
-
###
|
104
|
+
### Shared Folders
|
95
105
|
|
96
106
|
```yaml
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
107
|
+
folders:
|
108
|
+
- map: ./local/path
|
109
|
+
to: /vm/path
|
110
|
+
type: rsync # or nfs, virtualbox
|
111
|
+
owner: vagrant
|
112
|
+
group: vagrant
|
113
|
+
mount_options: [] # optional
|
104
114
|
```
|
105
115
|
|
106
|
-
### Provider Settings
|
116
|
+
### Provider-Specific Settings
|
107
117
|
|
108
118
|
#### VirtualBox
|
109
119
|
|
110
120
|
```yaml
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
121
|
+
settings:
|
122
|
+
provider_type: virtualbox
|
123
|
+
show_console: false
|
124
|
+
firmware_type: UEFI # optional
|
125
|
+
vbox:
|
126
|
+
directives: # optional
|
127
|
+
- directive: usb
|
128
|
+
value: "on"
|
117
129
|
```
|
118
130
|
|
119
131
|
#### Zones
|
120
132
|
|
121
133
|
```yaml
|
134
|
+
settings:
|
135
|
+
provider_type: zones
|
122
136
|
zones:
|
123
|
-
|
124
|
-
|
125
|
-
brand: lx
|
126
|
-
image: ubuntu-20.04
|
127
|
-
```
|
128
|
-
|
129
|
-
## Commands
|
130
|
-
|
131
|
-
- `vagrant startcloud`: Main command
|
132
|
-
- `vagrant startcloud --list`: List configured machines
|
133
|
-
- `vagrant startcloud --config FILE`: Use custom config file
|
134
|
-
- `vagrant startcloud MACHINE`: Configure specific machine
|
135
|
-
|
136
|
-
## Development
|
137
|
-
|
138
|
-
1. Clone the repository:
|
139
|
-
```bash
|
140
|
-
git clone https://github.com/STARTcloud/vagrant-startcloud.git
|
141
|
-
cd vagrant-startcloud
|
137
|
+
brand: bhyve
|
138
|
+
autostart: true
|
142
139
|
```
|
143
140
|
|
144
|
-
|
145
|
-
|
146
|
-
|
141
|
+
## Converting from Traditional Vagrantfile
|
142
|
+
|
143
|
+
This plugin replaces complex Vagrantfile configurations with a structured YAML format. For example, instead of:
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
Vagrant.configure("2") do |config|
|
147
|
+
config.vm.define "web" do |web|
|
148
|
+
web.vm.box = "ubuntu/focal64"
|
149
|
+
web.vm.network "private_network", ip: "192.168.56.10"
|
150
|
+
web.vm.provider "virtualbox" do |vb|
|
151
|
+
vb.memory = 2048
|
152
|
+
vb.cpus = 2
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
147
156
|
```
|
148
157
|
|
149
|
-
|
150
|
-
```bash
|
151
|
-
bundle exec rake
|
152
|
-
```
|
158
|
+
You can use:
|
153
159
|
|
154
|
-
|
155
|
-
|
156
|
-
|
160
|
+
```yaml
|
161
|
+
hosts:
|
162
|
+
- settings:
|
163
|
+
hostname: web
|
164
|
+
domain: example.com
|
165
|
+
box: ubuntu/focal64
|
166
|
+
provider_type: virtualbox
|
167
|
+
memory: 2048
|
168
|
+
vcpus: 2
|
169
|
+
networks:
|
170
|
+
- type: private_network
|
171
|
+
address: 192.168.56.10
|
157
172
|
```
|
158
173
|
|
159
|
-
## Contributing
|
160
|
-
|
161
|
-
1. Fork it
|
162
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
163
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
164
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
165
|
-
5. Create new Pull Request
|
166
|
-
|
167
174
|
## License
|
168
175
|
|
169
|
-
|
170
|
-
|
171
|
-
## Authors
|
172
|
-
|
173
|
-
- Mark Gilbert ([@Makr91](https://github.com/Makr91))
|
174
|
-
- Mark Gilbert ([@MarkProminic](https://github.com/MarkProminic))
|
175
|
-
|
176
|
-
## Acknowledgments
|
177
|
-
|
178
|
-
- Based on the core_provisioner concept
|
179
|
-
- Inspired by vagrant-zones and vagrant-scp-sync plugins
|
176
|
+
AGPL-3.0
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module StartCloud
|
5
|
+
module Action
|
6
|
+
class ConfigureDisks
|
7
|
+
def initialize(app, env)
|
8
|
+
@app = app
|
9
|
+
@env = env
|
10
|
+
@machine = env[:machine]
|
11
|
+
@provider = env[:provider]
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
config = @machine.config.startcloud
|
16
|
+
disks = config.disks
|
17
|
+
|
18
|
+
if disks && !disks.empty?
|
19
|
+
@machine.ui.info I18n.t('vagrant_startcloud.configuring.disks')
|
20
|
+
|
21
|
+
case @provider
|
22
|
+
when :virtualbox
|
23
|
+
configure_virtualbox_disks(disks)
|
24
|
+
when :zones
|
25
|
+
configure_zones_disks(disks)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
@app.call(env)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def configure_virtualbox_disks(disks)
|
35
|
+
return unless disks['additional_disks']
|
36
|
+
|
37
|
+
disks_directory = File.join(@env[:root_path], 'disks')
|
38
|
+
FileUtils.mkdir_p(disks_directory) unless File.directory?(disks_directory)
|
39
|
+
|
40
|
+
disks['additional_disks'].each do |disk|
|
41
|
+
local_disk_filename = File.join(disks_directory, "#{disk['volume_name']}.vdi")
|
42
|
+
|
43
|
+
unless File.exist?(local_disk_filename)
|
44
|
+
disk_size_gb = disk['size'].match(/(\d+(\.\d+)?)/)[0].to_f
|
45
|
+
disk_size_mb = (disk_size_gb * 1024).to_i
|
46
|
+
|
47
|
+
@machine.provider.driver.create_disk(
|
48
|
+
local_disk_filename,
|
49
|
+
disk_size_mb,
|
50
|
+
{ format: 'VDI' }
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
@machine.provider.driver.attach_disk(
|
55
|
+
local_disk_filename,
|
56
|
+
{
|
57
|
+
controller: 'SCSI',
|
58
|
+
port: disk['port'],
|
59
|
+
device: 0
|
60
|
+
}
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def configure_zones_disks(disks)
|
66
|
+
return unless @machine.provider.capability?(:configure_disks)
|
67
|
+
|
68
|
+
disk_options = {
|
69
|
+
boot: disks['boot'],
|
70
|
+
additional: disks['additional_disks']
|
71
|
+
}.compact
|
72
|
+
|
73
|
+
@machine.provider.capability(:configure_disks, disk_options)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -22,8 +22,15 @@ module VagrantPlugins
|
|
22
22
|
netmask: network['netmask'],
|
23
23
|
gateway: network['gateway'],
|
24
24
|
dhcp: network['dhcp4'],
|
25
|
-
|
26
|
-
|
25
|
+
dhcp4: network['dhcp4'],
|
26
|
+
dhcp6: network['dhcp6'],
|
27
|
+
auto_config: network['autoconf'],
|
28
|
+
mac: format_mac_address(network['mac'], @provider),
|
29
|
+
nic_type: network['nic_type'],
|
30
|
+
vlan: network['vlan'],
|
31
|
+
dns: network['dns'],
|
32
|
+
bridge: network['bridge']
|
33
|
+
}.compact
|
27
34
|
|
28
35
|
case network['type']
|
29
36
|
when 'host'
|
@@ -51,59 +58,58 @@ module VagrantPlugins
|
|
51
58
|
end
|
52
59
|
|
53
60
|
def configure_virtualbox_network(machine, type, options)
|
61
|
+
adapter_number = machine.provider.driver.read_network_interfaces.length + 1
|
62
|
+
network_options = {
|
63
|
+
adapter: adapter_number,
|
64
|
+
ip: options[:ip],
|
65
|
+
netmask: options[:netmask],
|
66
|
+
auto_config: options[:auto_config],
|
67
|
+
mac: options[:mac],
|
68
|
+
nic_type: options[:nic_type],
|
69
|
+
vlan: options[:vlan]
|
70
|
+
}.compact
|
71
|
+
|
54
72
|
case type
|
55
73
|
when 'private_network'
|
56
|
-
|
57
|
-
|
58
|
-
[{
|
59
|
-
type: :static,
|
60
|
-
adapter: machine.provider.driver.read_network_interfaces.length + 1,
|
61
|
-
ip: options[:ip],
|
62
|
-
netmask: options[:netmask],
|
63
|
-
auto_config: options[:auto_config]
|
64
|
-
}]
|
65
|
-
)
|
74
|
+
network_options[:type] = :static
|
75
|
+
machine.provider.capability(:configure_networks, [network_options])
|
66
76
|
when 'public_network'
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
type: :bridged,
|
71
|
-
adapter: machine.provider.driver.read_network_interfaces.length + 1,
|
72
|
-
ip: options[:ip],
|
73
|
-
netmask: options[:netmask],
|
74
|
-
auto_config: options[:auto_config]
|
75
|
-
}]
|
76
|
-
)
|
77
|
+
network_options[:type] = :bridged
|
78
|
+
network_options[:bridge] = options[:bridge] if options[:bridge]
|
79
|
+
machine.provider.capability(:configure_networks, [network_options])
|
77
80
|
end
|
78
81
|
end
|
79
82
|
|
80
83
|
def configure_zones_network(machine, type, options)
|
84
|
+
network_options = {
|
85
|
+
type: :vnic,
|
86
|
+
ip: options[:ip],
|
87
|
+
netmask: options[:netmask],
|
88
|
+
gateway: options[:gateway],
|
89
|
+
dhcp4: options[:dhcp4],
|
90
|
+
dhcp6: options[:dhcp6],
|
91
|
+
autoconf: options[:auto_config],
|
92
|
+
mac: options[:mac],
|
93
|
+
dns: options[:dns]
|
94
|
+
}.compact
|
95
|
+
|
81
96
|
case type
|
82
97
|
when 'private_network'
|
83
|
-
machine.provider.capability(
|
84
|
-
:configure_networks,
|
85
|
-
[{
|
86
|
-
type: :vnic,
|
87
|
-
ip: options[:ip],
|
88
|
-
netmask: options[:netmask],
|
89
|
-
gateway: options[:gateway],
|
90
|
-
dhcp4: options[:dhcp],
|
91
|
-
autoconf: options[:auto_config]
|
92
|
-
}]
|
93
|
-
)
|
98
|
+
machine.provider.capability(:configure_networks, [network_options])
|
94
99
|
when 'public_network'
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
100
|
+
network_options[:public] = true
|
101
|
+
machine.provider.capability(:configure_networks, [network_options])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def format_mac_address(mac, provider)
|
106
|
+
return nil unless mac
|
107
|
+
|
108
|
+
case provider
|
109
|
+
when :virtualbox
|
110
|
+
mac.tr(':', '') # VirtualBox requires MAC without colons
|
111
|
+
else
|
112
|
+
mac # Other providers use standard MAC format
|
107
113
|
end
|
108
114
|
end
|
109
115
|
end
|
@@ -4,24 +4,26 @@ module VagrantPlugins
|
|
4
4
|
module StartCloud
|
5
5
|
module Action
|
6
6
|
class ConfigureProviders
|
7
|
-
def initialize(app,
|
7
|
+
def initialize(app, env)
|
8
8
|
@app = app
|
9
|
+
@env = env
|
10
|
+
@machine = env[:machine]
|
11
|
+
@provider = env[:provider]
|
9
12
|
end
|
10
13
|
|
11
14
|
def call(env)
|
12
|
-
|
13
|
-
config = machine.config.startcloud
|
15
|
+
config = @machine.config.startcloud
|
14
16
|
settings = config.settings
|
15
17
|
|
16
18
|
if settings && settings['provider_type']
|
17
|
-
|
18
|
-
|
19
|
+
@machine.ui.info I18n.t('vagrant_startcloud.configuring.provider',
|
20
|
+
provider: settings['provider_type'])
|
19
21
|
|
20
22
|
case settings['provider_type']
|
21
23
|
when 'virtualbox'
|
22
|
-
configure_virtualbox(
|
24
|
+
configure_virtualbox(settings)
|
23
25
|
when 'zones'
|
24
|
-
configure_zones(
|
26
|
+
configure_zones(settings, config.zones)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -30,55 +32,49 @@ module VagrantPlugins
|
|
30
32
|
|
31
33
|
private
|
32
34
|
|
33
|
-
def configure_virtualbox(
|
34
|
-
machine.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'off']
|
53
|
-
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']
|
54
|
-
vb.customize ['modifyvm', :id, '--accelerate3d', 'off']
|
55
|
-
vb.customize ['modifyvm', :id, '--vram', '256']
|
56
|
-
|
57
|
-
# Apply custom VirtualBox directives if specified
|
58
|
-
if settings['vbox']&.dig('directives')
|
59
|
-
settings['vbox']['directives'].each do |directive|
|
60
|
-
vb.customize ['modifyvm', :id, "--#{directive['directive']}", directive['value']]
|
61
|
-
end
|
62
|
-
end
|
35
|
+
def configure_virtualbox(settings)
|
36
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--memory', calculate_memory(settings['memory'])]
|
37
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--cpus', settings['vcpus']] if settings['vcpus']
|
38
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--ostype', settings['os_type']] if settings['os_type']
|
39
|
+
|
40
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--firmware', 'efi'] if settings['firmware_type'] == 'UEFI'
|
41
|
+
|
42
|
+
# Configure VirtualBox-specific settings
|
43
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--vrde', 'on']
|
44
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--natdnsproxy1', 'off']
|
45
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--natdnshostresolver1', 'off']
|
46
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--accelerate3d', 'off']
|
47
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, '--vram', '256']
|
48
|
+
|
49
|
+
# Apply custom VirtualBox directives if specified
|
50
|
+
return unless settings['vbox']&.dig('directives')
|
51
|
+
|
52
|
+
settings['vbox']['directives'].each do |directive|
|
53
|
+
@machine.provider.driver.customize ['modifyvm', @machine.id, "--#{directive['directive']}", directive['value']]
|
63
54
|
end
|
64
55
|
end
|
65
56
|
|
66
|
-
def configure_zones(
|
67
|
-
machine.
|
68
|
-
zones.hostname = "#{settings['subdomain']}.#{settings['domain']}"
|
69
|
-
zones.name = "#{settings['partition_id']}--#{settings['subdomain']}.#{settings['domain']}"
|
70
|
-
zones.partition_id = settings['server_id']
|
57
|
+
def configure_zones(settings, zones_config)
|
58
|
+
return unless @machine.provider.capability?(:configure_zone)
|
71
59
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
60
|
+
zone_options = {
|
61
|
+
hostname: "#{settings['hostname']}.#{settings['domain']}",
|
62
|
+
brand: zones_config['brand'],
|
63
|
+
memory: settings['memory'],
|
64
|
+
cpus: settings['vcpus'],
|
65
|
+
autostart: zones_config['autostart']
|
66
|
+
}.compact
|
67
|
+
|
68
|
+
@machine.provider.capability(:configure_zone, zone_options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def calculate_memory(memory)
|
72
|
+
return 1024 unless memory # Default to 1GB if not specified
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
zones.image = zones_config['image']
|
74
|
+
if memory.to_s =~ /gb|g/i
|
75
|
+
1024 * memory.to_s.tr('^0-9', '').to_i
|
76
|
+
else
|
77
|
+
memory.to_s.tr('^0-9', '').to_i
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|