| 1 | # | ||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||
| 3 | # | ||||||||||
| 4 | |||||||||||
| 5 | package Rex::Virtualization::LibVirt::vncdisplay; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Rex::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Rex::Helper::Run; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use XML::Simple; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 20 | 0 | my ( $class, $vmname ) = @_; | |||||||||
| 21 | 0 | my $virt_settings = Rex::Config->get("virtualization"); | |||||||||
| 22 | chomp( my $uri = | ||||||||||
| 23 | 0 | ▶ | ref($virt_settings) ? $virt_settings->{connect} : i_run "virsh uri" ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | unless ($vmname) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | die("You have to define the vm name!"); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | Rex::Logger::debug("Getting info of domain: $vmname"); | |||||||||
| 30 | |||||||||||
| 31 | 0 | my $xml; | |||||||||
| 32 | |||||||||||
| 33 | 0 | my @vncdisplay = i_run "virsh -c $uri vncdisplay '$vmname'", fail_ok => 1; | |||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if ( $? != 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | die("Error running virsh vncdisplay '$vmname'"); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | return shift @vncdisplay; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 1 | 1; | |||||||||