virtuoso-prototype 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,15 +21,15 @@ class CLI
21
21
  setup_cli_arguments!
22
22
  options = parse_arguments(arguments)
23
23
  ensure_virtualbox_installed
24
- perform_action!(options[:operation], options[:vm_name], options[:bond_interface])
24
+ perform_action!(options[:operation], options[:vm_name], options[:bond_interface], options[:disk_size])
25
25
  end
26
26
 
27
27
  private
28
28
 
29
- def perform_action!(operation, vm_name, bond_interface)
29
+ def perform_action!(operation, vm_name, bond_interface, disk_size)
30
30
  case operation
31
31
  when 'create' then
32
- @vm_interface.create!(vm_name, bond_interface)
32
+ @vm_interface.create!(vm_name, bond_interface, disk_size)
33
33
  when 'destroy' then
34
34
  @vm_interface.destroy!(vm_name, :delete)
35
35
  else
@@ -67,6 +67,15 @@ class CLI
67
67
  long '--bond_interface=INTERFACE0'
68
68
  desc 'The network interface on the host machine to which the virtual network interface should bond'
69
69
  end
70
+
71
+ option :disk_size do
72
+ short '-d'
73
+ long '--disk_size=MEGABYTES'
74
+ desc 'The size of the virtual disk allocated to the virtualmachine in megabytes'
75
+ cast Integer
76
+ default 8000
77
+ end
78
+
70
79
  end
71
80
  end
72
81
 
@@ -15,12 +15,12 @@ module VirtualBox
15
15
  @virtualbox[:version] = ::VirtualBox.version
16
16
  end
17
17
 
18
- def create!(vm_name, bond_interface)
18
+ def create!(vm_name, bond_interface, disk_size)
19
19
  vm = create_vm!(vm_name)
20
20
  vm = setup_vm!(vm)
21
21
  vm.reload
22
22
  storage_controller = add_storage_controller!(vm)
23
- disk = create_disk!(vm_name)
23
+ disk = create_disk!(vm_name, disk_size)
24
24
  attach_disk!(vm, storage_controller, disk)
25
25
  add_bridged_network_interface!(vm, 1, bond_interface)
26
26
  set_boot_order!(vm)
@@ -97,11 +97,11 @@ module VirtualBox
97
97
  end
98
98
  end
99
99
 
100
- def create_disk!(disk_name)
100
+ def create_disk!(disk_name, disk_size)
101
101
  disk = ::VirtualBox::HardDrive.new
102
102
  disk.format = "VDI"
103
103
  disk.location = "#{disk_name}.vdi"
104
- disk.logical_size = 8000 # in megabytes
104
+ disk.logical_size = disk_size # in megabytes
105
105
  if disk.save
106
106
  return disk
107
107
  else
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtuoso-prototype
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 6
10
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
11
10
  platform: ruby
12
11
  authors:
13
12
  - 3Crowd Technologies, Inc.
@@ -16,18 +15,16 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-09-23 00:00:00 -07:00
18
+ date: 2010-10-12 00:00:00 -07:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: virtualbox
24
23
  prerelease: false
25
24
  requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
25
  requirements:
28
26
  - - ">="
29
27
  - !ruby/object:Gem::Version
30
- hash: 9
31
28
  segments:
32
29
  - 0
33
30
  - 7
@@ -39,11 +36,9 @@ dependencies:
39
36
  name: choice
40
37
  prerelease: false
41
38
  requirement: &id002 !ruby/object:Gem::Requirement
42
- none: false
43
39
  requirements:
44
40
  - - ">="
45
41
  - !ruby/object:Gem::Version
46
- hash: 19
47
42
  segments:
48
43
  - 0
49
44
  - 1
@@ -55,11 +50,9 @@ dependencies:
55
50
  name: systemu
56
51
  prerelease: false
57
52
  requirement: &id003 !ruby/object:Gem::Requirement
58
- none: false
59
53
  requirements:
60
54
  - - ">="
61
55
  - !ruby/object:Gem::Version
62
- hash: 31
63
56
  segments:
64
57
  - 1
65
58
  - 2
@@ -71,11 +64,9 @@ dependencies:
71
64
  name: uuid
72
65
  prerelease: false
73
66
  requirement: &id004 !ruby/object:Gem::Requirement
74
- none: false
75
67
  requirements:
76
68
  - - ">="
77
69
  - !ruby/object:Gem::Version
78
- hash: 1
79
70
  segments:
80
71
  - 2
81
72
  - 3
@@ -96,10 +87,10 @@ files:
96
87
  - bin/virtuoso-prototype
97
88
  - lib/virtuoso.rb
98
89
  - lib/virtuoso/virtualbox/interface.rb
90
+ - lib/virtuoso/errors/vm_not_created.rb
91
+ - lib/virtuoso/errors/virtualbox_not_found.rb
99
92
  - lib/virtuoso/errors/vm_not_found.rb
100
93
  - lib/virtuoso/errors/disk_not_created.rb
101
- - lib/virtuoso/errors/virtualbox_not_found.rb
102
- - lib/virtuoso/errors/vm_not_created.rb
103
94
  - lib/virtuoso/virtualbox.rb
104
95
  - lib/virtuoso/errors.rb
105
96
  - LICENSE
@@ -115,20 +106,16 @@ rdoc_options: []
115
106
  require_paths:
116
107
  - lib
117
108
  required_ruby_version: !ruby/object:Gem::Requirement
118
- none: false
119
109
  requirements:
120
110
  - - ">="
121
111
  - !ruby/object:Gem::Version
122
- hash: 3
123
112
  segments:
124
113
  - 0
125
114
  version: "0"
126
115
  required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
116
  requirements:
129
117
  - - ">="
130
118
  - !ruby/object:Gem::Version
131
- hash: 23
132
119
  segments:
133
120
  - 1
134
121
  - 3
@@ -137,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
124
  requirements: []
138
125
 
139
126
  rubyforge_project:
140
- rubygems_version: 1.3.7
127
+ rubygems_version: 1.3.6
141
128
  signing_key:
142
129
  specification_version: 3
143
130
  summary: A protoype for managing virtualbox VMs, scripts VBoxManage