line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Virtualization::VBox::option; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use Rex::Logger; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
15
|
|
13
|
1
|
|
|
1
|
|
28
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
288
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $FUNC_MAP = { |
16
|
|
|
|
|
|
|
max_memory => "memory", |
17
|
|
|
|
|
|
|
memory => "memory", |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub execute { |
21
|
0
|
|
|
0
|
0
|
|
my ( $class, $arg1, %opt ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
unless ($arg1) { |
24
|
0
|
|
|
|
|
|
die("You have to define the vm name!"); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $dom = $arg1; |
28
|
0
|
|
|
|
|
|
Rex::Logger::debug("setting some options for: $dom"); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
for my $opt ( keys %opt ) { |
31
|
0
|
|
|
|
|
|
my $val = $opt{$opt}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $func; |
34
|
0
|
0
|
|
|
|
|
unless ( exists $FUNC_MAP->{$opt} ) { |
35
|
0
|
|
|
|
|
|
Rex::Logger::debug("$opt unknown. using as option for VBoxManage."); |
36
|
0
|
|
|
|
|
|
$func = $opt; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
0
|
|
|
|
|
|
$func = $FUNC_MAP->{$opt}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
i_run "VBoxManage modifyvm \"$dom\" --$func \"$val\"", fail_ok => 1; |
43
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
44
|
0
|
|
|
|
|
|
Rex::Logger::info( "Error setting $opt to $val on $dom ($@)", "warn" ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |