| 1 | # | ||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | Rex::Virtualization::LibVirt - LibVirt Virtualization Module | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | With this module you can manage LibVirt. | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | use Rex::Commands::Virtualization; | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | set virtualization => "LibVirt"; | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | print Dumper vm list => "all"; | ||||||||||||||||||||
| 20 | print Dumper vm list => "running"; | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | vm destroy => "vm01"; | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | vm delete => "vm01"; | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | vm start => "vm01"; | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | vm shutdown => "vm01"; | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | vm reboot => "vm01"; | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | vm option => "vm01", | ||||||||||||||||||||
| 33 | max_memory => 1024*1024, | ||||||||||||||||||||
| 34 | memory => 512*1024; | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | print Dumper vm info => "vm01"; | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | # creating a vm on a kvm host | ||||||||||||||||||||
| 39 | vm create => "vm01", | ||||||||||||||||||||
| 40 | storage => [ | ||||||||||||||||||||
| 41 | { | ||||||||||||||||||||
| 42 | file => "/mnt/data/libvirt/images/vm01.img", | ||||||||||||||||||||
| 43 | dev => "vda", | ||||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | ]; | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | print Dumper vm hypervisor => "capabilities"; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | =cut | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | package Rex::Virtualization::LibVirt; | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 3 | ▶ | use v5.14.4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 3 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 3 | ▶ | use Rex::Virtualization::Base; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 59 | 3 | ▶ | use base qw(Rex::Virtualization::Base); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 62 | 2 | my $that = shift; | |||||||||||||||||||
| 63 | 2 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||
|
Condition33%1/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table33%1/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 64 | 2 | my $self = {@_}; | |||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 2 | bless( $self, $proto ); | |||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 2 | return $self; | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 3 | 1; | |||||||||||||||||||