| 1 | package Linux::Virt::Plugin::KVM; | ||||||||||
| 2 | { | ||||||||||
| 3 | 2 | $Linux::Virt::Plugin::KVM::VERSION = '0.15'; | |||||||||
| 4 | } | ||||||||||
| 5 | 2 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | $Linux::Virt::Plugin::KVM::AUTHORITY = 'cpan:TEX'; | |||||||||
| 7 | } | ||||||||||
| 8 | # ABSTRACT: KVM plugin for Linux::Virt | ||||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use 5.010_000; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use mro 'c3'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use feature ':5.10'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 2 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | # use IO::Handle; | ||||||||||
| 18 | # use autodie; | ||||||||||
| 19 | # use MooseX::Params::Validate; | ||||||||||
| 20 | |||||||||||
| 21 | 2 | extends 'Linux::Virt::Plugin::Libvirt'; | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub _init_priority { return 10; } | ||||||||
|
Subroutine
_init_priority: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub _init_type { | ||||||||
|
Subroutine
_init_type: not called CC=1 SCAR=6.9
| |||||||||||
| 26 | 0 | return 'kvm'; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub is_host { | ||||||||
|
Subroutine
is_host: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 30 | 0 | my $proc_modules = '/proc/modules'; | |||||||||
| 31 | 0 | ▶ | if ( open( my $FH, '<', $proc_modules ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | my @lines = <$FH>; | |||||||||
| 33 | 0 | close($FH); | |||||||||
| 34 | 0 | foreach my $line ( @lines ) { | |||||||||
| 35 | |||||||||||
| 36 | # is the kvm_{intel,amd,...} module loaded? | ||||||||||
| 37 | 0 | ▶ | if ( $line =~ m/^kvm_/i ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | close($FH); | |||||||||
| 39 | 0 | return 1; | |||||||||
| 40 | } | ||||||||||
| 41 | } ## end while ( my $line = <$FH> ) | ||||||||||
| 42 | } ## end if ( open( my $FH, "<"...)) | ||||||||||
| 43 | 0 | return; | |||||||||
| 44 | } ## end sub is_host | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub is_vm { | ||||||||
|
Subroutine
is_vm: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 47 | |||||||||||
| 48 | 0 | my $proc_cpuinfo = '/proc/cpuinfo'; | |||||||||
| 49 | 0 | ▶ | if ( open( my $FH, '<', $proc_cpuinfo ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 0 | my @lines = <$FH>; | |||||||||
| 51 | 0 | close($FH); | |||||||||
| 52 | 0 | foreach my $line ( @lines ) { | |||||||||
| 53 | # is this a QEMU CPU? | ||||||||||
| 54 | 0 | ▶ | if ( $line =~ m/QEMU Virtual CPU/i ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | close($FH); | |||||||||
| 56 | 0 | return 1; | |||||||||
| 57 | } | ||||||||||
| 58 | } ## end while ( my $line = <$FH> ) | ||||||||||
| 59 | } ## end if ( open( my $FH, '<'...)) | ||||||||||
| 60 | 0 | return; | |||||||||
| 61 | } ## end sub is_vm | ||||||||||
| 62 | |||||||||||
| 63 | 2 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 64 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 65 | |||||||||||
| 66 | 2 | 1; | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||