+ Fix hyperv plugin

This commit is contained in:
garnier-quentin 2017-03-27 13:27:25 +02:00
parent 05dede36f8
commit 8bb6cf95e9
2 changed files with 8 additions and 4 deletions

View File

@ -182,15 +182,17 @@ sub manage_selection {
my %values = (vm => $1, description => $2, status => $3, cloud => $4, hostgroup => $5, vmaddition => $6);
$values{hostgroup} =~ s/\\/\//g;
my $filtered = 0;
foreach (('name', 'description', 'status', 'hostgroup')) {
if (defined($self->{option_results}->{'filter_' . $_}) && $self->{option_results}->{'filter_' . $_} ne '' &&
$values{$_} !~ /$self->{option_results}->{'filter_' . $_}/i) {
$self->{output}->output_add(long_msg => "skipping '" . $values{$_} . "': no matching filter.", debug => 1);
next;
$filtered = 1;
last;
}
}
$self->{vm}->{$id} = { %values };
$self->{vm}->{$id} = { %values } if ($filtered == 0);
$id++;
}
}

View File

@ -38,8 +38,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
$vms = Get-VM
$snapshots = Get-VMSnapshot -VMName *
if ($vms.Length -gt 0) {
$snapshots = Get-VMSnapshot -VMName *
}
Foreach ($vm in $vms) {
$i=0
Foreach ($snap in $snapshots) {