virtual_box 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.autotest +9 -0
  2. data/.document +5 -0
  3. data/.project +12 -0
  4. data/.rspec +1 -0
  5. data/Gemfile +14 -0
  6. data/Gemfile.lock +44 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.markdown +67 -0
  9. data/Rakefile +35 -22
  10. data/VERSION +1 -0
  11. data/lib/virtual_box/board.rb +287 -0
  12. data/lib/virtual_box/cli.rb +20 -0
  13. data/lib/virtual_box/dhcp.rb +149 -0
  14. data/lib/virtual_box/disk.rb +138 -0
  15. data/lib/virtual_box/io_bus.rb +261 -0
  16. data/lib/virtual_box/net.rb +144 -0
  17. data/lib/virtual_box/nic.rb +213 -0
  18. data/lib/virtual_box/version.rb +37 -24
  19. data/lib/virtual_box/vm.rb +289 -24
  20. data/lib/virtual_box.rb +14 -9
  21. data/test/helper.rb +24 -0
  22. data/test/tasks/tinycore.rake +378 -0
  23. data/test/virtual_box/board_test.rb +39 -0
  24. data/test/virtual_box/cli_test.rb +33 -0
  25. data/test/virtual_box/dhcp_test.rb +52 -0
  26. data/test/virtual_box/disk_test.rb +116 -0
  27. data/test/virtual_box/integration_test.rb +53 -0
  28. data/test/virtual_box/io_bus_test.rb +54 -0
  29. data/test/virtual_box/net_test.rb +80 -0
  30. data/test/virtual_box/nic_test.rb +50 -0
  31. data/test/virtual_box/version_test.rb +71 -0
  32. data/test/virtual_box/vm_test.rb +55 -0
  33. data/virtual_box.gemspec +81 -22
  34. metadata +208 -89
  35. data/CHANGELOG +0 -1
  36. data/LICENSE +0 -21
  37. data/Manifest +0 -17
  38. data/README.textile +0 -19
  39. data/lib/virtual_box/command_line.rb +0 -27
  40. data/lib/virtual_box/vm/general_settings.rb +0 -136
  41. data/lib/virtual_box/vm/identity.rb +0 -43
  42. data/lib/virtual_box/vm/lifecycle.rb +0 -42
  43. data/test/command_line_test.rb +0 -19
  44. data/test/general_settings_test.rb +0 -20
  45. data/test/lifecycle_test.rb +0 -64
  46. data/test/version_test.rb +0 -56
  47. data/testdata/golden_general_params.txt +0 -1
metadata CHANGED
@@ -1,108 +1,227 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: virtual_box
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Victor Costan
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-08-21 00:00:00 -04:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: echoe
12
+ date: 2012-05-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hashie
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.4.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.4.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: uuid
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 2.3.5
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.5
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.3
17
54
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 3.1.1
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: flexmock
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.3
27
70
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.8.6
34
- version:
35
- description: Ruby API for VirtualBox (Sun's OSS virtualization software).
36
- email: victor@zergling.net
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.3
78
+ - !ruby/object:Gem::Dependency
79
+ name: minitest
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 2.12.1
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.12.1
94
+ - !ruby/object:Gem::Dependency
95
+ name: mocha
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.11.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.11.0
110
+ - !ruby/object:Gem::Dependency
111
+ name: net-ssh
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 2.3.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 2.3.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 0.6.1
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 0.6.1
142
+ - !ruby/object:Gem::Dependency
143
+ name: yard
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: 0.7.5
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: 0.7.5
158
+ description: Drives the VirtualBox command-line to manage VMs
159
+ email: victor@costan.us
37
160
  executables: []
38
-
39
161
  extensions: []
40
-
41
- extra_rdoc_files:
42
- - CHANGELOG
43
- - lib/virtual_box/command_line.rb
44
- - lib/virtual_box/version.rb
45
- - lib/virtual_box/vm/general_settings.rb
46
- - lib/virtual_box/vm/identity.rb
47
- - lib/virtual_box/vm/lifecycle.rb
48
- - lib/virtual_box/vm.rb
162
+ extra_rdoc_files:
163
+ - LICENSE.txt
164
+ - README.markdown
165
+ files:
166
+ - .autotest
167
+ - .document
168
+ - .project
169
+ - .rspec
170
+ - Gemfile
171
+ - Gemfile.lock
172
+ - LICENSE.txt
173
+ - README.markdown
174
+ - Rakefile
175
+ - VERSION
49
176
  - lib/virtual_box.rb
50
- - LICENSE
51
- - README.textile
52
- files:
53
- - CHANGELOG
54
- - lib/virtual_box/command_line.rb
177
+ - lib/virtual_box/board.rb
178
+ - lib/virtual_box/cli.rb
179
+ - lib/virtual_box/dhcp.rb
180
+ - lib/virtual_box/disk.rb
181
+ - lib/virtual_box/io_bus.rb
182
+ - lib/virtual_box/net.rb
183
+ - lib/virtual_box/nic.rb
55
184
  - lib/virtual_box/version.rb
56
- - lib/virtual_box/vm/general_settings.rb
57
- - lib/virtual_box/vm/identity.rb
58
- - lib/virtual_box/vm/lifecycle.rb
59
185
  - lib/virtual_box/vm.rb
60
- - lib/virtual_box.rb
61
- - LICENSE
62
- - Manifest
63
- - Rakefile
64
- - README.textile
65
- - test/command_line_test.rb
66
- - test/general_settings_test.rb
67
- - test/lifecycle_test.rb
68
- - test/version_test.rb
69
- - testdata/golden_general_params.txt
186
+ - test/helper.rb
187
+ - test/tasks/tinycore.rake
188
+ - test/virtual_box/board_test.rb
189
+ - test/virtual_box/cli_test.rb
190
+ - test/virtual_box/dhcp_test.rb
191
+ - test/virtual_box/disk_test.rb
192
+ - test/virtual_box/integration_test.rb
193
+ - test/virtual_box/io_bus_test.rb
194
+ - test/virtual_box/net_test.rb
195
+ - test/virtual_box/nic_test.rb
196
+ - test/virtual_box/version_test.rb
197
+ - test/virtual_box/vm_test.rb
70
198
  - virtual_box.gemspec
71
- has_rdoc: true
72
- homepage: http://github.com/costan/virtual_box
73
- licenses: []
74
-
199
+ homepage: http://github.com/csail/police
200
+ licenses:
201
+ - MIT
75
202
  post_install_message:
76
- rdoc_options:
77
- - --line-numbers
78
- - --inline-source
79
- - --title
80
- - Virtual_box
81
- - --main
82
- - README.textile
83
- require_paths:
203
+ rdoc_options: []
204
+ require_paths:
84
205
  - lib
85
- required_ruby_version: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "0"
90
- version:
91
- required_rubygems_version: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: "1.2"
96
- version:
206
+ required_ruby_version: !ruby/object:Gem::Requirement
207
+ none: false
208
+ requirements:
209
+ - - ! '>='
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ segments:
213
+ - 0
214
+ hash: 3916852811291954048
215
+ required_rubygems_version: !ruby/object:Gem::Requirement
216
+ none: false
217
+ requirements:
218
+ - - ! '>='
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
97
221
  requirements: []
98
-
99
- rubyforge_project: zerglings
100
- rubygems_version: 1.3.5
222
+ rubyforge_project:
223
+ rubygems_version: 1.8.23
101
224
  signing_key:
102
225
  specification_version: 3
103
- summary: Ruby API for VirtualBox (Sun's OSS virtualization software).
104
- test_files:
105
- - test/command_line_test.rb
106
- - test/general_settings_test.rb
107
- - test/lifecycle_test.rb
108
- - test/version_test.rb
226
+ summary: VirtualBox driver
227
+ test_files: []
data/CHANGELOG DELETED
@@ -1 +0,0 @@
1
- v0.0.1. Initial release.
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2009 Zergling.Net
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Manifest DELETED
@@ -1,17 +0,0 @@
1
- CHANGELOG
2
- lib/virtual_box/command_line.rb
3
- lib/virtual_box/version.rb
4
- lib/virtual_box/vm/general_settings.rb
5
- lib/virtual_box/vm/identity.rb
6
- lib/virtual_box/vm/lifecycle.rb
7
- lib/virtual_box/vm.rb
8
- lib/virtual_box.rb
9
- LICENSE
10
- Manifest
11
- Rakefile
12
- README.textile
13
- test/command_line_test.rb
14
- test/general_settings_test.rb
15
- test/lifecycle_test.rb
16
- test/version_test.rb
17
- testdata/golden_general_params.txt
data/README.textile DELETED
@@ -1,19 +0,0 @@
1
- h1. VirtualBox
2
-
3
- This gem is a Ruby API for VirtualBox, Sun's open-source virtualization software
4
- that supports Linux, Mac OS X, and Windows.
5
-
6
- h2. Features
7
-
8
- Currently, the gem supports the following features:
9
- * (work in progress) creating and starting virtual machines
10
- * VirtualBox version detection (OSE vs. regular)
11
-
12
- h2. Contributions
13
-
14
- Please don't hesitate to fork the project and send pull requests.
15
-
16
- Right now, the API is built on top of the VBoxManage command-line utility. This
17
- is an easy implementation, but the performance leaves to be desired. If someone
18
- cares enough, VirtualBox has a binary API based on XPCOM (Linux, OS X) / COM
19
- (Windows). Changes for using the binary API would be greatly appreciated.
@@ -1,27 +0,0 @@
1
- # Interface to the command line.
2
- #
3
- # Author:: Victor Costan
4
- # Copyright:: Copyright (C) 2009 Zergling.Net
5
- # License:: MIT
6
-
7
- require 'english'
8
-
9
- # :nodoc: namespace
10
- module VirtualBox
11
-
12
-
13
- # Runs a command in a sub-shell, waiting until the command completes.
14
- #
15
- # Args:
16
- # command:: a string containing the command to be executed
17
- #
18
- # Returns:
19
- # a hash with the following keys:
20
- # :status:: the command's exit status
21
- # :output:: a string with the command's output
22
- def self.shell_command(command)
23
- output = Kernel.`(command)
24
- { :status => $CHILD_STATUS, :output => output }
25
- end
26
-
27
- end # namespace VirtualBox
@@ -1,136 +0,0 @@
1
- # General VM settings, covered in section 8.5.1 of the VirtualBox User Manual.
2
- #
3
- # Author:: Victor Costan
4
- # Copyright:: Copyright (C) 2009 Zergling.Net
5
- # License:: MIT
6
-
7
- # :nodoc: namespace
8
- module VirtualBox
9
-
10
- # :nodoc: documented in vm.rb
11
- class VM
12
-
13
-
14
- # Mix-in for the VM class covering the general VM settings.
15
- module GeneralSettings
16
- # The amount of megabytes of RAM in the VM.
17
- attr_accessor :ram
18
- # The amount of megabytes of video RAM in the VM.
19
- attr_accessor :video_ram
20
-
21
- # Whether the VM supports PAE (36-bit address space).
22
- attr_accessor :pae
23
- # Whether the VM supports ACPI.
24
- attr_accessor :acpi
25
- # Whether the VM supports I/O APIC.
26
- #
27
- # This is necessary for 64-bit OSes, but makes the virtualization slower.
28
- attr_accessor :io_apic
29
-
30
- # Whether the VM attempts to use hardware support (Intel VT-x or AMD-V).
31
- #
32
- # Hardware virtualization can increase VM performance, especially used in
33
- # conjunction with the other hardware virtualization options. However, using
34
- # hardware virtualzation in conjunction with other hypervisors can crash the
35
- # host machine.
36
- attr_accessor :hardware_virtualization
37
- # Whether the VM uses hardware support for nested paging.
38
- #
39
- # The option is used only if hardware_virtualization is set.
40
- attr_accessor :nested_paging
41
- # Whether the VM uses hardware support for tagged TLB (VPID).
42
- #
43
- # The option is used only if hardware_virtualization is set.
44
- attr_accessor :tagged_tlb
45
-
46
- # Whether the VM supports 3D acceleration.
47
- #
48
- # 3D acceleration will only work with the proper guest extensions.
49
- attr_accessor :accelerate_3d
50
-
51
- # Whether the BIOS logo will fade in when the VM boots.
52
- attr_accessor :bios_logo_fade_in
53
- # Whether the BIOS logo will fade out when the VM boots.
54
- attr_accessor :bios_logo_fade_out
55
- # The number of seconds to display the BIOS logo when the VM boots.
56
- attr_accessor :bios_logo_display_time
57
- # Whether the BIOS allows the user to temporarily override the boot VM device.
58
- #
59
- # If +false+, no override is allowed. Otherwise, the user can press F12 at
60
- # boot time to select a boot device. The user gets a prompt at boot time if
61
- # the value is +true+. If the value is +:menu_only+ the user does not get a
62
- # prompt, but can still press F12 to select a device.
63
- attr_accessor :bios_boot_menu
64
- # Indicates the boot device search order for the VM's BIOS.
65
- #
66
- # This is an array that can contain the following symbols: +:floppy+, +:dvd+,
67
- # +:disk+, +:net+. Symbols should not be repeated.
68
- attr_accessor :boot_order
69
-
70
- # Resets the VM's general settings to their defaults.
71
- #
72
- # The defaults are chosen somewhat arbitrarily by the gem's author.
73
- def reset_general_settings
74
- self.ram = 512
75
- self.video_ram = 12
76
-
77
- self.pae = false
78
- self.acpi = true
79
- self.io_apic = false
80
-
81
- self.hardware_virtualization = true
82
- self.nested_paging = true
83
- self.tagged_tlb = true
84
-
85
- self.accelerate_3d = false
86
-
87
- self.bios_logo_fade_in = false
88
- self.bios_logo_fade_out = false
89
- self.bios_logo_display_time = 0
90
- self.bios_boot_menu = false
91
-
92
- self.boot_order = [:disk, :net, :dvd]
93
- end
94
-
95
- # Arguments to "VBoxManage modifyvm" describing the VM's general settings.
96
- def modifyvm_general_params
97
- params = ''
98
- params << " --memory #{ram}"
99
- params << " --vram #{video_ram}"
100
-
101
- params << " --pae #{pae ? 'on' : 'off'}"
102
- params << " --acpi #{acpi ? 'on' : 'off'}"
103
- params << " --io_apic #{io_apic ? 'on' : 'off'}"
104
-
105
- params << " --hwvirtex #{hardware_virtualization ? 'on' : 'off'}"
106
- nested_paging_enabled = hardware_virtualization && nested_paging
107
- params << " --nestedpaging #{nested_paging_enabled ? 'on' : 'off'}"
108
- tagged_tlb_enabled = hardware_virtualization && tagged_tlb
109
- params << " --vtxvpid #{tagged_tlb_enabled ? 'on' : 'off'}"
110
-
111
- params << " --bioslogofadein #{@bios_logo_fade_in ? 'on' : 'off'}"
112
- params << " --bioslogofadeout #{@bios_logo_fade_out ? 'on' : 'off'}"
113
- params << " --bioslogodisplaytime #{@bios_logo_display_time}"
114
- bios_boot_menu_str = case @bios_boot_menu
115
- when false
116
- 'disabled'
117
- when true
118
- 'messageandmenu'
119
- when :menu_only
120
- 'message'
121
- else
122
- nil
123
- end
124
- params << " --biosbootmenu #{bios_boot_menu_str}"
125
- unique_boot_order = boot_order.uniq
126
- 1.upto(4) do |i|
127
- params << " --boot#{i} #{unique_boot_order[i - 1] || 'none'}"
128
- end
129
-
130
- params
131
- end
132
- end # module GeneralSettings
133
-
134
- end # class VM
135
-
136
- end # namespace VirtualBox
@@ -1,43 +0,0 @@
1
- # VM identity (name and UUID) management.
2
- #
3
- # Author:: Victor Costan
4
- # Copyright:: Copyright (C) 2009 Zergling.Net
5
- # License:: MIT
6
-
7
- # :nodoc: namespace
8
- module VirtualBox
9
-
10
- # :nodoc: documented in vm.rb
11
- class VM
12
-
13
-
14
- # Mix-in for the VM class covering identity management.
15
- module Identity
16
- # The VM's user-friendly name.
17
- attr_accessor :name
18
-
19
- # The VM's UUID (unique id).
20
- attr_accessor :uuid
21
-
22
- # Resets the VM's name and UUID.
23
- def reset_identity
24
- @name = nil
25
- @uuid = nil
26
- end
27
-
28
- # :nodoc: documented as attribute
29
- def uuid
30
- # TODO(overmind): obtain UUID from name if it's not available
31
- @uuid
32
- end
33
-
34
- # :nodoc: documented as attribute
35
- def name
36
- # TODO(overmind): obtain name from UUID if it's not available
37
- @name
38
- end
39
- end # module Lifecycle
40
-
41
- end # class VM
42
-
43
- end # namespace VirtualBox
@@ -1,42 +0,0 @@
1
- # VM life-cycle management.
2
- #
3
- # Author:: Victor Costan
4
- # Copyright:: Copyright (C) 2009 Zergling.Net
5
- # License:: MIT
6
-
7
- # :nodoc: namespace
8
- module VirtualBox
9
-
10
- # :nodoc: documented in vm.rb
11
- class VM
12
-
13
-
14
- # Mix-in for the VM class covering life-cycle management.
15
- module Lifecycle
16
- # Starts the virtual machine.
17
- #
18
- # The following options are supported:
19
- # :gui:: if set to true, VMs will be started in a GUI; this is intended to
20
- # help debugging
21
- # :rdp:: if set to true, RDP support will be enabled; by default, RDP
22
- # support is disabled; VirtualBox OSE does not support RDP, so the
23
- # call will raise an exception
24
- def start(options = {})
25
- if options[:gui]
26
- command = "VBoxManage startvm #{uuid} --type gui"
27
- else
28
- command = "VBoxHeadless --startvm #{uuid}"
29
- end
30
-
31
- if VirtualBox.ose?
32
- raise 'Cannot enable RDP support on VirtualBox OSE' if options[:rdp]
33
- else
34
- command += " --vrdp #{options[:rdp] ? 'on' : 'off'}"
35
- end
36
- VirtualBox.shell_command(command)[:status] == 0
37
- end
38
- end # module Lifecycle
39
-
40
- end # class VM
41
-
42
- end # namespace VirtualBox
@@ -1,19 +0,0 @@
1
- # Interface to the command line.
2
- #
3
- # Author:: Victor Costan
4
- # Copyright:: Copyright (C) 2009 Zergling.Net
5
- # License:: MIT
6
-
7
- require 'virtual_box'
8
- require 'test/unit'
9
-
10
-
11
- class CommandLineTest < Test::Unit::TestCase
12
- def test_shell_command
13
- golden = { :status => 0, :output => "Hello\n" }
14
- VirtualBox.shell_command 'echo Hello'
15
-
16
- golden = { :status => 1, :output => "Boom\n" }
17
- VirtualBox.shell_command 'ruby -e "print :Hello; exit 1"'
18
- end
19
- end
@@ -1,20 +0,0 @@
1
- # Author:: Victor Costan
2
- # Copyright:: Copyright (C) 2009 Zergling.Net
3
- # License:: MIT
4
-
5
- require 'virtual_box'
6
- require 'test/unit'
7
-
8
-
9
- class GeneralSettingsTest < Test::Unit::TestCase
10
- def setup
11
- @testdata_path = File.join(File.dirname(__FILE__), '..', 'testdata')
12
- @vm = VirtualBox::VM.new
13
- end
14
-
15
- def test_modifyvm_general_params
16
- golden_params = File.read File.join(@testdata_path,
17
- 'golden_general_params.txt')
18
- assert_equal golden_params, @vm.modifyvm_general_params
19
- end
20
- end